aacdec: inbuf and inbuf_len are only used in mp3dec()
authorAndre <maan@p133.(none)>
Sat, 13 May 2006 03:14:45 +0000 (05:14 +0200)
committerAndre <maan@p133.(none)>
Sat, 13 May 2006 03:14:45 +0000 (05:14 +0200)
No need to keep them around in the private_data struct.

aacdec.c

index 9cc9755..315f338 100644 (file)
--- a/aacdec.c
+++ b/aacdec.c
@@ -46,15 +46,13 @@ struct private_mp4dec_data {
 
        int initialized;
        int decoder_length;
 
        int initialized;
        int decoder_length;
-       unsigned char *inbuf;
-       int inbuf_len;
        int consumed;
        long unsigned consumed_total;
 
        long unsigned entry;
 };
 
        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;
 {
        struct private_mp4dec_data *padd = fn->private_data;
        struct filter_chain_info *fci = fn->fci;
@@ -62,22 +60,20 @@ static ssize_t mp4dec(char *inbuffer, size_t len, struct filter_node *fn)
        unsigned char channels = 0;
        int i, ret, skip;
        unsigned char *p, *outbuffer;
        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;
 
        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) {
 
        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) {
                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;
                        PARA_INFO_LOG("decoder init: %d\n", ret);
                        if (ret < 0) {
                                ret = -E_AACDEC_INIT;
@@ -86,7 +82,7 @@ static ssize_t mp4dec(char *inbuffer, size_t len, struct filter_node *fn)
                        padd->consumed = ret;
                } else {
                        padd->consumed += skip;
                        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,
                        ret = -E_AACDEC_INIT;
                        if (NeAACDecInit2(padd->decoder, p,
                                        padd->decoder_length, &rate,
@@ -102,14 +98,14 @@ static ssize_t mp4dec(char *inbuffer, size_t len, struct filter_node *fn)
        if (padd->decoder_length > 0) {
                padd->consumed = 0;
                if (!padd->entry) {
        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;
                        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;
                        PARA_INFO_LOG("entry: %lu\n", padd->entry);
                }
                ret = len;
@@ -118,12 +114,12 @@ static ssize_t mp4dec(char *inbuffer, size_t len, struct filter_node *fn)
                if (padd->consumed_total < padd->entry)
                        padd->consumed = padd->entry - padd->consumed_total;
        }
                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;
                        break;
-       if (padd->consumed >= padd->inbuf_len)
+       if (padd->consumed >= len)
                goto success;
                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;
        outbuffer = NeAACDecDecode(padd->decoder, &padd->frame_info, p,
                len - padd->consumed);
        ret = -E_AAC_DECODE;