diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-03-21 20:36:51 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-04-05 16:35:14 -0400 |
commit | 5cc51a5847ca9f333672370b1aa98e2d9f9518aa (patch) | |
tree | 087b26fb3aa8230682fef7fc408ba08d3359e3b4 /libavutil/audioconvert.c | |
parent | 0becb07842b57ea225ddf0726de33b5f8e669297 (diff) | |
download | ffmpeg-5cc51a5847ca9f333672370b1aa98e2d9f9518aa.tar.gz |
avutil: Add av_get_default_channel_layout()
Also, use the new function in the AC-3 encoder.
Diffstat (limited to 'libavutil/audioconvert.c')
-rw-r--r-- | libavutil/audioconvert.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c index 0a83b05ad9..85c20e2868 100644 --- a/libavutil/audioconvert.c +++ b/libavutil/audioconvert.c @@ -153,3 +153,18 @@ int av_get_channel_layout_nb_channels(uint64_t channel_layout) x &= x-1; // unset lowest set bit return count; } + +uint64_t av_get_default_channel_layout(int nb_channels) +{ + switch(nb_channels) { + case 1: return AV_CH_LAYOUT_MONO; + case 2: return AV_CH_LAYOUT_STEREO; + case 3: return AV_CH_LAYOUT_SURROUND; + case 4: return AV_CH_LAYOUT_QUAD; + case 5: return AV_CH_LAYOUT_5POINT0; + case 6: return AV_CH_LAYOUT_5POINT1; + case 7: return AV_CH_LAYOUT_6POINT1; + case 8: return AV_CH_LAYOUT_7POINT1; + default: return 0; + } +} |