Some more aacdec cleanups
authorAndre <maan@p133.(none)>
Sat, 13 May 2006 03:35:14 +0000 (05:35 +0200)
committerAndre <maan@p133.(none)>
Sat, 13 May 2006 03:35:14 +0000 (05:35 +0200)
rename the "decoder" field to "handle" as it is of type NeAACDecHandle.
Fix some typos in comments and make two more variables local.

aacdec.c

index c20761c6f451c8d0ac93730e0258678c3ea37a7c..c7bec16479ae1373f05cfa0118da8af36eee0c72 100644 (file)
--- a/aacdec.c
+++ b/aacdec.c
@@ -21,7 +21,7 @@
  * Ahead Software AG
  */
 
  * Ahead Software AG
  */
 
-/** \file aacdec.c paraslash's mp3 decoder */
+/** \file aacdec.c paraslash's aac (m4a) decoder */
 
 #include "para.h"
 
 
 #include "para.h"
 
@@ -31,8 +31,8 @@
 #include "string.h"
 #include "aac.h"
 
 #include "string.h"
 #include "aac.h"
 
-/** the output buffer size */
 #define MAX_CHANNELS 6
 #define MAX_CHANNELS 6
+/** the output buffer size */
 #define AAC_OUTBUF_SIZE (FAAD_MIN_STREAMSIZE * MAX_CHANNELS)
 
 /**
 #define AAC_OUTBUF_SIZE (FAAD_MIN_STREAMSIZE * MAX_CHANNELS)
 
 /**
  * \sa filter, filter_node
  */
 struct private_aacdec_data {
  * \sa filter, filter_node
  */
 struct private_aacdec_data {
-       NeAACDecHandle decoder;
+       NeAACDecHandle handle;
        NeAACDecFrameInfo frame_info;
 
        int initialized;
        int decoder_length;
        long unsigned consumed_total;
        NeAACDecFrameInfo frame_info;
 
        int initialized;
        int decoder_length;
        long unsigned consumed_total;
-
        long unsigned entry;
 };
 
        long unsigned entry;
 };
 
@@ -55,8 +54,6 @@ static ssize_t aacdec(char *input_buffer, size_t len, struct filter_node *fn)
 {
        struct private_aacdec_data *padd = fn->private_data;
        struct filter_chain_info *fci = fn->fci;
 {
        struct private_aacdec_data *padd = fn->private_data;
        struct filter_chain_info *fci = fn->fci;
-       unsigned long rate = 0;
-       unsigned char channels = 0;
        int i, ret, skip;
        unsigned char *p, *outbuffer;
        unsigned char *inbuf = (unsigned char*)input_buffer;
        int i, ret, skip;
        unsigned char *p, *outbuffer;
        unsigned char *inbuf = (unsigned char*)input_buffer;
@@ -68,10 +65,12 @@ static ssize_t aacdec(char *input_buffer, size_t len, struct filter_node *fn)
                return 0;
 
        if (!padd->initialized) {
                return 0;
 
        if (!padd->initialized) {
+               unsigned long rate = 0;
+               unsigned char channels = 0;
                padd->decoder_length = aac_find_esds(inbuf, len, &skip);
                PARA_INFO_LOG("decoder len: %d\n", padd->decoder_length);
                if (padd->decoder_length < 0) {
                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, inbuf,
+                       ret = NeAACDecInit(padd->handle, inbuf,
                                len, &rate, &channels);
                        PARA_INFO_LOG("decoder init: %d\n", ret);
                        if (ret < 0) {
                                len, &rate, &channels);
                        PARA_INFO_LOG("decoder init: %d\n", ret);
                        if (ret < 0) {
@@ -83,7 +82,7 @@ static ssize_t aacdec(char *input_buffer, size_t len, struct filter_node *fn)
                        consumed += skip;
                        p = inbuf + consumed;
                        ret = -E_AACDEC_INIT;
                        consumed += skip;
                        p = inbuf + consumed;
                        ret = -E_AACDEC_INIT;
-                       if (NeAACDecInit2(padd->decoder, p,
+                       if (NeAACDecInit2(padd->handle, p,
                                        padd->decoder_length, &rate,
                                        &channels) < 0)
                                goto out;
                                        padd->decoder_length, &rate,
                                        &channels) < 0)
                                goto out;
@@ -119,7 +118,7 @@ static ssize_t aacdec(char *input_buffer, size_t len, struct filter_node *fn)
        if (consumed >= len)
                goto success;
        p = inbuf + consumed;
        if (consumed >= len)
                goto success;
        p = inbuf + consumed;
-       outbuffer = NeAACDecDecode(padd->decoder, &padd->frame_info, p,
+       outbuffer = NeAACDecDecode(padd->handle, &padd->frame_info, p,
                len - consumed);
        ret = -E_AAC_DECODE;
        if (padd->frame_info.error != 0) {
                len - consumed);
        ret = -E_AAC_DECODE;
        if (padd->frame_info.error != 0) {
@@ -155,14 +154,14 @@ static void aacdec_open(struct filter_node *fn)
 
        fn->bufsize = AAC_OUTBUF_SIZE;
        fn->buf = para_calloc(fn->bufsize);
 
        fn->bufsize = AAC_OUTBUF_SIZE;
        fn->buf = para_calloc(fn->bufsize);
-       padd->decoder = aac_open();
+       padd->handle = aac_open();
 }
 
 static void aacdec_close(struct filter_node *fn)
 {
        struct private_aacdec_data *padd = fn->private_data;
 
 }
 
 static void aacdec_close(struct filter_node *fn)
 {
        struct private_aacdec_data *padd = fn->private_data;
 
-       NeAACDecClose(padd->decoder);
+       NeAACDecClose(padd->handle);
        free(fn->buf);
        fn->buf = NULL;
        free(padd);
        free(fn->buf);
        fn->buf = NULL;
        free(padd);
@@ -170,7 +169,7 @@ static void aacdec_close(struct filter_node *fn)
 }
 
 /**
 }
 
 /**
- * the init function of the mp3dec filter
+ * the init function of the aacdec filter
  *
  * \sa filter::init
  */
  *
  * \sa filter::init
  */