summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-07-30 00:33:38 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-07-30 11:37:40 +0200
commit33449b1776169f18c96f485e37ab6ae42769621b (patch)
tree40b9ceb13bf64b2e2e19e42f68b581e2da683027 /libavutil
parentcc554704722c4fdcad5e6b3f1451721a8f17607e (diff)
audioconvert: add av_get_channel_description().
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/audioconvert.c11
-rw-r--r--libavutil/audioconvert.h8
2 files changed, 19 insertions, 0 deletions
diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c
index 8e65d5968a..224db86b04 100644
--- a/libavutil/audioconvert.c
+++ b/libavutil/audioconvert.c
@@ -219,6 +219,17 @@ const char *av_get_channel_name(uint64_t channel)
return NULL;
}
+const char *av_get_channel_description(uint64_t channel)
+{
+ int i;
+ if (av_get_channel_layout_nb_channels(channel) != 1)
+ return NULL;
+ for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
+ if ((1ULL<<i) & channel)
+ return channel_names[i].description;
+ return NULL;
+}
+
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
{
int i;
diff --git a/libavutil/audioconvert.h b/libavutil/audioconvert.h
index 25e9cf025e..f1399b964c 100644
--- a/libavutil/audioconvert.h
+++ b/libavutil/audioconvert.h
@@ -181,6 +181,14 @@ uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
const char *av_get_channel_name(uint64_t channel);
/**
+ * Get the description of a given channel.
+ *
+ * @param channel a channel layout with a single channel
+ * @return channel description on success, NULL on error
+ */
+const char *av_get_channel_description(uint64_t channel);
+
+/**
* @}
*/