From a5f53da229f0f3f5b7e248c47061a67f6d61d81e Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 12 Jan 2018 04:16:39 +0100 Subject: af_lavrresample: deprecate this filter The future direction might be not having such a user-visible filter at all, similar to how vf_scale went away (or actually, redirects to libavfilter's vf_scale). --- audio/filter/af.c | 6 ++++-- audio/filter/af_lavrresample.c | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'audio') diff --git a/audio/filter/af.c b/audio/filter/af.c index 35525d0774..cf200bbb84 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -341,8 +341,9 @@ static int filter_reinit_with_conversion(struct af_stream *s, struct af_instance } if (!mp_audio_config_equals(af->prev->data, &in)) { // Retry with conversion filter added. + char *opts[] = {"deprecation-warning", "no", NULL}; struct af_instance *new = - af_prepend(s, af, "lavrresample", NULL); + af_prepend(s, af, "lavrresample", opts); if (!new) return AF_ERROR; new->auto_inserted = true; @@ -408,7 +409,8 @@ static int af_do_reinit(struct af_stream *s, bool second_pass) s->first->fmt_in = s->first->fmt_out = s->input; if (mp_audio_config_valid(&convert_early)) { - struct af_instance *new = af_prepend(s, s->first, "lavrresample", NULL); + char *opts[] = {"deprecation-warning", "no", NULL}; + struct af_instance *new = af_prepend(s, s->first, "lavrresample", opts); if (!new) return AF_ERROR; new->auto_inserted = true; diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c index 96387060b1..f13093da40 100644 --- a/audio/filter/af_lavrresample.c +++ b/audio/filter/af_lavrresample.c @@ -45,6 +45,7 @@ struct af_resample { struct mp_resample_opts opts; int global_normalize; struct mp_aconverter *converter; + int deprecation_warning; }; static int control(struct af_instance *af, int cmd, void *arg) @@ -149,6 +150,11 @@ static int af_open(struct af_instance *af) s->converter = mp_aconverter_create(af->global, af->log, &s->opts); + if (s->deprecation_warning) { + MP_WARN(af, "This filter is deprecated! Use the --audio-resample- options" + " to customize resampling, or the --af=aresample filter.\n"); + } + return AF_OK; } @@ -183,6 +189,7 @@ const struct af_info af_info_lavrresample = { .opts = MP_RESAMPLE_OPTS_DEF, .playback_speed = 1.0, .allow_detach = 1, + .deprecation_warning = 1, }, .options = (const struct m_option[]) { OPT_INTRANGE("filter-size", opts.filter_size, 0, 0, 32), @@ -193,6 +200,7 @@ const struct af_info af_info_lavrresample = { OPT_CHOICE("normalize", opts.normalize, 0, ({"no", 0}, {"yes", 1}, {"auto", -1})), OPT_KEYVALUELIST("o", opts.avopts, 0), + OPT_FLAG("deprecation-warning", deprecation_warning, 0), {0} }, .set_defaults = set_defaults, -- cgit v1.2.3