- afi->seconds_total = aac_set_chunk_tv(afi, &mp4ASC);
- for (;;) {
- ret = aac_find_entry_point(inbuf, inbuf_len, &skip);
- if (ret >= 0)
- break;
- ret = read(fileno(infile), inbuf, AAC_INBUF_SIZE);
- if (ret <= 0) {
- ret = -E_AAC_READ;
- goto out;
- }
- inbuf_len = ret;
- PARA_INFO_LOG("next buffer: %d bytes\n", ret);
- }
- afi->chunk_table[0] = ret;
- for (i = 1; i<= afi->chunks_total; i++)
- afi->chunk_table[i] += ret;
- sprintf(afi->info_string, "audio_file_info1:%lu x %lums\n"
- "audio_file_info2:\n"
- "audio_file_info3:\n",
- afi->chunks_total,
- tv2ms(&afi->chunk_tv));
- tv_scale(20, &afi->chunk_tv, &afi->eof_tv);
+ skip = ret;
+ ret = aac_set_chunk_tv(afhi, &mp4ASC, &afhi->seconds_total);
+ if (ret < 0)
+ 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);
+ sprintf(afhi->info_string, "%s:\n%s:\n%s:\n",
+ status_item_list[SI_AUDIO_FILE_INFO],
+ status_item_list[SI_TAGINFO1],
+ status_item_list[SI_TAGINFO2]
+ );
+ tv_scale(20, &afhi->chunk_tv, &afhi->eof_tv);