int initialized;
int decoder_length;
- unsigned char *inbuf;
- int inbuf_len;
int consumed;
long unsigned consumed_total;
long unsigned entry;
};
-static ssize_t mp4dec(char *inbuffer, size_t len, struct filter_node *fn)
+static ssize_t mp4dec(char *input_buffer, size_t len, struct filter_node *fn)
{
struct private_mp4dec_data *padd = fn->private_data;
struct filter_chain_info *fci = fn->fci;
unsigned char channels = 0;
int i, ret, skip;
unsigned char *p, *outbuffer;
+ unsigned char *inbuf = (unsigned char*)input_buffer;
if (fn->loaded > fn->bufsize * 4 / 5)
return 0;
if (len < 1000 && !*fci->eof)
return 0;
padd->consumed = 0;
- padd->inbuf = (unsigned char*)inbuffer;
- padd->inbuf_len = len;
if (!padd->initialized) {
- padd->decoder_length = aac_find_esds(padd->inbuf, padd->inbuf_len,
- &skip);
+ padd->decoder_length = aac_find_esds(inbuf, len, &skip);
PARA_INFO_LOG("decoder len: %d\n", padd->decoder_length);
if (padd->decoder_length < 0) {
- ret = NeAACDecInit(padd->decoder, padd->inbuf,
- padd->inbuf_len, &rate, &channels);
+ ret = NeAACDecInit(padd->decoder, inbuf,
+ len, &rate, &channels);
PARA_INFO_LOG("decoder init: %d\n", ret);
if (ret < 0) {
ret = -E_AACDEC_INIT;
padd->consumed = ret;
} else {
padd->consumed += skip;
- p = padd->inbuf + padd->consumed;
+ p = inbuf + padd->consumed;
ret = -E_AACDEC_INIT;
if (NeAACDecInit2(padd->decoder, p,
padd->decoder_length, &rate,
if (padd->decoder_length > 0) {
padd->consumed = 0;
if (!padd->entry) {
- ret = aac_find_stco(padd->inbuf + padd->consumed,
- padd->inbuf_len - padd->consumed, &skip);
+ ret = aac_find_stco(inbuf + padd->consumed,
+ len - padd->consumed, &skip);
if (ret < 0) {
ret = len;
goto out;
}
padd->consumed += skip;
- padd->entry = aac_read_int32(padd->inbuf + padd->consumed);
+ padd->entry = aac_read_int32(inbuf + padd->consumed);
PARA_INFO_LOG("entry: %lu\n", padd->entry);
}
ret = len;
if (padd->consumed_total < padd->entry)
padd->consumed = padd->entry - padd->consumed_total;
}
- for (; padd->consumed < padd->inbuf_len; padd->consumed++)
- if ((padd->inbuf[padd->consumed] & 0xfe) == 0x20)
+ for (; padd->consumed < len; padd->consumed++)
+ if ((inbuf[padd->consumed] & 0xfe) == 0x20)
break;
- if (padd->consumed >= padd->inbuf_len)
+ if (padd->consumed >= len)
goto success;
- p = padd->inbuf + padd->consumed;
+ p = inbuf + padd->consumed;
outbuffer = NeAACDecDecode(padd->decoder, &padd->frame_info, p,
len - padd->consumed);
ret = -E_AAC_DECODE;