diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-09-28 20:03:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-09-28 20:30:37 +0200 |
commit | bfe735b5824c7d10ba42932a17d786db50e3b2d4 (patch) | |
tree | 8f1f60093fe264c4a078bc33463301d89f3486ab /libavcodec/aacdec.c | |
parent | ed2b69a4c32ae23f7a356e20f51994809e0be509 (diff) | |
download | ffmpeg-bfe735b5824c7d10ba42932a17d786db50e3b2d4.tar.gz |
aacdec: detect faac and skip correct amount of startup samples
This also fixes aac in adts and other containers than mov.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacdec.c')
-rw-r--r-- | libavcodec/aacdec.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 62df283b78..45784f702b 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -1947,6 +1947,32 @@ static int decode_dynamic_range(DynamicRangeControl *che_drc, return n; } +static int decode_fill(AACContext *ac, GetBitContext *gb, int len) { + uint8_t buf[256]; + int i, major, minor; + + if (len < 13+7*8) + goto unknown; + + get_bits(gb, 13); len -= 13; + + for(i=0; i+1<sizeof(buf) && len>=8; i++, len-=8) + buf[i] = get_bits(gb, 8); + + buf[i] = 0; + if (ac->avctx->debug & FF_DEBUG_PICT_INFO) + av_log(ac->avctx, AV_LOG_DEBUG, "FILL:%s\n", buf); + + if (sscanf(buf, "libfaac %d.%d", &major, &minor) == 2){ + ac->avctx->internal->skip_samples = 1024; + } + +unknown: + skip_bits_long(gb, len); + + return 0; +} + /** * Decode extension data (incomplete); reference: table 4.51. * @@ -1988,6 +2014,8 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, res = decode_dynamic_range(&ac->che_drc, gb, cnt); break; case EXT_FILL: + decode_fill(ac, gb, 8 * cnt - 4); + break; case EXT_FILL_DATA: case EXT_DATA_ELEMENT: default: |