aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-20 16:56:51 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-08-20 18:42:44 +0200
commitc55a09a8b65f88d748daa885b4829019a081040c (patch)
treebbbdb815c8d02e0b1cd0383a092a6af2d9d094fb
parenta94404457b0b22e0473c8a4e00d107af92f0e12e (diff)
downloadffmpeg-c55a09a8b65f88d748daa885b4829019a081040c.tar.gz
swr/rematrix: Fix handling of AV_CH_LAYOUT_STEREO_DOWNMIX output
Fixes Ticket2859 Note, testcases related to the downmix channels are welcome. (id like to make sure this is working correctly now, as obviously it didnt work before ...) Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit c56d4dab039b352961cca298d753b04e2f2fd990)
-rw-r--r--libswresample/rematrix.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index cfe0a1b592..541f46a782 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -78,9 +78,6 @@ static int even(int64_t layout){
}
static int clean_layout(SwrContext *s, int64_t layout){
- if((layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == AV_CH_LAYOUT_STEREO_DOWNMIX)
- return AV_CH_LAYOUT_STEREO;
-
if(layout && layout != AV_CH_FRONT_CENTER && !(layout&(layout-1))) {
char buf[128];
av_get_channel_layout_string(buf, sizeof(buf), -1, layout);
@@ -120,6 +117,11 @@ av_cold static int auto_matrix(SwrContext *s)
in_ch_layout = clean_layout(s, s->in_ch_layout);
out_ch_layout = clean_layout(s, s->out_ch_layout);
+ if( out_ch_layout == AV_CH_LAYOUT_STEREO_DOWNMIX
+ && (in_ch_layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == 0
+ )
+ out_ch_layout = AV_CH_LAYOUT_STEREO;
+
if(!sane_layout(in_ch_layout)){
av_get_channel_layout_string(buf, sizeof(buf), -1, s->in_ch_layout);
av_log(s, AV_LOG_ERROR, "Input channel layout '%s' is not supported\n", buf);