aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libfaac.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2012-01-25 03:51:49 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2012-01-25 03:51:49 +0100
commit7988dd1b9a1a5013a77d90cb7105c8a83d836756 (patch)
tree4acffb54c4e0155c59ad05bd6c8a027c7eb39c22 /libavcodec/libfaac.c
parent749e5dc1fdae72dda8067b839a897b9708021429 (diff)
downloadffmpeg-7988dd1b9a1a5013a77d90cb7105c8a83d836756.tar.gz
Fix multi-channel encoding with libfaac.
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 4758cf7462..31dc1a41ed 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;