summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-04 13:44:01 +0100
committerwm4 <wm4@nowhere>2015-11-04 21:48:37 +0100
commit5a18c5ea91436c839a72637ffc016781b2337e35 (patch)
tree0b7e54d41dc2d22c84c8d58b9657e8ddd8831511
parenta9833a71ce335e7f1b93f3f29f1c2044700a2586 (diff)
downloadmpv-5a18c5ea91436c839a72637ffc016781b2337e35.tar.bz2
mpv-5a18c5ea91436c839a72637ffc016781b2337e35.tar.xz
Revert "af_lavrresample: don't drop sl/sr channels for 7.1 on ALSA"
This reverts commit 4e358a963604af8746a059d7388cb202be0f919d. Testing shows the channel pairs must indeed be swapped (details see commit message of the reverted commit). Making the downmix code move sl/sr to sdl/sdr is not an appropriate solution anymore, and it's better to fix the unusual channel layout in ao_alsa.c directly. (Not reverting the change in chmap.c; this is still correct.)
-rw-r--r--audio/filter/af_lavrresample.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c
index 6cdefe56c6..721bb30165 100644
--- a/audio/filter/af_lavrresample.c
+++ b/audio/filter/af_lavrresample.c
@@ -197,24 +197,6 @@ static void transpose_order(int *map, int num)
memcpy(map, nmap, sizeof(nmap));
}
-static uint64_t fudge_output_channel_layout(uint64_t in, uint64_t out)
-{
- // If it tries to convert SR/SL to SDR/SLD, keep it SR/SL.
- // This effectively makes it not rematrix at all when outputting
- // 7.1 on ALSA. It could also be considered messing with FFmpeg's
- // matrix generation.
- uint64_t sp[][2] = {
- {AV_CH_SIDE_LEFT, AV_CH_SURROUND_DIRECT_LEFT},
- {AV_CH_SIDE_RIGHT, AV_CH_SURROUND_DIRECT_RIGHT},
- };
- for (int n = 0; n < MP_ARRAY_SIZE(sp); n++) {
- if ((in & sp[n][0]) && !(out & sp[n][0]) &&
- !(in & sp[n][1]) && (out & sp[n][1]))
- out = (out & ~sp[n][1]) | sp[n][0];
- }
- return out;
-}
-
static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
struct mp_audio *out, bool verbose)
{
@@ -278,6 +260,11 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
mp_chmap_from_lavc(&in_lavc, in_ch_layout);
mp_chmap_from_lavc(&out_lavc, out_ch_layout);
+ if (verbose && !mp_chmap_equals(&in_lavc, &out_lavc)) {
+ MP_VERBOSE(af, "Remix: %s -> %s\n", mp_chmap_to_str(&in_lavc),
+ mp_chmap_to_str(&out_lavc));
+ }
+
if (in_lavc.num != map_in.num) {
// For handling NA channels, we would have to add a planarization step.
MP_FATAL(af, "Unsupported channel remapping.\n");
@@ -314,16 +301,6 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
if (map_out.num > out_lavc.num)
mp_audio_set_channels(&s->pool_fmt, &map_out);
- out_ch_layout = fudge_output_channel_layout(in_ch_layout, out_ch_layout);
-
- struct mp_chmap out_lavc_actual;
- mp_chmap_from_lavc(&out_lavc_actual, out_ch_layout);
-
- if (verbose && !mp_chmap_equals(&in_lavc, &out_lavc)) {
- MP_VERBOSE(af, "Remix: %s -> %s\n", mp_chmap_to_str(&in_lavc),
- mp_chmap_to_str(&out_lavc_actual));
- }
-
// Real conversion; output is input to avrctx_out.
av_opt_set_int(s->avrctx, "in_channel_layout", in_ch_layout, 0);
av_opt_set_int(s->avrctx, "out_channel_layout", out_ch_layout, 0);