1<html> 2 3<head> 4<title>libogg - Decoding</title> 5<link rel=stylesheet href="style.css" type="text/css"> 6</head> 7 8<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff"> 9<table border=0 width=100%> 10<tr> 11<td><p class=tiny>libogg documentation</p></td> 12<td align=right><p class=tiny>libogg release 1.2.0 - 20100325</p></td> 13</tr> 14</table> 15 16<h1>Decoding</h1> 17<p>Libogg contains a set of functions used in the decoding process. 18<p> 19All the <b>libogg</b> specific functions are declared in "ogg/ogg.h". 20<p> 21<p>Decoding is based around the ogg synchronization layer. The <a href="ogg_sync_state.html">ogg_sync_state</a> struct coordinates between incoming data and the decoder. We read data into the synchronization layer, submit the data to the stream, and output raw packets to the decoder. 22<p>Decoding through the Ogg layer follows a specific logical sequence. A read loop follows these logical steps: 23<ul> 24<li>Expose a buffer using <a href="ogg_sync_buffer.html">ogg_sync_buffer()</a>. 25<li>Read data into the buffer, using fread() or a similar function. 26<li>Call <a href="ogg_sync_wrote.html">ogg_sync_wrote()</a> to tell the synchronization layer how many bytes you wrote into the buffer. 27<li>Write out the data using <a href="ogg_sync_pageout.html">ogg_sync_pageout</a>. 28<li>Submit the completed page to the streaming layer with <a href="ogg_stream_pagein.html">ogg_stream_pagein</a>. 29<li>Output a packet of data to the codec-specific decoding layer using <a href="ogg_stream_packetout.html">ogg_stream_packetout</a>. 30</ul> 31<p>In practice, streams are more complex, and Ogg also must handle headers, incomplete or dropped pages, and other errors in input. 32<br><br> 33 34<table border=1 color=black width=50% cellspacing=0 cellpadding=7> 35<tr bgcolor=#cccccc> 36 <td><b>function</b></td> 37 <td><b>purpose</b></td> 38</tr> 39<tr valign=top> 40<td><a href="ogg_sync_init.html">ogg_sync_init</a></td> 41 <td>Initializes an Ogg bitstream.</td> 42</tr> 43<tr valign=top> 44<td><a href="ogg_sync_clear.html">ogg_sync_clear</a></td> 45 <td>Clears the status information from the synchronization struct.<td> 46</tr> 47<tr valign=top> 48<td><a href="ogg_sync_reset.html">ogg_sync_reset</a></td> 49 <td>Resets the synchronization status to initial values.</td> 50</tr> 51<tr valign=top> 52<td><a href="ogg_sync_destroy.html">ogg_sync_destroy</a></td> 53 <td>Frees the synchronization struct.</td> 54</tr> 55<tr valign=top> 56<td><a href="ogg_sync_check.html">ogg_sync_check</a></td> 57 <td>Check for asynchronous errors.</td> 58</tr> 59<tr valign=top> 60<td><a href="ogg_sync_buffer.html">ogg_sync_buffer</a></td> 61 <td>Exposes a buffer from the synchronization layer in order to read data.</td> 62</tr> 63<tr valign=top> 64<td><a href="ogg_sync_wrote.html">ogg_sync_wrote</a></td> 65 <td>Tells the synchronization layer how many bytes were written into the buffer.</td> 66</tr> 67<tr valign=top> 68<td><a href="ogg_sync_pageseek.html">ogg_sync_pageseek</a></td> 69 <td>Finds the borders of pages and resynchronizes the stream.</td> 70</tr> 71<tr valign=top> 72<td><a href="ogg_sync_pageout.html">ogg_sync_pageout</a></td> 73 <td>Outputs a page from the synchronization layer.</td> 74</tr> 75<tr valign=top> 76<td><a href="ogg_stream_pagein.html">ogg_stream_pagein</a></td> 77 <td>Submits a complete page to the stream layer.</td> 78</tr> 79<tr valign=top> 80<td><a href="ogg_stream_packetout.html">ogg_stream_packetout</a></td> 81 <td>Outputs a packet to the codec-specific decoding engine.</td> 82</tr> 83<tr valign=top> 84<td><a href="ogg_stream_packetpeek.html">ogg_stream_packetpeek</a></td> 85 <td>Provides access to the next packet in the bitstream without 86advancing decoding.</td> 87</tr> 88</table> 89 90<br><br> 91<hr noshade> 92<table border=0 width=100%> 93<tr valign=top> 94<td><p class=tiny>copyright © 2000-2010 Xiph.Org</p></td> 95<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td> 96</tr><tr> 97<td><p class=tiny>libogg documentation</p></td> 98<td align=right><p class=tiny>libogg release 1.2.0 - 20100325</p></td> 99</tr> 100</table> 101 102</body> 103 104</html> 105