aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2011-10-02 16:28:36 +0200
committerMarton Balint <cus@passwd.hu>2011-10-02 21:21:46 +0200
commit60aaf044f3fdbeb1cf702b144cb0597ce4988020 (patch)
treecda15cfb92db32d3583656bbabd5d5873e5af3cf /libavutil
parent2446a8cc0a4d6c848f80a3c0a5917a4b4b9f3259 (diff)
downloadffmpeg-60aaf044f3fdbeb1cf702b144cb0597ce4988020.tar.gz
audioconvert: add av_get_default_channel_layout public function
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/audioconvert.c8
-rw-r--r--libavutil/audioconvert.h5
2 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c
index 524f6f9e9e..4a8794276e 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 134c6107c9..03965ccc7d 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 */