5 NeAACDecHandle aac_open(void)
7 NeAACDecHandle h = NeAACDecOpen();
8 NeAACDecConfigurationPtr c = NeAACDecGetCurrentConfiguration(h);
10 c->defObjectType = LC;
11 c->outputFormat = FAAD_FMT_16BIT;
13 NeAACDecSetConfiguration(h, c);
17 static int aac_read_decoder_length(unsigned char *buf, int *description_len)
26 length = (length << 7) | (b & 0x7F);
28 ((b & 0x80) && numBytes < 4);
29 *description_len = numBytes;
33 int aac_find_esds(unsigned char *buf, unsigned buflen, int *skip)
37 for (i = 0; i + 4 < buflen; i++) {
38 unsigned char *p = buf + i;
39 int decoder_length, description_len;
41 if (p[0] != 'e' || p[1] != 's' || p[2] != 'd' || p[3] != 's')
45 PARA_INFO_LOG("found esds@%d, next: %x\n", i, *p);
51 PARA_INFO_LOG("next: %x\n", *p);
56 PARA_INFO_LOG("next: %x\n", *p);
60 decoder_length = aac_read_decoder_length(p, &description_len);
61 PARA_INFO_LOG("decoder length: %d\n", decoder_length);
64 return decoder_length;
69 unsigned aac_read_int32(unsigned char *buf)
71 uint8_t *d = (uint8_t*)buf;
72 return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3];
76 int find_stco(unsigned char *buf, unsigned buflen, int *skip)
80 for (i = 0; i + 16 < buflen; i++) {
81 unsigned char *p = buf + i;
83 if (p[0] != 's' || p[1] != 't' || p[2] != 'c' || p[3] != 'o')
85 PARA_INFO_LOG("found stco@%d\n", i);
87 ret = aac_read_int32(buf + i);
89 PARA_INFO_LOG("num entries: %d\n", ret);