summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-22 14:22:28 +0100
committerwm4 <wm4@nowhere>2016-03-22 14:22:28 +0100
commit0b1157766dbf5dfa8def21b617a719ed28233bbb (patch)
tree7223f4d726ec23f477030980a3c03be091f94840
parent435cc1b057e2046bac21c1b1942561f5a86a3482 (diff)
downloadmpv-something.tar.bz2
mpv-something.tar.xz
af_lavrresample: force libswscale to use float for downmixingsomething
Not sure if this really helps.
-rw-r--r--audio/filter/af_lavrresample.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c
index 56257edb84..63804566d9 100644
--- a/audio/filter/af_lavrresample.c
+++ b/audio/filter/af_lavrresample.c
@@ -325,6 +325,13 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
if (normalize < 0)
normalize = af->opts->audio_normalize;
#if HAVE_LIBSWRESAMPLE
+ if (!normalize && in_lavc.num > out_lavc.num) {
+ int sample_fmt = AV_SAMPLE_FMT_FLTP;
+ if (af_fmt_is_float(s->out_format) && af_fmt_to_bytes(s->out_format) > 4)
+ sample_fmt = AV_SAMPLE_FMT_DBLP;
+ MP_VERBOSE(af, "Forcing internal_sample_fmt=%d\n", sample_fmt);
+ av_opt_set_int(s->avrctx_out, "internal_sample_fmt", sample_fmt, 0);
+ }
av_opt_set_double(s->avrctx, "rematrix_maxval", normalize ? 1 : 1000, 0);
#else
av_opt_set_int(s->avrctx, "normalize_mix_level", !!normalize, 0);