diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-06-15 10:57:26 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-06-15 10:57:26 +0200 |
commit | b3452771c4550b46ea54d15be6cfe8cc10585199 (patch) | |
tree | d7ac47dc66583d521acdd68b172975a8c93915d1 /libavcodec/libfaac.c | |
parent | b1c450be49d9896ce4c96d04944f5f15e2ced028 (diff) | |
download | ffmpeg-b3452771c4550b46ea54d15be6cfe8cc10585199.tar.gz |
Fix multi-channel AAC encoding.
Fixes ticket 55.
Diffstat (limited to 'libavcodec/libfaac.c')
-rw-r--r-- | libavcodec/libfaac.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index af85587272..2acc682581 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -31,6 +31,13 @@ typedef struct FaacAudioContext { faacEncHandle faac_handle; } FaacAudioContext; +static const int channel_maps[][6] = { + { 2, 0, 1 }, //< C L R + { 2, 0, 1, 3 }, //< C L R Cs + { 2, 0, 1, 3, 4 }, //< C L R Ls Rs + { 2, 0, 1, 4, 5, 3 }, //< C L R Ls Rs LFE +}; + static av_cold int Faac_encode_init(AVCodecContext *avctx) { FaacAudioContext *s = avctx->priv_data; @@ -86,6 +93,9 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx) } faac_cfg->outputFormat = 1; faac_cfg->inputFormat = FAAC_INPUT_16BIT; + if (avctx->channels > 2) + memcpy(faac_cfg->channel_map, channel_maps[avctx->channels-3], + avctx->channels * sizeof(int)); avctx->frame_size = samples_input / avctx->channels; |