X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=aac_common.c;h=b3463b25284f62bc2cffbe74c501755864965e38;hp=16109b9500c08e97c8ece63cc8aa51819b3921bd;hb=bfbc3f075056b468dfdb525d8a623fe50a20117a;hpb=55f0f9461990455656bef7a36b0f963e3d676653 diff --git a/aac_common.c b/aac_common.c index 16109b95..b3463b25 100644 --- a/aac_common.c +++ b/aac_common.c @@ -1,3 +1,27 @@ +/* + * Copyright (C) 2006 Andre Noll + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + */ +/* + * based in parts on libfaad, Copyright (C) 2003-2005 M. Bakker, + * Ahead Software AG + */ + +/** \file aac_ccomon.c common functions of aac_afh and aadcec */ + #include "para.h" #include "aac.h" #include "error.h" @@ -57,6 +81,7 @@ int aac_find_esds(unsigned char *buf, unsigned buflen, int *skip) if (*p != 5) continue; i++; + p = buf + i; decoder_length = aac_read_decoder_length(p, &description_len); PARA_INFO_LOG("decoder length: %d\n", decoder_length); i += description_len; @@ -73,23 +98,24 @@ unsigned aac_read_int32(unsigned char *buf) } -int find_stco(unsigned char *buf, unsigned buflen, int *skip) +int aac_find_entry_point(unsigned char *buf, unsigned buflen, int *skip) { int i, ret; - for (i = 0; i + 16 < buflen; i++) { + for (i = 0; i + 20 < buflen; i++) { unsigned char *p = buf + i; if (p[0] != 's' || p[1] != 't' || p[2] != 'c' || p[3] != 'o') continue; PARA_INFO_LOG("found stco@%d\n", i); - i += 8; - ret = aac_read_int32(buf + i); + i += 12; + ret = aac_read_int32(buf + i); /* first offset */ i += 4; PARA_INFO_LOG("num entries: %d\n", ret); *skip = i; return ret; } + PARA_WARNING_LOG("stco not found, buflen: %d\n", buflen); return -E_STCO; }