libogg documentation | libogg release 1.0 - 20000615

# Encoding

Libogg contains a set of functions used in the encoding process.

All the libogg specific functions are declared in "ogg/ogg.h".

When encoding, the encoding engine will output raw packets which must be placed into an Ogg bitstream.

Raw packets are inserted into the stream, and an ogg_page is output when enough packets have been written to create a full page. The pages output are pointers to buffered packet segments, and can then be written out and saved as an ogg stream.

There are a couple of basic steps:

- Use the encoding engine to produce a raw packet of data.
- Call ogg_stream_packetin to submit a raw packet to the stream.
- Use ogg_stream_pageout to output a page, if enough data has been submitted. Otherwise, continue submitting data.

function | purpose
ogg_stream_packetin | Submits a raw packet to the streaming layer, so that it can be formed into a page.
ogg_stream_pageout | Outputs a completed page if the stream contains enough packets to form a full page. |
ogg_stream_flush | Forces any remaining packets in the stream to be returned as a page of any size. |

copyright © 2000 xiph.org | Ogg Vorbis team@xiph.org
libogg documentation | libogg release 1.0 - 20000615