- return ret;
- for (;;) {
- ret = aac_find_stco(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);
- }
- *frames = ret;
- entry = aac_read_int32(inbuf + skip);
- PARA_INFO_LOG("offset table has %d entries\, entry: %zd\n", num_chunks,
- entry);
-#if 1
- sprintf(info_str, "audio_file_info1:%d x %lums\n"
- "audio_file_info2:\n"
- "audio_file_info3:\n",
- num_chunks,
- tv2ms(&af->chunk_tv));
-#endif
-#if 1
- {
- struct timeval total_tv;
- tv_scale(num_chunks, &af->chunk_tv, &total_tv);
- *seconds = tv2ms(&total_tv) / 1000;
- PARA_INFO_LOG("%d seconds, %d chunks\n", *seconds, num_chunks);
- }
-#endif
- return 1;
+ goto out;
+ ret = aac_find_entry_point(umap + skip, numbytes - skip, &skip);
+ if (ret < 0)
+ 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;