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