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