From ac966ded11e22754ffa43b390e599e4242e29b37 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 20 Jan 2016 17:14:04 +0100 Subject: audio: change downmix behavior, add --audio-normalize-downmix This is probably the 3rd time the user-visible behavior changes. This time, switch back because not normalizing seems to be the more expected behavior from users. --- audio/filter/af.c | 1 + audio/filter/af.h | 1 + audio/filter/af_lavrresample.c | 12 ++++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'audio/filter') diff --git a/audio/filter/af.c b/audio/filter/af.c index 7ff3b49ae8..475016d2ea 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -166,6 +166,7 @@ static struct af_instance *af_create(struct af_stream *s, char *name, .info = desc.p, .data = talloc_zero(af, struct mp_audio), .log = mp_log_new(af, s->log, name), + .opts = s->opts, .replaygain_data = s->replaygain_data, .out_pool = mp_audio_pool_create(af), }; diff --git a/audio/filter/af.h b/audio/filter/af.h index ba64379661..0e73693ac9 100644 --- a/audio/filter/af.h +++ b/audio/filter/af.h @@ -53,6 +53,7 @@ struct af_info { struct af_instance { const struct af_info *info; struct mp_log *log; + struct MPOpts *opts; struct replaygain_data *replaygain_data; int (*control)(struct af_instance *af, int cmd, void *arg); void (*uninit)(struct af_instance *af); diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c index 477443cefc..0c175a42e4 100644 --- a/audio/filter/af_lavrresample.c +++ b/audio/filter/af_lavrresample.c @@ -261,10 +261,13 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in, av_opt_set_double(s->avrctx, "cutoff", s->opts.cutoff, 0); + int normalize = s->opts.normalize; + if (normalize < 0) + normalize = af->opts->audio_normalize; #if HAVE_LIBSWRESAMPLE - av_opt_set_double(s->avrctx, "rematrix_maxval", s->opts.normalize ? 1 : 1000, 0); + av_opt_set_double(s->avrctx, "rematrix_maxval", normalize ? 1 : 1000, 0); #else - av_opt_set_int(s->avrctx, "normalize_mix_level", s->opts.normalize, 0); + av_opt_set_int(s->avrctx, "normalize_mix_level", !!normalize, 0); #endif if (mp_set_avopts(af->log, s->avrctx, s->avopts) < 0) @@ -616,7 +619,7 @@ const struct af_info af_info_lavrresample = { .filter_size = 16, .cutoff = 0.0, .phase_shift = 10, - .normalize = 1, + .normalize = -1, }, .playback_speed = 1.0, .allow_detach = 1, @@ -627,7 +630,8 @@ const struct af_info af_info_lavrresample = { OPT_FLAG("linear", opts.linear, 0), OPT_DOUBLE("cutoff", opts.cutoff, M_OPT_RANGE, .min = 0, .max = 1), OPT_FLAG("detach", allow_detach, 0), - OPT_FLAG("normalize", opts.normalize, 0), + OPT_CHOICE("normalize", opts.normalize, 0, + ({"no", 0}, {"yes", 1}, {"auto", -1})), OPT_KEYVALUELIST("o", avopts, 0), {0} }, -- cgit v1.2.3