Browse Source

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>
tags/n1.1
Michael Niedermayer 13 years ago
parent
commit
bfe735b582
1 changed files with 28 additions and 0 deletions
  1. +28
    -0
      libavcodec/aacdec.c

+ 28
- 0
libavcodec/aacdec.c View File

@@ -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:


Loading…
Cancel
Save