X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=aac_afh.c;h=956ff6dad37493e5cf95990cde50204f97c226a3;hb=e9656de3ac6d281f585e5a60629d13631c569ae3;hp=b017a83231bc010ed19536c80c916523ef321458;hpb=aee7bc654a67f45556ad2c6dc0e98a06bc95c8ff;p=paraslash.git diff --git a/aac_afh.c b/aac_afh.c index b017a832..956ff6da 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -34,15 +34,10 @@ /** size of the input buffer, must be big enough to hold header */ #define DEFAULT_INBUF_SIZE 65536 +static struct audio_format_handler *af; static FILE *infile; -static int inbuf_size; static unsigned char *inbuf; -static size_t inbuf_len; -static struct audio_format_handler *af; -static size_t num_chunks; - -static size_t *chunk_table; -static NeAACDecHandle handle; +static size_t inbuf_size, inbuf_len, *chunk_table, num_chunks; static void aac_close_audio_file(void) { @@ -143,6 +138,7 @@ static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames, unsigned long rate = 0; unsigned char channels = 0; mp4AudioSpecificConfig mp4ASC; + NeAACDecHandle handle; inbuf_size = DEFAULT_INBUF_SIZE; inbuf = para_malloc(inbuf_size); @@ -194,45 +190,12 @@ static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames, return 1; } -static char *aac_read_chunk(long unsigned current_chunk, ssize_t *len) -{ - int ret; - size_t pos; - - *len = 0; - if (current_chunk >= num_chunks) - return NULL; - *len = chunk_table[current_chunk + 1] - chunk_table[current_chunk]; - if (!*len) /* nothing to send for this run */ - return inbuf; - pos = chunk_table[current_chunk]; - if (inbuf_size < *len) { - PARA_INFO_LOG("increasing inbuf for chunk #%lu/%zu to %zd bytes\n", - current_chunk, num_chunks, *len); - inbuf = para_realloc(inbuf, *len); - inbuf_size = *len; - } -// PARA_DEBUG_LOG("reading chunk #%lu@%zd (%zd bytes)\n", current_chunk, -// pos, *len); - ret = fseek(infile, pos, SEEK_SET); - if (ret < 0) - return NULL; - ret = para_fread(inbuf, *len, 1, infile); - if (ret != *len) - return NULL; -// PARA_DEBUG_LOG("ret: %d, inbuf[0]: %lx - %lx\n", ret, (long unsigned) inbuf[0], -// (long unsigned) inbuf[4]); - return (char *)inbuf; -} - - static const char* aac_suffixes[] = {"m4a", "mp4", NULL}; /** the init function of the aac audio format handler */ void aac_afh_init(struct audio_format_handler *p) { af = p; af->get_file_info = aac_get_file_info, - af->read_chunk = aac_read_chunk; af->close_audio_file = aac_close_audio_file; af->get_header_info = NULL; af->suffixes = aac_suffixes;