-static int read_mp4_descr_length(struct private_mp4dec_data *padd)
-{
- uint8_t b;
- uint8_t numBytes = 0;
- uint32_t length = 0;
-
- do {
- b = padd->inbuf[padd->consumed + numBytes];
- numBytes++;
- length = (length << 7) | (b & 0x7F);
- } while
- ((b & 0x80) && numBytes < 4);
- padd->consumed += numBytes;
- return length;
-}
-
-static int find_esds(struct private_mp4dec_data *padd)
-{
- for (; padd->consumed < padd->inbuf_len; padd->consumed++) {
- unsigned char *p = padd->inbuf + padd->consumed;
- int decoder_length;
-
- if (p[0] != 'e' || p[1] != 's' || p[2] != 'd' || p[3] != 's')
- continue;
- padd->consumed += 8;
- p = padd->inbuf + padd->consumed;
- PARA_INFO_LOG("found esds: %d, next: %x\n", padd->consumed, *p);
- if (*p == 3)
- padd->consumed += 8;
- else
- padd->consumed += 6;
- p = padd->inbuf + padd->consumed;
- PARA_INFO_LOG("next: %x\n", *p);
- if (*p != 4)
- continue;
- padd->consumed += 18;
- p = padd->inbuf + padd->consumed;
- PARA_INFO_LOG("next: %x\n", *p);
- if (*p != 5)
- continue;
- padd->consumed++;
- decoder_length = read_mp4_descr_length(padd);
- PARA_INFO_LOG("decoder length: %d\n", decoder_length);
- p = padd->inbuf + padd->consumed;
- PARA_INFO_LOG("decoder data0: %x\n", *p & 0xff);
- p++;
- PARA_INFO_LOG("decoder data1: %x\n", *p & 0xff);
- return decoder_length;
- }
- return -E_ESDS;
-}
-
-static int read_int32(struct private_mp4dec_data *padd, unsigned *result)