frames_per_chunk = num_frames / afhi->chunks_total;
i = 0;
j = 1;
+ start += afhi->header_len;
+ buf_size -= afhi->header_len;
FOR_EACH_FRAME(f, start, buf_size, block_align) {
count += f[WMA_FRAME_SKIP] & 0x0f;
while (count > j * frames_per_chunk && f > start) {
ct_size * sizeof(uint32_t));
}
PARA_DEBUG_LOG("ct[%d]: %zu\n", j, f - start);
- afhi->chunk_table[j] = f - start;
+ afhi->chunk_table[j] = f - start + afhi->header_len;
}
}
afhi->chunks_total = j;
afhi->header_len = ahi.header_len;
afhi->header_offset = 0;
read_asf_tags(map, ahi.header_len, &afhi->tags);
- wma_make_chunk_table(map + ahi.header_len, numbytes - ahi.header_len,
- ahi.block_align, afhi);
+ wma_make_chunk_table(map, numbytes, ahi.block_align, afhi);
return 0;
}
{
const char *p, *end = buf + buf_size;
- if (pattern_len > buf_size)
- return NULL;
for (p = buf; p + pattern_len < end; p++) {
if (memcmp(p, pattern, pattern_len))
continue;
ret = find_audio_stream_info(buf, ahi->header_len);
if (ret < 0)
return ret;
+ /* FIXME: Check ranges */
ahi->audio_stream_info_start = ret + 16;
start = buf + ahi->audio_stream_info_start;