]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/audioconvert.c
Make sure the EC code does not attempt to use inter based concealment if there
[ffmpeg] / libavcodec / audioconvert.c
index 40a79000fb4db3e0facef5390aa3eb491bbdb6f6..8410d29489dd03d66adab27abd72dda5c17e4b30 100644 (file)
@@ -79,7 +79,7 @@ static const char* const channel_names[]={
     [30] = "DR",
 };
 
-const char *get_channel_name(int channel_id)
+static const char *get_channel_name(int channel_id)
 {
     if (channel_id<0 || channel_id>=FF_ARRAY_ELEMS(channel_names))
         return NULL;
@@ -107,10 +107,12 @@ static const struct {
 } channel_layout_map[] = {
     { "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 },
@@ -122,13 +124,10 @@ void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels,
 {
     int i;
 
-    if (channel_layout==0)
-        channel_layout = avcodec_guess_channel_layout(nb_channels, CODEC_ID_NONE, NULL);
-
     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 +149,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;