diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-05-28 08:39:10 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-06-10 08:03:11 +0200 |
commit | 5df320e167dc5b5a6fa46e2d1d59f51263dea181 (patch) | |
tree | 3b47c463e63294b0cd3cbb9ee48c194eb97e55e9 /libavutil/audioconvert.c | |
parent | 406b257de936b59f1fc943e399fbf1289fec6b95 (diff) | |
download | ffmpeg-5df320e167dc5b5a6fa46e2d1d59f51263dea181.tar.gz |
audioconvert: add a function for getting the name of a single channel.
Diffstat (limited to 'libavutil/audioconvert.c')
-rw-r--r-- | libavutil/audioconvert.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c index 9e2f812d7c..36d07ee5a4 100644 --- a/libavutil/audioconvert.c +++ b/libavutil/audioconvert.c @@ -202,3 +202,14 @@ int av_get_channel_layout_channel_index(uint64_t channel_layout, channel_layout &= channel - 1; return av_get_channel_layout_nb_channels(channel_layout); } + +const char *av_get_channel_name(uint64_t channel) +{ + int i; + if (av_get_channel_layout_nb_channels(channel) != 1) + return NULL; + for (i = 0; i < 64; i++) + if ((1ULL<<i) & channel) + return get_channel_name(i); + return NULL; +} |