static struct audio_format_handler *af;
static FILE *infile;
static unsigned char *inbuf;
-static size_t inbuf_len, num_chunks;
+static size_t inbuf_len;
static void aac_close_audio_file(void)
{
return -E_AAC_READ;
PARA_INFO_LOG("next buffer: %d bytes\n", ret);
}
- num_chunks = ret;
- PARA_INFO_LOG("sz table has %zu entries\n", num_chunks);
- afi->chunk_table = para_malloc((num_chunks + 1) * sizeof(size_t));
- for (i = 1; i <= num_chunks; i++) {
+ afi->chunks_total = ret;
+ PARA_INFO_LOG("sz table has %lu entries\n", afi->chunks_total);
+ afi->chunk_table = para_malloc((afi->chunks_total + 1) * sizeof(size_t));
+ for (i = 1; i <= afi->chunks_total; i++) {
if (skip + 4 > inbuf_len) {
skip = inbuf_len - skip;
memmove(inbuf, inbuf + inbuf_len - skip, skip);
sum += aac_read_int32(inbuf + skip);
afi->chunk_table[i] = sum;
skip += 4;
- if (i < 10 || i + 10 > num_chunks)
+ if (i < 10 || i + 10 > afi->chunks_total)
PARA_DEBUG_LOG("offset #%d: %zu\n", i, afi->chunk_table[i]);
}
return 1;
mp4AudioSpecificConfig *mp4ASC)
{
float tmp = mp4ASC->sbr_present_flag == 1? 2047 : 1023,
- ms = 1000.0 * num_chunks * tmp / mp4ASC->samplingFrequency;
+ ms = 1000.0 * afi->chunks_total * tmp / mp4ASC->samplingFrequency;
struct timeval total;
ms2tv(ms, &total);
- tv_divide(num_chunks, &total, &afi->chunk_tv);
- PARA_INFO_LOG("%luHz, %fs (%zd x %lums)\n",
+ tv_divide(afi->chunks_total, &total, &afi->chunk_tv);
+ PARA_INFO_LOG("%luHz, %fs (%lu x %lums)\n",
mp4ASC->samplingFrequency, ms / 1000,
- num_chunks, tv2ms(&afi->chunk_tv));
+ afi->chunks_total, tv2ms(&afi->chunk_tv));
return ms / 1000;
}
ret = read_chunk_table(afi, skip);
if (ret < 0)
return ret;
- afi->chunks_total = num_chunks;
afi->seconds_total = aac_set_chunk_tv(afi, &mp4ASC);
for (;;) {
ret = aac_find_entry_point(inbuf, inbuf_len, &skip);
PARA_INFO_LOG("next buffer: %d bytes\n", ret);
}
afi->chunk_table[0] = ret;
- for (i = 1; i<= num_chunks; i++)
+ for (i = 1; i<= afi->chunks_total; i++)
afi->chunk_table[i] += ret;
- sprintf(afi->info_string, "audio_file_info1:%zu x %lums\n"
+ sprintf(afi->info_string, "audio_file_info1:%lu x %lums\n"
"audio_file_info2:\n"
"audio_file_info3:\n",
- num_chunks,
+ afi->chunks_total,
tv2ms(&afi->chunk_tv));
tv_scale(20, &afi->chunk_tv, &afi->eof_tv);
return 1;