[Vorbis-dev] A few questions how to use libogg

Ian Malone ibm21 at cam.ac.uk
Fri Dec 9 03:03:21 PST 2005


Arjan Knepper wrote:
> 1.) after initializing a ogg_stream_state may I just keep calling 
> ogg_stream_packetin with valid ogg_packet's until no more ogg_packets 
> needs to be added? Or do I need to call ogg_stream_pageout after every 
> ogg_stream_packetin? Iaw may I delay calling ogg_stream_pageout until 
> there are no more packets to be added?
> 

I don't know this one for certain, but:
<http://www.xiph.org/ogg/doc/libogg/ogg_stream_packetin.html>
"we can continue submitting packets, or we can write out pages."

You may have memory constraints.

> 2.) I assume I have call ogg_stream_pageout until no more pages can be 
> created and then call ogg_stream_flush if there are still bits left to 
> be 'paged'?
> 

Yes, although an e_o_s packet in a stream will cause it to flush
on pageout anyway.

> 3.) Do I need to manually set the e_o_s of the last packet added?
> 

Yes (and b_o_s on the first one), libogg is codec agnostic; this is
how you communicate facts like {b,e}_o_s to it.

> 4.) may I call ogg_stream_init again on a already used ogg_stream_state 
> struct to reuse it?
> 

<http://www.xiph.org/ogg/doc/libogg/ogg_stream_reset.html>

> 5.) Is it possible to start decoding a ogg_stream which has not yet been 
> fully constructed iaw there are still packet's added an pageout to be 
> called on the stream?
> 
> 

Not sure what you mean: packetin->stream->pageout is the encoding
direction.  If you want to know if you can load those pages into a
different stream and start getting packets out then yes.

-- 
imalone


More information about the Vorbis-dev mailing list