- return ret;
- *frames = num_chunks;
- 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;
- PARA_INFO_LOG("offset table has %zu entries, entry: %zu\n", num_chunks,
- entry);
-#if 1
- sprintf(info_str, "audio_file_info1:%zu 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, %zu chunks\n", *seconds, num_chunks);
- }
-#endif
- return 1;
-}
-
-/*
- * Simple stream reposition routine
- */
-static int aac_reposition_stream(long unsigned request)
-{
- return 1;
-// return -E_AAC_REPOS;
-}
-
-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);