[FFmpeg-cvslog] swr/auto_matrix: treat a single channel as mono instead of failing

Michael Niedermayer git at videolan.org
Sat Sep 8 21:35:48 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Sep  8 21:18:47 2012 +0200| [0e78e575ed47eb8e405cf81e3f487b56af7ce90a] | committer: Michael Niedermayer

swr/auto_matrix: treat a single channel as mono instead of failing

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e78e575ed47eb8e405cf81e3f487b56af7ce90a
---

 libswresample/rematrix.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index c4c218d..1117f23 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;
 }
 



More information about the ffmpeg-cvslog mailing list