- int ret;
- size_t pos;
-
- *len = 0;
- if (current_chunk >= num_chunks)
- return NULL;
- if (!current_chunk) {
- *len = entry;
- pos = 0;
- } else if (current_chunk == 1) {
- *len = chunk_table[0];
- pos = entry;
- } else {
- *len = chunk_table[current_chunk - 1] - chunk_table[current_chunk - 2];
- pos = entry + chunk_table[current_chunk - 2];
- }
- if (inbuf_size < *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;
-}
-
-void aac_afh_init(void *p)
-{
- af = p;
- af->reposition_stream = aac_reposition_stream;
- 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->chunk_tv.tv_sec = 0;
- af->chunk_tv.tv_usec = 23120;
- tv_scale(3, &af->chunk_tv, &af->eof_tv);
+ afh->get_file_info = aac_get_file_info,
+ afh->suffixes = aac_suffixes;
+ afh->rewrite_tags = aac_rewrite_tags;
+ afh->open = aac_afh_open;
+ afh->get_chunk = aac_afh_get_chunk;
+ afh->close = aac_afh_close;