summaryrefslogtreecommitdiff
path: root/libavcodec/aacdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-19 00:53:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-19 00:53:42 +0200
commitba57ef29723e11e94f2d5a07d4f384e636316c16 (patch)
tree469c52643fe98b6efe791d6caaecfb707ef2bd8f /libavcodec/aacdec.c
parent8ea6157d83277a089137fb8113174bc4e7a8ffd2 (diff)
parentbb337b4fbceb6af7f70ef2f9476733cc2fa5350b (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: avconv: Fix spelling errors. aac: Only set sample rate and object type from ADTS if output hasn't been configured. aac: Set SBR and PS to unsignalled during headerless and ADTS initialization. aac: Only output configure if audio was found. avconv: save two levels of indentation in flush_encoders() avconv: factor flushing encoders out of output_packet(). avconv: factor out initializing input streams. avconv: remove -intra option. avconv: reset streamid_map between output files. avconv: make timer_start a local var in transcode(). avconv: cosmetics, move OutputStream. avconv: remove two unused macros. Conflicts: avconv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacdec.c')
-rw-r--r--libavcodec/aacdec.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 944be9fad3..161e9c6e3f 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -581,6 +581,8 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
sr = sample_rate_idx(avctx->sample_rate);
ac->m4ac.sampling_index = sr;
ac->m4ac.channels = avctx->channels;
+ ac->m4ac.sbr = -1;
+ ac->m4ac.ps = -1;
for (i = 0; i < FF_ARRAY_ELEMS(ff_mpeg4audio_channels); i++)
if (ff_mpeg4audio_channels[i] == avctx->channels)
@@ -2092,10 +2094,10 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
if (ac->output_configured != OC_LOCKED) {
ac->m4ac.sbr = -1;
ac->m4ac.ps = -1;
+ ac->m4ac.sample_rate = hdr_info.sample_rate;
+ ac->m4ac.sampling_index = hdr_info.sampling_index;
+ ac->m4ac.object_type = hdr_info.object_type;
}
- ac->m4ac.sample_rate = hdr_info.sample_rate;
- ac->m4ac.sampling_index = hdr_info.sampling_index;
- ac->m4ac.object_type = hdr_info.object_type;
if (!ac->avctx->sample_rate)
ac->avctx->sample_rate = hdr_info.sample_rate;
if (hdr_info.num_aac_frames == 1) {
@@ -2116,7 +2118,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
ChannelElement *che = NULL, *che_prev = NULL;
enum RawDataBlockType elem_type, elem_type_prev = TYPE_END;
int err, elem_id, data_size_tmp;
- int samples = 0, multiplier;
+ int samples = 0, multiplier, audio_found = 0;
if (show_bits(gb, 12) == 0xfff) {
if (parse_adts_frame_header(ac, gb) < 0) {
@@ -2147,10 +2149,12 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
case TYPE_SCE:
err = decode_ics(ac, &che->ch[0], gb, 0, 0);
+ audio_found = 1;
break;
case TYPE_CPE:
err = decode_cpe(ac, gb, che);
+ audio_found = 1;
break;
case TYPE_CCE:
@@ -2159,6 +2163,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
case TYPE_LFE:
err = decode_ics(ac, &che->ch[0], gb, 0, 0);
+ audio_found = 1;
break;
case TYPE_DSE:
@@ -2235,7 +2240,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
samples, avctx->channels);
}
- if (ac->output_configured)
+ if (ac->output_configured && audio_found)
ac->output_configured = OC_LOCKED;
return 0;