]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavcodec/audioconvert.c
frsh: Export information about the last RTP contract and VRES
[frescor/ffmpeg.git] / libavcodec / audioconvert.c
index 40a79000fb4db3e0facef5390aa3eb491bbdb6f6..5842801093afceec1515b8c1786965607428e616 100644 (file)
@@ -108,9 +108,12 @@ static const struct {
     { "mono",        1,  CH_LAYOUT_MONO },
     { "stereo",      2,  CH_LAYOUT_STEREO },
     { "surround",    3,  CH_LAYOUT_SURROUND },
+    { "4.0",         4,  CH_LAYOUT_4POINT0 },
     { "quad",        4,  CH_LAYOUT_QUAD },
     { "5.0",         5,  CH_LAYOUT_5POINT0 },
+    { "5.0",         5,  CH_LAYOUT_5POINT0_BACK },
     { "5.1",         6,  CH_LAYOUT_5POINT1 },
+    { "5.1",         6,  CH_LAYOUT_5POINT1_BACK },
     { "5.1+downmix", 8,  CH_LAYOUT_5POINT1|CH_LAYOUT_STEREO_DOWNMIX, },
     { "7.1",         8,  CH_LAYOUT_7POINT1 },
     { "7.1(wide)",   8,  CH_LAYOUT_7POINT1_WIDE },
@@ -128,7 +131,7 @@ void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels,
     for (i=0; channel_layout_map[i].name; i++)
         if (nb_channels    == channel_layout_map[i].nb_channels &&
             channel_layout == channel_layout_map[i].layout) {
-            snprintf(buf, buf_size, channel_layout_map[i].name);
+            av_strlcpy(buf, channel_layout_map[i].name, buf_size);
             return;
         }
 
@@ -150,6 +153,15 @@ void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels,
     }
 }
 
+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;