]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - aac_common.c
aac: make find_stco() return the first offset
[paraslash.git] / aac_common.c
index 3739be9dfa450824f592ff7f5848a5377c3c038a..9edeb1c580b589229dec4aba14f0113c86d01bb2 100644 (file)
@@ -74,18 +74,18 @@ unsigned aac_read_int32(unsigned char *buf)
 }
 
 
-int aac_find_stco(unsigned char *buf, unsigned buflen, int *skip)
+int aac_find_entry(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;
@@ -97,7 +97,7 @@ int aac_find_stco(unsigned char *buf, unsigned buflen, int *skip)
 
 int aac_find_stsz(unsigned char *buf, unsigned buflen, unsigned *skip)
 {
-       int i, ret;
+       int i;
 
        for (i = 0; i + 16 < buflen; i++) {
                unsigned char *p = buf + i;