examples/SFExamples/oggvorbiscodec/src/libogg/doc/ogg/ogg_sync_pageout.html

00001 <html>
00002 
00003 <head>
00004 <title>libogg - function - ogg_sync_pageout</title>
00005 <link rel=stylesheet href="style.css" type="text/css">
00006 </head>
00007 
00008 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
00009 <table border=0 width=100%>
00010 <tr>
00011 <td><p class=tiny>libogg documentation</p></td>
00012 <td align=right><p class=tiny>libogg release 1.0 - 20000615</p></td>
00013 </tr>
00014 </table>
00015 
00016 <h1>ogg_sync_pageout</h1>
00017 
00018 <p><i>declared in "ogg/ogg.h";</i></p>
00019 
00020 <p>This function takes the data stored in the buffer of the <a href="ogg_sync_state.html">ogg_sync_state</a> struct and inserts them into an <a href="ogg_page.html">ogg_page</a>.
00021 
00022 <p>In an actual decoding loop, this function should be called first to ensure that the buffer is cleared.  The example code below illustrates a clean reading loop which will fill and output pages.
00023 <p><b>Caution:</b>This function should be called before reading into the buffer to ensure that data does not remain in the ogg_sync_state struct.  Failing to do so may result in a memory leak.  See the example code below for details.
00024 
00025 <br><br>
00026 <table border=0 color=black cellspacing=0 cellpadding=7>
00027 <tr bgcolor=#cccccc>
00028         <td>
00029 <pre><b>
00030 int ogg_sync_pageout(<a href="ogg_sync_state.html">ogg_sync_state</a> *oy, <a href="ogg_page.html">ogg_page</a> *og);
00031 </b></pre>
00032         </td>
00033 </tr>
00034 </table>
00035 
00036 <h3>Parameters</h3>
00037 <dl>
00038 <dt><i>oy</i></dt>
00039 <dd>Pointer to a previously declared <a href="ogg_sync_state.html">ogg_sync_state</a> struct.  Normally, the internal storage of this struct should be filled with newly read data and verified using <a href="ogg_sync_wrote.html">ogg_sync_wrote</a>.</dd>
00040 <dt><i>og</i></dt>
00041 <dd>Pointer to page struct filled by this function.
00042 </dl>
00043 
00044 
00045 <h3>Return Values</h3>
00046 <blockquote>
00047 <li>-1 if we were not properly synced and had to skip some bytes.</li>
00048 <li>
00049 0 if we need more data to verify a page.</li>
00050 <li>
00051 1 if we have a page.</li>
00052 </blockquote>
00053 <p>
00054 
00055 <h3>Example Usage</h3>
00056 <pre>
00057 if (ogg_sync_pageout(&oy, &og) != 1) {
00058         buffer = ogg_sync_buffer(&oy, 8192);
00059         bytes = fread(buffer, 1, 8192, stdin);
00060         ogg_sync_wrote(&oy, bytes);
00061 }
00062 </pre>
00063 
00064 <br><br>
00065 <hr noshade>
00066 <table border=0 width=100%>
00067 <tr valign=top>
00068 <td><p class=tiny>copyright &copy; 2000 xiph.org</p></td>
00069 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team@xiph.org">team@xiph.org</a></p></td>
00070 </tr><tr>
00071 <td><p class=tiny>libogg documentation</p></td>
00072 <td align=right><p class=tiny>libogg release 1.0 - 20000615</p></td>
00073 </tr>
00074 </table>
00075 
00076 
00077 </body>
00078 
00079 </html>

Generated by  doxygen 1.6.2