libogg documentation | libogg release 1.3.1 - 20130512

# 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_iovecin | iovec version of ogg_stream_packetin() above.
ogg_stream_pageout | Outputs a completed page if the stream contains enough packets to form a full page. |
ogg_stream_pageout_fill | Similar to ogg_stream_pageout(), but specifies a page spill threshold in bytes.
ogg_stream_flush | Forces any remaining packets in the stream to be returned as a page of any size. |
ogg_stream_flush_fill | Similar to ogg_stream_flush(), but specifies a page spill threshold in bytes. |

copyright © 2000-2013 Xiph.Org | Ogg Container Format
libogg documentation | libogg release 1.3.1 - 20130512