Mercurial > libavcodec.hg
comparison aac.c @ 9948:98fd723f72e7 libavcodec
Ignore subsequent channel configurations after the first in an AAC file. The
current code doesn't handle them properly, and they are a dubious construction
at best.
author | alexc |
---|---|
date | Fri, 10 Jul 2009 21:53:04 +0000 |
parents | 7ad7d4094d1f |
children | 6de3e34de218 |
comparison
equal
deleted
inserted
replaced
9947:1a345787ba68 | 9948:98fd723f72e7 |
---|---|
197 ac->tags_mapped = 4*MAX_ELEM_ID; | 197 ac->tags_mapped = 4*MAX_ELEM_ID; |
198 } | 198 } |
199 | 199 |
200 avctx->channels = channels; | 200 avctx->channels = channels; |
201 | 201 |
202 ac->output_configured = 1; | |
203 | |
202 return 0; | 204 return 0; |
203 } | 205 } |
204 | 206 |
205 /** | 207 /** |
206 * Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit. | 208 * Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit. |
443 if (avccontext->extradata_size > 0) { | 445 if (avccontext->extradata_size > 0) { |
444 if(decode_audio_specific_config(ac, avccontext->extradata, avccontext->extradata_size)) | 446 if(decode_audio_specific_config(ac, avccontext->extradata, avccontext->extradata_size)) |
445 return -1; | 447 return -1; |
446 avccontext->sample_rate = ac->m4ac.sample_rate; | 448 avccontext->sample_rate = ac->m4ac.sample_rate; |
447 } else if (avccontext->channels > 0) { | 449 } else if (avccontext->channels > 0) { |
448 enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; | |
449 memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); | |
450 if(set_default_channel_config(ac, new_che_pos, avccontext->channels - (avccontext->channels == 8))) | |
451 return -1; | |
452 if(output_configure(ac, ac->che_pos, new_che_pos, 1)) | |
453 return -1; | |
454 ac->m4ac.sample_rate = avccontext->sample_rate; | 450 ac->m4ac.sample_rate = avccontext->sample_rate; |
455 } | 451 } |
456 | 452 |
457 avccontext->sample_fmt = SAMPLE_FMT_S16; | 453 avccontext->sample_fmt = SAMPLE_FMT_S16; |
458 avccontext->frame_size = 1024; | 454 avccontext->frame_size = 1024; |
1577 int size; | 1573 int size; |
1578 AACADTSHeaderInfo hdr_info; | 1574 AACADTSHeaderInfo hdr_info; |
1579 | 1575 |
1580 size = ff_aac_parse_header(gb, &hdr_info); | 1576 size = ff_aac_parse_header(gb, &hdr_info); |
1581 if (size > 0) { | 1577 if (size > 0) { |
1582 if (hdr_info.chan_config) | 1578 if (!ac->output_configured && hdr_info.chan_config) { |
1579 enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; | |
1580 memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); | |
1583 ac->m4ac.chan_config = hdr_info.chan_config; | 1581 ac->m4ac.chan_config = hdr_info.chan_config; |
1582 if (set_default_channel_config(ac, new_che_pos, hdr_info.chan_config)) | |
1583 return -7; | |
1584 if (output_configure(ac, ac->che_pos, new_che_pos, 1)) | |
1585 return -7; | |
1586 } | |
1584 ac->m4ac.sample_rate = hdr_info.sample_rate; | 1587 ac->m4ac.sample_rate = hdr_info.sample_rate; |
1585 ac->m4ac.sampling_index = hdr_info.sampling_index; | 1588 ac->m4ac.sampling_index = hdr_info.sampling_index; |
1586 ac->m4ac.object_type = hdr_info.object_type; | 1589 ac->m4ac.object_type = hdr_info.object_type; |
1587 if (hdr_info.num_aac_frames == 1) { | 1590 if (hdr_info.num_aac_frames == 1) { |
1588 if (!hdr_info.crc_absent) | 1591 if (!hdr_info.crc_absent) |
1653 { | 1656 { |
1654 enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; | 1657 enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; |
1655 memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); | 1658 memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); |
1656 if((err = decode_pce(ac, new_che_pos, &gb))) | 1659 if((err = decode_pce(ac, new_che_pos, &gb))) |
1657 break; | 1660 break; |
1661 if (ac->output_configured) | |
1662 av_log(avccontext, AV_LOG_ERROR, | |
1663 "Not evaluating a further program_config_element as this construct is dubious at best.\n"); | |
1664 else | |
1658 err = output_configure(ac, ac->che_pos, new_che_pos, 0); | 1665 err = output_configure(ac, ac->che_pos, new_che_pos, 0); |
1659 break; | 1666 break; |
1660 } | 1667 } |
1661 | 1668 |
1662 case TYPE_FIL: | 1669 case TYPE_FIL: |