aacdec: "consumed" is only used in mp4dec()
authorAndre <maan@p133.(none)>
Sat, 13 May 2006 03:21:56 +0000 (05:21 +0200)
committerAndre <maan@p133.(none)>
Sat, 13 May 2006 03:21:56 +0000 (05:21 +0200)
Remove it from struct private_aacdec_data.

aacdec.c

index 315f338..2433b18 100644 (file)
--- a/aacdec.c
+++ b/aacdec.c
@@ -46,7 +46,6 @@ struct private_mp4dec_data {
 
        int initialized;
        int decoder_length;
-       int consumed;
        long unsigned consumed_total;
 
        long unsigned entry;
@@ -61,12 +60,12 @@ static ssize_t mp4dec(char *input_buffer, size_t len, struct filter_node *fn)
        int i, ret, skip;
        unsigned char *p, *outbuffer;
        unsigned char *inbuf = (unsigned char*)input_buffer;
+       size_t consumed = 0;
 
        if (fn->loaded > fn->bufsize * 4 / 5)
                return 0;
        if (len < 1000 && !*fci->eof)
                return 0;
-       padd->consumed = 0;
 
        if (!padd->initialized) {
                padd->decoder_length = aac_find_esds(inbuf, len, &skip);
@@ -79,10 +78,10 @@ static ssize_t mp4dec(char *input_buffer, size_t len, struct filter_node *fn)
                                ret = -E_AACDEC_INIT;
                                goto out;
                        }
-                       padd->consumed = ret;
+                       consumed = ret;
                } else {
-                       padd->consumed += skip;
-                       p = inbuf + padd->consumed;
+                       consumed += skip;
+                       p = inbuf + consumed;
                        ret = -E_AACDEC_INIT;
                        if (NeAACDecInit2(padd->decoder, p,
                                        padd->decoder_length, &rate,
@@ -96,44 +95,44 @@ static ssize_t mp4dec(char *input_buffer, size_t len, struct filter_node *fn)
                padd->initialized = 1;
        }
        if (padd->decoder_length > 0) {
-               padd->consumed = 0;
+               consumed = 0;
                if (!padd->entry) {
-                       ret = aac_find_stco(inbuf + padd->consumed,
-                               len - padd->consumed, &skip);
+                       ret = aac_find_stco(inbuf + consumed, len - consumed,
+                               &skip);
                        if (ret < 0) {
                                ret = len;
                                goto out;
                        }
-                       padd->consumed += skip;
-                       padd->entry = aac_read_int32(inbuf + padd->consumed);
+                       consumed += skip;
+                       padd->entry = aac_read_int32(inbuf + consumed);
                        PARA_INFO_LOG("entry: %lu\n", padd->entry);
                }
                ret = len;
                if (padd->consumed_total + len < padd->entry)
                        goto out;
                if (padd->consumed_total < padd->entry)
-                       padd->consumed = padd->entry - padd->consumed_total;
+                       consumed = padd->entry - padd->consumed_total;
        }
-       for (; padd->consumed < len; padd->consumed++)
-               if ((inbuf[padd->consumed] & 0xfe) == 0x20)
+       for (; consumed < len;consumed++)
+               if ((inbuf[consumed] & 0xfe) == 0x20)
                        break;
-       if (padd->consumed >= len)
+       if (consumed >= len)
                goto success;
-       p = inbuf + padd->consumed;
+       p = inbuf + consumed;
        outbuffer = NeAACDecDecode(padd->decoder, &padd->frame_info, p,
-               len - padd->consumed);
+               len - consumed);
        ret = -E_AAC_DECODE;
        if (padd->frame_info.error != 0) {
                PARA_ERROR_LOG("frame_error: %d, consumed: %lu + %d + %lu\n",
                        padd->frame_info.error, padd->consumed_total,
-                       padd->consumed, padd->frame_info.bytesconsumed);
+                       consumed, padd->frame_info.bytesconsumed);
                PARA_ERROR_LOG("%s\n", NeAACDecGetErrorMessage(
                        padd->frame_info.error));
-               padd->consumed++; /* catch 21 */
+               consumed++; /* catch 21 */
                goto success;
        }
-       padd->consumed += padd->frame_info.bytesconsumed;
-       ret = padd->consumed;
+       consumed += padd->frame_info.bytesconsumed;
+       ret = consumed;
        if (!padd->frame_info.samples)
                goto out;
        for (i = 0; i < padd->frame_info.samples; i++) {
@@ -142,7 +141,7 @@ static ssize_t mp4dec(char *input_buffer, size_t len, struct filter_node *fn)
                fn->buf[fn->loaded++] = (s[i] >> 8) & 0xff;
        }
 success:
-       ret = padd->consumed;
+       ret = consumed;
 out:
        if (ret > 0)
                padd->consumed_total += ret;