1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 21:06:00 +00:00
mpv/audio/filter
wm4 4e358a9636 af_lavrresample: don't drop sl/sr channels for 7.1 on ALSA
ao_alsa: attempt to fix 7.1 over HDMI

The last 2 channels of 7.1 (RLC/RRC in ALSA) were exported as sdl/sdr
instead of sl/sr (I don't even know why I chose sdl/sdr, but SL/SR
and RLC/RRC are different in the ALSA API). libsw/avresample do not
move the sl/sr channels to sdl/sdr when rematrixing, so silence was
sent for 2 channels. If my selection of sdl/sdr is essentially API
abuse, there's no reason why they should do this differently.

The mess here is really that ALSa doesn't map the HDMI layouts cleanly.
Most ALSA drivers export 7.1 in a way compatible to our expectations,
but Intel HDA/HDMI does not:

mpv/ffmpeg:   fl-fr-fc-lfe-bl-br-sl-sr
ALSA/generic: FL FR FC LFE RL RR SL  SR  [1]
ALSA/HDMI:    FL FR LFE FC RL RR RLC RRC [2]

The HDMI layout is layout 0x13 (going by CEA-861-B). The comment in
the kernel code has to be correct too. The early standard defines only
1 other layout, which replaces RLC/RRC with FRC/FLC - this probably
corresponds to what we call "7.1(wide)".

So it appears when ALSA requests RLC/RRC, we should feed it sl/sr.

To make it more complicated, Kodi/xbmc apparently also have to deal with
ALSA being special, but instead of sending sl/sr to RLC/RRC, they swap
the last two pairs of the layout, and send sl/sr to RL/RR and bl/br to
RLC/RRC. Or I might have misunderstood their code. I don't have a
7.1-capable A/V receiver, so I can't test this.

For now, go with the simpler solution, and wait until someone tests it.
If the speakers end up swapped, a completely different solution will be
needed.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/sound/core/pcm_lib.c?id=refs/tags/v4.3#n2434
[2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/sound/pci/hda/patch_hdmi.c?id=refs/tags/v4.3#n307
2015-11-03 00:28:00 +01:00
..
af_channels.c Update license headers 2015-04-13 12:10:01 +02:00
af_delay.c Update license headers 2015-04-13 12:10:01 +02:00
af_drc.c audio/filter: remove reentrancy flag 2015-09-20 14:44:44 +02:00
af_equalizer.c audio/filter: remove reentrancy flag 2015-09-20 14:44:44 +02:00
af_format.c audio/filters: use refcounted frames for some simple filters 2015-01-13 20:16:59 +01:00
af_lavcac3enc.c Replace deprecated av_free_packet() calls 2015-10-28 23:48:56 +01:00
af_lavfi.c audio: use AVFrames with more than 8 channels correctly 2015-10-26 15:54:00 +01:00
af_lavrresample.c af_lavrresample: don't drop sl/sr channels for 7.1 on ALSA 2015-11-03 00:28:00 +01:00
af_pan.c Update license headers 2015-04-13 12:10:01 +02:00
af_rubberband.c af_rubberband: actually fix deadlock 2015-02-12 10:15:12 +01:00
af_scaletempo.c Update license headers 2015-04-13 12:10:01 +02:00
af_volume.c audio/filter: remove reentrancy flag 2015-09-20 14:44:44 +02:00
af.c af: prevent endless loop when removing filters due to spdif 2015-10-26 15:51:26 +01:00
af.h audio/filter: remove reentrancy flag 2015-09-20 14:44:44 +02:00
equalizer.h Update license headers 2015-04-13 12:10:01 +02:00
tools.c af: move af_from_dB() function to af_volume.c 2015-06-23 15:11:23 +02:00