comparison aac.c @ 9634:61c62ab2218f libavcodec

Allow parsing and decoding of ADTS AAC files with channel config = 0
author alexc
date Wed, 13 May 2009 17:57:58 +0000
parents c8dc8037a18b
children 67a20f0eb42c
comparison
equal deleted inserted replaced
9633:9592af8b6ce0 9634:61c62ab2218f
160 static int output_configure(AACContext *ac, enum ChannelPosition che_pos[4][MAX_ELEM_ID], 160 static int output_configure(AACContext *ac, enum ChannelPosition che_pos[4][MAX_ELEM_ID],
161 enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], int channel_config) { 161 enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], int channel_config) {
162 AVCodecContext *avctx = ac->avccontext; 162 AVCodecContext *avctx = ac->avccontext;
163 int i, type, channels = 0; 163 int i, type, channels = 0;
164 164
165 if(!memcmp(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])))
166 return 0; /* no change */
167
168 memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); 165 memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
169 166
170 /* Allocate or free elements depending on if they are in the 167 /* Allocate or free elements depending on if they are in the
171 * current program configuration. 168 * current program configuration.
172 * 169 *
456 if(set_default_channel_config(ac, new_che_pos, avccontext->channels - (avccontext->channels == 8))) 453 if(set_default_channel_config(ac, new_che_pos, avccontext->channels - (avccontext->channels == 8)))
457 return -1; 454 return -1;
458 if(output_configure(ac, ac->che_pos, new_che_pos, 1)) 455 if(output_configure(ac, ac->che_pos, new_che_pos, 1))
459 return -1; 456 return -1;
460 ac->m4ac.sample_rate = avccontext->sample_rate; 457 ac->m4ac.sample_rate = avccontext->sample_rate;
461 } else {
462 ff_log_missing_feature(ac->avccontext, "Implicit channel configuration is", 0);
463 return -1;
464 } 458 }
465 459
466 avccontext->sample_fmt = SAMPLE_FMT_S16; 460 avccontext->sample_fmt = SAMPLE_FMT_S16;
467 avccontext->frame_size = 1024; 461 avccontext->frame_size = 1024;
468 462