X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=aac_afh.c;h=b7e828f4d7c76287e871fee87dc17023215a80ab;hb=2187e113d02a2257cbbb02902a942946ffdc2e7e;hp=93bcd427008e1ec088d9501394f5e1b5f108408f;hpb=eda995d5da0a91ab0c4fa6c3d30c5bcdf69d2828;p=paraslash.git diff --git a/aac_afh.c b/aac_afh.c index 93bcd427..b7e828f4 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -44,6 +44,32 @@ static void aac_close_audio_file(void) { } +static int aac_find_stsz(unsigned char *buf, unsigned buflen, unsigned *skip) +{ + int i; + + for (i = 0; i + 16 < buflen; i++) { + unsigned char *p = buf + i; + unsigned sample_count, sample_size; + + if (p[0] != 's' || p[1] != 't' || p[2] != 's' || p[3] != 'z') + continue; + PARA_INFO_LOG("found stsz@%d\n", i); + i += 8; + sample_size = aac_read_int32(buf + i); + PARA_INFO_LOG("sample size: %d\n", sample_size); + i += 4; + sample_count = aac_read_int32(buf + i); + i += 4; + PARA_INFO_LOG("sample count: %d\n", sample_count); + *skip = i; + return sample_count; + } + PARA_WARNING_LOG("stsz not found, buflen: %d\n", buflen); + return -E_STCO; +} + + static int read_stsz(unsigned skip) { int ret, i;