- ogg_stream_pagein(stream_in, &page);
- ogg_stream_packetout(stream_in, &packet);
- ogg_stream_packetin(stream_out, &packet);
-
- afi->header_len = 0;
- while (ogg_stream_flush(stream_out, &page))
- afi->header_len += page.body_len + page.header_len;
- PARA_INFO_LOG("header_len = %d\n", afi->header_len);
- ret = ogg_save_header(file, afi);
-err2:
- ogg_stream_destroy(stream_in);
- ogg_stream_destroy(stream_out);
-err1:
- ogg_sync_destroy(sync_in);
- vorbis_info_clear(&vi);
- vorbis_comment_clear(&vc);
- return ret;
-}
-
-/*
- * Alloc and fill array table of byte offsets. chunk_table[i] is the
- * offset in the current input file at which the sample containing time i *
- * CHUNK_TIME begins. Always successful.
- */
-static long unsigned ogg_compute_chunk_table(OggVorbis_File *of,
- struct audio_format_info *afi, double time_total)
-{
- int i, ret, num;
- ssize_t max_chunk_len, pos = 0, min = 0, old_pos;
- long unsigned num_chunks;
-
- old_pos = 0;
+ ret = -E_OGG_PACKET_IN;
+ if (ogg_stream_packetin(&vghd->os, packet) < 0)
+ goto out;
+ while (ogg_stream_flush(&vghd->os, &og))
+ add_ogg_page(&og, vghd);