diff options
author | wm4 <wm4@nowhere> | 2015-10-26 15:53:47 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-10-26 15:53:47 +0100 |
commit | 0ffaf653a21d0c767abfcf1094f9e57a6c9b5ba4 (patch) | |
tree | 95812449c76a39877f2f6c4482487ea739f05f83 /audio | |
parent | 76d1b430b0a8c846676dfd36852844134bafaff0 (diff) | |
download | mpv-0ffaf653a21d0c767abfcf1094f9e57a6c9b5ba4.tar.bz2 mpv-0ffaf653a21d0c767abfcf1094f9e57a6c9b5ba4.tar.xz |
af_lavrresample: make planarization pass work with >8 channels
av_get_default_channel_layout() fails with channel counts larger than 8.
The channel layout doesn't need to make sense, so pick an arbitrary
fallback.
libswresample also has options for setting the channel counts directly,
but better not introduce new concepts in the code. Also, libavresample
doesn't have these options.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/filter/af_lavrresample.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c index 11af645910..721bb30165 100644 --- a/audio/filter/af_lavrresample.c +++ b/audio/filter/af_lavrresample.c @@ -309,14 +309,15 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in, av_opt_set_int(s->avrctx, "in_sample_fmt", in_samplefmt, 0); av_opt_set_int(s->avrctx, "out_sample_fmt", out_samplefmtp, 0); - // Just needs the correct number of channels. - int fake_out_ch_layout = av_get_default_channel_layout(map_out.num); + // Just needs the correct number of channels for deplanarization. + struct mp_chmap fake_chmap; + mp_chmap_set_unknown(&fake_chmap, map_out.num); + uint64_t fake_out_ch_layout = mp_chmap_to_lavc_unchecked(&fake_chmap); if (!fake_out_ch_layout) goto error; - - // Deplanarize if needed. av_opt_set_int(s->avrctx_out, "in_channel_layout", fake_out_ch_layout, 0); av_opt_set_int(s->avrctx_out, "out_channel_layout", fake_out_ch_layout, 0); + av_opt_set_int(s->avrctx_out, "in_sample_fmt", out_samplefmtp, 0); av_opt_set_int(s->avrctx_out, "out_sample_fmt", out_samplefmt, 0); av_opt_set_int(s->avrctx_out, "in_sample_rate", s->out_rate, 0); |