From b96a74ec2a77a4fb8d62d331dcd9ed087e9813e6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 4 Apr 2017 15:04:07 +0200 Subject: audio: deprecate most audio filters Well, ok, only 4 filters. The rest will survive in one or the other form. --- audio/filter/af_channels.c | 2 ++ audio/filter/af_equalizer.c | 1 + audio/filter/af_pan.c | 1 + audio/filter/af_volume.c | 4 ++++ player/audio.c | 3 ++- 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/audio/filter/af_channels.c b/audio/filter/af_channels.c index 57fe4874ef..7cd7810d08 100644 --- a/audio/filter/af_channels.c +++ b/audio/filter/af_channels.c @@ -214,6 +214,8 @@ static int af_open(struct af_instance* af){ af->filter_frame = filter_frame; af_channels_t *s = af->priv; + MP_WARN(af, "This filter is deprecated (no replacement).\n"); + // If router scan commandline for routing pairs if(s->routes && s->routes[0]){ char* cp = s->routes; diff --git a/audio/filter/af_equalizer.c b/audio/filter/af_equalizer.c index cb4ecb2675..3f132fdc0c 100644 --- a/audio/filter/af_equalizer.c +++ b/audio/filter/af_equalizer.c @@ -188,6 +188,7 @@ static int filter(struct af_instance* af, struct mp_audio* data) // Allocate memory and set function pointers static int af_open(struct af_instance* af){ + MP_WARN(af, "This filter is deprecated. Use 'anequalizer' or 'firequalizer' instead.\n"); af->control=control; af->filter_frame = filter; af_equalizer_t *priv = af->priv; diff --git a/audio/filter/af_pan.c b/audio/filter/af_pan.c index de2adf790c..b2233a7191 100644 --- a/audio/filter/af_pan.c +++ b/audio/filter/af_pan.c @@ -180,6 +180,7 @@ static int af_open(struct af_instance *af) { af->control = control; af->filter_frame = filter_frame; + MP_WARN(af, "This filter is deprecated. Use lavfi pan instead.\n"); af_pan_t *s = af->priv; int nch = s->nch; if (nch && AF_OK != control(af, AF_CONTROL_SET_PAN_NOUT, &nch)) diff --git a/audio/filter/af_volume.c b/audio/filter/af_volume.c index e1d5d45e89..fb7a87f9d0 100644 --- a/audio/filter/af_volume.c +++ b/audio/filter/af_volume.c @@ -42,6 +42,7 @@ struct priv { int fast; // Use fix-point volume control int detach; // Detach if gain volume is neutral float cfg_volume; + int warn; }; // Convert to gain value from dB. input <= -200dB will become 0 gain. @@ -160,6 +161,8 @@ static int filter(struct af_instance *af, struct mp_audio *data) static int af_open(struct af_instance *af) { struct priv *s = af->priv; + if (s->warn) + MP_WARN(af, "This filter is deprecated. Use --volume directly.\n"); af->control = control; af->filter_frame = filter; s->level = 1.0; @@ -184,6 +187,7 @@ const struct af_info af_info_volume = { OPT_FLAG("softclip", soft, 0), OPT_FLAG("s16", fast, 0), OPT_FLAG("detach", detach, 0), + OPT_FLAG("warn", warn, 0, OPTDEF_INT(1)), {0} }, }; diff --git a/player/audio.c b/player/audio.c index d15f4e9869..d05cae83cd 100644 --- a/player/audio.c +++ b/player/audio.c @@ -135,7 +135,8 @@ void audio_update_volume(struct MPContext *mpctx) if (gain == 1.0) return; MP_VERBOSE(mpctx, "Inserting volume filter.\n"); - if (!(af_add(ao_c->af, "volume", "softvol", NULL) + char *args[] = {"warn", "no", NULL}; + if (!(af_add(ao_c->af, "volume", "softvol", args) && af_control_any_rev(ao_c->af, AF_CONTROL_SET_VOLUME, &gain))) MP_ERR(mpctx, "No volume control available.\n"); } -- cgit v1.2.3