aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/aacenc.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-10-12 15:53:17 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2015-10-12 15:53:17 +0100
commitb3deaece87b5b0216382e6d700854edb8d3727fb (patch)
treed53fc3af47abb1b9dc4a38535cfced1236ab8e8b /libavcodec/aacenc.c
parente679a1e65f5254fcef702708797152b025350e91 (diff)
downloadffmpeg-b3deaece87b5b0216382e6d700854edb8d3727fb.tar.gz
aacenc: add support for encoding 7.1 channel audio
This commit implements support for 7.1 channel audio. There's no more predefined bitstream channel mappings so going beyond 8 channels (and 7 channels exactly) will require programmable channel elements, which is already underway.
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r--libavcodec/aacenc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 9e96cbcfa1..8041127009 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -54,11 +54,12 @@ static void put_audio_specific_config(AVCodecContext *avctx)
{
PutBitContext pb;
AACEncContext *s = avctx->priv_data;
+ int channels = s->channels - (s->channels == 8 ? 1 : 0);
init_put_bits(&pb, avctx->extradata, avctx->extradata_size);
put_bits(&pb, 5, s->profile+1); //profile
put_bits(&pb, 4, s->samplerate_index); //sample rate index
- put_bits(&pb, 4, s->channels);
+ put_bits(&pb, 4, channels);
//GASpecificConfig
put_bits(&pb, 1, 0); //frame length - 1024 samples
put_bits(&pb, 1, 0); //does not depend on core coder
@@ -866,7 +867,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
ERROR_IF(i == 16 || i >= ff_aac_swb_size_1024_len || i >= ff_aac_swb_size_128_len,
"Unsupported sample rate %d\n", avctx->sample_rate);
- ERROR_IF(s->channels > AAC_MAX_CHANNELS,
+ ERROR_IF(s->channels > AAC_MAX_CHANNELS || s->channels == 7,
"Unsupported number of channels: %d\n", s->channels);
WARN_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels,
"Too many bits per frame requested, clamping to max\n");