]> git.tue.mpg.de Git - paraslash.git/commitdiff
aac_afh.c: kill global variables inbuf and inbuf_len
authorAndre Noll <maan@systemlinux.org>
Sun, 11 Mar 2007 17:19:36 +0000 (18:19 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 11 Mar 2007 17:19:36 +0000 (18:19 +0100)
Pass them to read_chunk_table() instead.

aac_afh.c

index 8d1ff6847afb06c724e5a96a728f308826cbffc7..ab97cdad0da50177b0820651dfd69f7237a7cd27 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -34,8 +34,6 @@
 #define AAC_INBUF_SIZE 65536
 
 static FILE *infile;
-static unsigned char *inbuf;
-static size_t inbuf_len;
 
 static void aac_close_audio_file(void)
 {
@@ -70,7 +68,8 @@ static int aac_find_stsz(unsigned char *buf, unsigned buflen, size_t *skip)
        return -E_STSZ;
 }
 
-static int read_chunk_table(struct audio_format_info *afi, size_t skip)
+static int read_chunk_table(struct audio_format_info *afi, unsigned char *inbuf,
+               size_t inbuf_len, size_t skip)
 {
        int ret, i;
        size_t sum = 0;
@@ -130,15 +129,13 @@ static long unsigned aac_set_chunk_tv(struct audio_format_info *afi,
 static int aac_get_file_info(FILE *file, struct audio_format_info *afi)
 {
        int i, ret, decoder_len;
-       size_t skip;
+       size_t inbuf_len, skip;
        unsigned long rate = 0;
-       unsigned char channels = 0;
+       unsigned char channels = 0, *inbuf = para_malloc(AAC_INBUF_SIZE);
        mp4AudioSpecificConfig mp4ASC;
        NeAACDecHandle handle;
 
-       inbuf = para_malloc(AAC_INBUF_SIZE);
        infile = file;
-
        ret = read(fileno(infile), inbuf, AAC_INBUF_SIZE);
        if (ret <= 0) {
                ret = -E_AAC_READ;
@@ -161,7 +158,7 @@ static int aac_get_file_info(FILE *file, struct audio_format_info *afi)
        if (NeAACDecAudioSpecificConfig(inbuf + skip, inbuf_len - skip,
                        &mp4ASC) < 0)
                goto out;
-       ret = read_chunk_table(afi, skip);
+       ret = read_chunk_table(afi, inbuf, inbuf_len, skip);
        if (ret < 0)
                goto out;
        afi->seconds_total = aac_set_chunk_tv(afi, &mp4ASC);