audioconvert: add av_get_standard_channel_layout().
[ffmpeg.git] / libavutil / audioconvert.c
index 224db86..0164171 100644 (file)
@@ -243,3 +243,13 @@ uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
     }
     return 0;
 }
+
+int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
+                                   const char **name)
+{
+    if (index >= FF_ARRAY_ELEMS(channel_layout_map))
+        return AVERROR_EOF;
+    if (layout) *layout = channel_layout_map[index].layout;
+    if (name)   *name   = channel_layout_map[index].name;
+    return 0;
+}