diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-05-28 08:16:40 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-06-10 08:02:18 +0200 |
commit | 406b257de936b59f1fc943e399fbf1289fec6b95 (patch) | |
tree | 7bbacf18560a6a1308e3f90fdc8e4409d00545ed /libavutil/audioconvert.c | |
parent | 3596de55fc054b5c336e7e542c26ced0505d4f2e (diff) | |
download | ffmpeg-406b257de936b59f1fc943e399fbf1289fec6b95.tar.gz |
audioconvert: add a function for getting channel's index in layout
Diffstat (limited to 'libavutil/audioconvert.c')
-rw-r--r-- | libavutil/audioconvert.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c index 1a8e5ee239..9e2f812d7c 100644 --- a/libavutil/audioconvert.c +++ b/libavutil/audioconvert.c @@ -192,3 +192,13 @@ uint64_t av_get_default_channel_layout(int nb_channels) default: return 0; } } + +int av_get_channel_layout_channel_index(uint64_t channel_layout, + uint64_t channel) +{ + if (!(channel_layout & channel) || + av_get_channel_layout_nb_channels(channel) != 1) + return AVERROR(EINVAL); + channel_layout &= channel - 1; + return av_get_channel_layout_nb_channels(channel_layout); +} |