rather than the number of offsets which is rather uninteresting.
Also, rename this function to aac_find_entry() and return the
correct number of frames to para_server.
/* exported symbols from aac_common.c */
NeAACDecHandle aac_open(void);
int aac_find_esds(unsigned char *buf, unsigned buflen, int *skip);
-int aac_find_stco(unsigned char *buf, unsigned buflen, int *skip);
+int aac_find_entry(unsigned char *buf, unsigned buflen, int *skip);
int aac_find_stsz(unsigned char *buf, unsigned buflen, unsigned *skip);
unsigned aac_read_int32(unsigned char *buf);
ret = read_stsz(skip);
if (ret < 0)
return ret;
+ *frames = num_chunks;
for (;;) {
- ret = aac_find_stco(inbuf, inbuf_len, &skip);
+ ret = aac_find_entry(inbuf, inbuf_len, &skip);
if (ret >= 0)
break;
ret = read(fileno(infile), inbuf, inbuf_size);
return -E_AAC_READ;
PARA_INFO_LOG("next buffer: %d bytes\n", ret);
}
- *frames = ret;
- entry = aac_read_int32(inbuf + skip);
+ entry = ret;
PARA_INFO_LOG("offset table has %d entries\, entry: %zd\n", num_chunks,
entry);
#if 1
}
-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;
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;
if (padd->decoder_length > 0) {
consumed = 0;
if (!padd->entry) {
- ret = aac_find_stco(inbuf + consumed, len - consumed,
+ ret = aac_find_entry(inbuf + consumed, len - consumed,
&skip);
if (ret < 0) {
ret = len;
goto out;
}
consumed += skip;
- padd->entry = aac_read_int32(inbuf + consumed);
+ padd->entry = ret;
PARA_INFO_LOG("entry: %lu\n", padd->entry);
}
ret = len;