* apparent at packetout.
*/
ogg_stream_pagein(stream, &page);
+ PARA_INFO_LOG("ogg page serial: %d\n",
+ ogg_page_serialno(&page));
while (i < 2) {
ret = ogg_stream_packetout(stream, &packet);
if (ret == 0)
break;
if (ret < 0)
return -E_STREAM_PACKETOUT;
- ret = ci->packet_callback(&packet, i + 1, afhi,
+ ret = ci->packet_callback(&packet, i + 1,
+ ogg_page_serialno(&page), afhi,
ci->private_data);
if (ret < 0)
return ret;
ret = -E_STREAM_PACKETOUT;
if (ogg_stream_packetout(&stream, &packet) != 1)
goto out;
- ret = ci->packet_callback(&packet, 0, afhi, ci->private_data);
+ ret = ci->packet_callback(&packet, 0, ogg_page_serialno(&page),
+ afhi, ci->private_data);
if (ret < 0)
goto out;
ret = process_packets_2_and_3(oss, &stream, afhi, ci);
if (ret < 0)
goto out;
- afhi->header_offset = 0;
- afhi->header_len = oss->returned;
ret = 1;
out:
ogg_stream_clear(&stream);
* given by \a map and \a numbytes and passes each packet to the callback
* defined by \a ci.
*
- * If the packet callback indicates success, the chunk table is built. Chunk
- * zero contains the first three ogg packets while all other chunks consist of
- * exactly one ogg page.
+ * If the packet callback indicates success and \a afhi is not \p NULL, the
+ * chunk table is built. Chunk zero contains the first three ogg packets while
+ * all other chunks consist of exactly one ogg page.
*
* \param map Audio file data.
* \param numbytes The length of \a map.
ret = process_ogg_packets(&oss, afhi, ci);
if (ret < 0)
goto out;
+ if (!afhi)
+ goto out;
+ afhi->header_len = oss.returned;
oss.returned = 0;
oss.fill = numbytes;
/* count ogg pages and get duration of the file */
for (j = 1; ogg_sync_pageseek(&oss, &op) > 0; /* nothing */) {
int granule = ogg_page_granulepos(&op);
- while (granule > j * frames_per_chunk) {
+ while (granule >= (j + 1) * frames_per_chunk) {
j++;
if (j >= ct_size) {
ct_size *= 2;