summaryrefslogtreecommitdiff
path: root/libswresample/rematrix.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-09-08 21:18:47 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-09-08 21:32:24 +0200
commit0e78e575ed47eb8e405cf81e3f487b56af7ce90a (patch)
tree66ce356cac7ffc16904653db71cde09f35f1fb21 /libswresample/rematrix.c
parentf8d74cbdc39726965723ff81ccb10a841d5ab8a4 (diff)
swr/auto_matrix: treat a single channel as mono instead of failing
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/rematrix.c')
-rw-r--r--libswresample/rematrix.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index c4c218de54..1117f235cc 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -106,6 +106,13 @@ 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);
+ av_log(s, AV_LOG_VERBOSE, "Treating %s as mono\n", buf);
+ return AV_CH_FRONT_CENTER;
+ }
+
return layout;
}