diff audioconvert.c @ 9511:c2dba7ed94dc libavcodec

Check that channel layout is compatible with number of channels for output audio stream.
author jbr
date Sun, 19 Apr 2009 14:05:55 +0000
parents 56f844aec27b
children 63dbab428e01
line wrap: on
line diff
--- a/audioconvert.c	Sun Apr 19 00:55:46 2009 +0000
+++ b/audioconvert.c	Sun Apr 19 14:05:55 2009 +0000
@@ -153,6 +153,15 @@
     }
 }
 
+int avcodec_channel_layout_num_channels(int64_t channel_layout)
+{
+    int count;
+    uint64_t x = channel_layout;
+    for (count = 0; x; count++)
+        x &= x-1; // unset lowest set bit
+    return count;
+}
+
 struct AVAudioConvert {
     int in_channels, out_channels;
     int fmt_pair;