aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libfaac.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2012-01-25 02:51:49 +0100
committerAlex Converse <alex.converse@gmail.com>2012-04-16 14:09:52 -0700
commitaf2f655c02c69aa615eb2a06000a1aa35916967a (patch)
treec623a3df02cbe5f3f6c821458ba0fbfdf01f0ad0 /libavcodec/libfaac.c
parentca332b1d8c9d869c4dd98a6eae5e464d702948cc (diff)
downloadffmpeg-af2f655c02c69aa615eb2a06000a1aa35916967a.tar.gz
faac: Fix multi-channel ordering
Signed-off-by: Alex Converse <alex.converse@gmail.com>
Diffstat (limited to 'libavcodec/libfaac.c')
-rw-r--r--libavcodec/libfaac.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c
index 66277949b0..e18e133bc7 100644
--- a/libavcodec/libfaac.c
+++ b/libavcodec/libfaac.c
@@ -57,6 +57,13 @@ static av_cold int Faac_encode_close(AVCodecContext *avctx)
return 0;
}
+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;
@@ -119,6 +126,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;