From 41aefce730efd7da6068b7f61697c65759cd3f84 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 23 Mar 2013 17:49:52 +0100 Subject: audio: switch to libavcodec channel order, use libavresample for mixing Switch the internal channel order to libavcodec's. If the channel number mismatches at some point, use libavresample for up- or downmixing. Remove the old af_pan automatic downmixing. The libavcodec channel order should be equivalent to WAVEFORMATEX order, at least nowadays. reorder_ch.h assumes that WAVEFORMATEX and libavcodec might be different, but all defined channels have the same mappings. Remove the downmixing with af_pan as well as the channel conversion with af_channels from af.c, and prefer af_lavrresample for this. The automatic downmixing behavior should be the same as before (if the --channels option is set to 2, which is the default, the audio output is forced to 2 channels, and libavresample does all downmixing). Note that mpv still can't do channel layouts. It will pick the default channel layout according to the channel count. This will be fixed later by passing down the channel layout as well. af_hrtf depends on the order of the input channels, so reorder to ALSA (for which this code was written). This is better than changing the filter code, which is more risky. ao_pulse can accept waveext order directly, so set that as channel mapping. --- audio/reorder_ch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/reorder_ch.h') diff --git a/audio/reorder_ch.h b/audio/reorder_ch.h index 07daa35a08..a63fb0a959 100644 --- a/audio/reorder_ch.h +++ b/audio/reorder_ch.h @@ -113,7 +113,7 @@ void reorder_channel(void *buf, #define AF_CHANNEL_LAYOUT_LAVC_DEFAULT 3 #define AF_CHANNEL_LAYOUT_VORBIS_DEFAULT 4 #define AF_CHANNEL_LAYOUT_SOURCE_NUM 5 -#define AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT AF_CHANNEL_LAYOUT_ALSA_DEFAULT +#define AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT AF_CHANNEL_LAYOUT_LAVC_DEFAULT /// Optimized channel reorder between different audio sources and targets. void reorder_channel_copy_nch(void *src, -- cgit v1.2.3