[Vorbis-dev] ogg only encoding

Ralph Giles giles at xiph.org
Mon Jun 5 18:52:22 PDT 2006


On Mon, Jun 05, 2006 at 09:34:43PM -0400, Stephen Whiters-Ridley wrote:

> Am I crazy or does libogg
> rely on libvorbis to return ogg_packets, and that there are no functions
> that will build an ogg_packet for you from
> your own data like an array of bytes? It looks like API users are required
> to fill in all the meta
> fields of the ogg_packet themselves? Is this correct?

Yes, you have to fill in the metadata yourself, and a pointer to the 
packet body data to be framed. I'm confused as to how else you were
expecting to do it?

More specifically, you fill out the (ogg_packet)this.packet field with a 
pointer to your data array and then ogg_stream_packetin() will memcpy 
that buffer into internal storage (in libogg anyway, libogg2 allows for 
submitting a release callback.)

The Vorbis and Theora reference encoders do return (or rather fill out) 
an ogg_packet structure for you, so it is very convenient to submit this 
to libogg. Of course you'll have to do this yourself if you're getting 
the data from somewhere else.

Hope that helps?

 -r


More information about the Vorbis-dev mailing list