[FFmpeg-cvslog] audioconvert: add av_get_default_channel_layout public function

Marton Balint git at videolan.org
Mon Oct 3 00:38:42 CEST 2011


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sun Oct  2 16:28:36 2011 +0200| [60aaf044f3fdbeb1cf702b144cb0597ce4988020] | committer: Marton Balint

audioconvert: add av_get_default_channel_layout public function

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

 libavutil/audioconvert.c |    8 ++++++++
 libavutil/audioconvert.h |    5 +++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c
index 524f6f9..4a87942 100644
--- a/libavutil/audioconvert.c
+++ b/libavutil/audioconvert.c
@@ -131,3 +131,11 @@ int av_get_channel_layout_nb_channels(int64_t channel_layout)
         x &= x-1; // unset lowest set bit
     return count;
 }
+
+int av_get_default_channel_layout(int nb_channels) {
+    int i;
+    for (i = 0; channel_layout_map[i].name; i++)
+        if (nb_channels == channel_layout_map[i].nb_channels)
+            return channel_layout_map[i].layout;
+    return 0;
+}
diff --git a/libavutil/audioconvert.h b/libavutil/audioconvert.h
index 134c610..03965cc 100644
--- a/libavutil/audioconvert.h
+++ b/libavutil/audioconvert.h
@@ -92,4 +92,9 @@ void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int6
  */
 int av_get_channel_layout_nb_channels(int64_t channel_layout);
 
+/**
+ * Return default channel layout for a given number of channels.
+ */
+int av_get_default_channel_layout(int nb_channels);
+
 #endif /* AVUTIL_AUDIOCONVERT_H */



More information about the ffmpeg-cvslog mailing list