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 | |
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')
-rw-r--r-- | libavutil/audioconvert.c | 15 | ||||
-rw-r--r-- | libavutil/audioconvert.h | 5 | ||||
-rw-r--r-- | libavutil/avutil.h | 2 |
3 files changed, 21 insertions, 1 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; + } +} diff --git a/libavutil/audioconvert.h b/libavutil/audioconvert.h index 55d79fc97e..2b0c9cdea9 100644 --- a/libavutil/audioconvert.h +++ b/libavutil/audioconvert.h @@ -125,6 +125,11 @@ void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint int av_get_channel_layout_nb_channels(uint64_t channel_layout); /** + * Return default channel layout for a given number of channels. + */ +uint64_t av_get_default_channel_layout(int nb_channels); + +/** * @} */ diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 21fc737114..6ab4840ede 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -152,7 +152,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 51 -#define LIBAVUTIL_VERSION_MINOR 25 +#define LIBAVUTIL_VERSION_MINOR 26 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |