|
|
|
@ -30,7 +30,7 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1, |
|
|
|
|
{ |
|
|
|
|
AACAC3ParseContext *s = s1->priv_data; |
|
|
|
|
const uint8_t *buf_ptr; |
|
|
|
|
int len, sample_rate, bit_rate, channels, samples; |
|
|
|
|
int len; |
|
|
|
|
|
|
|
|
|
*poutbuf = NULL; |
|
|
|
|
*poutbuf_size = 0; |
|
|
|
@ -50,8 +50,7 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1, |
|
|
|
|
|
|
|
|
|
if (s->frame_size == 0) { |
|
|
|
|
if ((s->inbuf_ptr - s->inbuf) == s->header_size) { |
|
|
|
|
len = s->sync(s->inbuf, &channels, &sample_rate, &bit_rate, |
|
|
|
|
&samples); |
|
|
|
|
len = s->sync(s); |
|
|
|
|
if (len == 0) { |
|
|
|
|
/* no sync found : move by one byte (inefficient, but simple!) */ |
|
|
|
|
memmove(s->inbuf, s->inbuf + 1, s->header_size - 1); |
|
|
|
@ -59,19 +58,19 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1, |
|
|
|
|
} else { |
|
|
|
|
s->frame_size = len; |
|
|
|
|
/* update codec info */ |
|
|
|
|
avctx->sample_rate = sample_rate; |
|
|
|
|
avctx->sample_rate = s->sample_rate; |
|
|
|
|
/* allow downmixing to stereo (or mono for AC3) */ |
|
|
|
|
if(avctx->request_channels > 0 && |
|
|
|
|
avctx->request_channels < channels && |
|
|
|
|
avctx->request_channels < s->channels && |
|
|
|
|
(avctx->request_channels <= 2 || |
|
|
|
|
(avctx->request_channels == 1 && |
|
|
|
|
avctx->codec_id == CODEC_ID_AC3))) { |
|
|
|
|
avctx->channels = avctx->request_channels; |
|
|
|
|
} else { |
|
|
|
|
avctx->channels = channels; |
|
|
|
|
avctx->channels = s->channels; |
|
|
|
|
} |
|
|
|
|
avctx->bit_rate = bit_rate; |
|
|
|
|
avctx->frame_size = samples; |
|
|
|
|
avctx->bit_rate = s->bit_rate; |
|
|
|
|
avctx->frame_size = s->samples; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|