diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-07-30 00:33:38 +0200 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-07-30 11:37:40 +0200 |
commit | 33449b1776169f18c96f485e37ab6ae42769621b (patch) | |
tree | 40b9ceb13bf64b2e2e19e42f68b581e2da683027 | |
parent | cc554704722c4fdcad5e6b3f1451721a8f17607e (diff) | |
download | ffmpeg-33449b1776169f18c96f485e37ab6ae42769621b.tar.gz |
audioconvert: add av_get_channel_description().
-rw-r--r-- | libavutil/audioconvert.c | 11 | ||||
-rw-r--r-- | libavutil/audioconvert.h | 8 |
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); + +/** * @} */ |