[FFmpeg-cvslog] r22298 - trunk/libavcodec/aac.c
alexc
subversion
Mon Mar 8 00:46:40 CET 2010
Author: alexc
Date: Mon Mar 8 00:46:40 2010
New Revision: 22298
Log:
AAC: Set codec parameters in the first frame rather than in .init()
Modified:
trunk/libavcodec/aac.c
Modified: trunk/libavcodec/aac.c
==============================================================================
--- trunk/libavcodec/aac.c Mon Mar 8 00:10:18 2010 (r22297)
+++ trunk/libavcodec/aac.c Mon Mar 8 00:46:40 2010 (r22298)
@@ -509,17 +509,14 @@ static av_cold int aac_decode_init(AVCod
int i;
ac->avccontext = avccontext;
+ ac->m4ac.sample_rate = avccontext->sample_rate;
if (avccontext->extradata_size > 0) {
if (decode_audio_specific_config(ac, avccontext->extradata, avccontext->extradata_size))
return -1;
- avccontext->sample_rate = ac->m4ac.sample_rate;
- } else if (avccontext->channels > 0) {
- ac->m4ac.sample_rate = avccontext->sample_rate;
}
avccontext->sample_fmt = SAMPLE_FMT_S16;
- avccontext->frame_size = 1024;
AAC_INIT_VLC_STATIC( 0, 304);
AAC_INIT_VLC_STATIC( 1, 270);
@@ -1950,6 +1947,7 @@ static int aac_decode_frame(AVCodecConte
enum RawDataBlockType elem_type;
int err, elem_id, data_size_tmp;
int buf_consumed;
+ int samples = 1024, multiplier;
init_get_bits(&gb, buf, buf_size * 8);
@@ -2036,6 +2034,13 @@ static int aac_decode_frame(AVCodecConte
spectral_to_sample(ac);
+ multiplier = 1;
+ samples <<= multiplier;
+ if (ac->output_configured < OC_LOCKED) {
+ avccontext->sample_rate = ac->m4ac.sample_rate << multiplier;
+ avccontext->frame_size = samples;
+ }
+
data_size_tmp = 1024 * avccontext->channels * sizeof(int16_t);
if (*data_size < data_size_tmp) {
av_log(avccontext, AV_LOG_ERROR,
More information about the ffmpeg-cvslog
mailing list