From: Andre Noll Date: Sun, 11 Mar 2007 17:19:36 +0000 (+0100) Subject: aac_afh.c: kill global variables inbuf and inbuf_len X-Git-Tag: v0.2.16~35 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=f7b6451de1f334d8ab13a1f9428a1b24a437ba1d;ds=sidebyside aac_afh.c: kill global variables inbuf and inbuf_len Pass them to read_chunk_table() instead. --- diff --git a/aac_afh.c b/aac_afh.c index 8d1ff684..ab97cdad 100644 --- 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);