- return ret;
- *frames = num_chunks;
- *seconds = aac_set_chunk_tv(&mp4ASC);
- for (;;) {
- ret = aac_find_entry_point(inbuf, inbuf_len, &skip);
- if (ret >= 0)
- break;
- ret = read(fileno(infile), inbuf, inbuf_size);
- if (ret <= 0)
- return -E_AAC_READ;
- PARA_INFO_LOG("next buffer: %d bytes\n", ret);
- }
- entry = ret;
- sprintf(info_str, "audio_file_info1:%zu x %lums\n"
- "audio_file_info2:\n"
- "audio_file_info3:\n",
- num_chunks,
- tv2ms(&af->chunk_tv));
- tv_scale(20, &af->chunk_tv, &af->eof_tv);
- return 1;
-}
-
-/*
- * nothing to do as we'll seek to the correct offset in aac read_chunk() anyway
- */
-static int aac_reposition_stream(__a_unused long unsigned request)
-{
- 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;
- if (!current_chunk) {
- *len = chunk_table[0];
- pos = entry;
- } else {
- *len = chunk_table[current_chunk] - chunk_table[current_chunk - 1];
- pos = entry + chunk_table[current_chunk - 1];
- }
- 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;
+ goto out;
+ afhi->chunk_table[0] = ret;
+ for (i = 1; i<= afhi->chunks_total; i++)
+ afhi->chunk_table[i] += ret;
+ afhi->channels = channels;
+ afhi->frequency = rate;
+ ret = (afhi->chunk_table[afhi->chunks_total] - afhi->chunk_table[0]) * 8; /* bits */
+ ret += (channels * afhi->seconds_total * 500); /* avoid rounding error */
+ afhi->bitrate = ret / (channels * afhi->seconds_total * 1000);
+ ret = 1;
+out:
+ if (handle)
+ NeAACDecClose(handle);
+ return ret;