ogg_sync_pageout.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <html>
  2. <head>
  3. <title>libogg - function - ogg_sync_pageout</title>
  4. <link rel=stylesheet href="style.css" type="text/css">
  5. </head>
  6. <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
  7. <table border=0 width=100%>
  8. <tr>
  9. <td><p class=tiny>libogg documentation</p></td>
  10. <td align=right><p class=tiny>libogg release 1.3.2 - 20140527</p></td>
  11. </tr>
  12. </table>
  13. <h1>ogg_sync_pageout</h1>
  14. <p><i>declared in "ogg/ogg.h";</i></p>
  15. <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>.
  16. <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.
  17. <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.
  18. <br><br>
  19. <table border=0 color=black cellspacing=0 cellpadding=7>
  20. <tr bgcolor=#cccccc>
  21. <td>
  22. <pre><b>
  23. int ogg_sync_pageout(<a href="ogg_sync_state.html">ogg_sync_state</a> *oy, <a href="ogg_page.html">ogg_page</a> *og);
  24. </b></pre>
  25. </td>
  26. </tr>
  27. </table>
  28. <h3>Parameters</h3>
  29. <dl>
  30. <dt><i>oy</i></dt>
  31. <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>
  32. <dt><i>og</i></dt>
  33. <dd>Pointer to page struct filled by this function.
  34. </dl>
  35. <h3>Return Values</h3>
  36. <blockquote>
  37. <li>-1 returned if stream has not yet captured sync (bytes were skipped).</li>
  38. <li>0 returned if more data needed or an internal error occurred.</li>
  39. <li>1 indicated a page was synced and returned.</li>
  40. </blockquote>
  41. <p>
  42. <h3>Example Usage</h3>
  43. <pre>
  44. if (ogg_sync_pageout(&oy, &og) != 1) {
  45. buffer = ogg_sync_buffer(&oy, 8192);
  46. bytes = fread(buffer, 1, 8192, stdin);
  47. ogg_sync_wrote(&oy, bytes);
  48. }
  49. </pre>
  50. <br><br>
  51. <hr noshade>
  52. <table border=0 width=100%>
  53. <tr valign=top>
  54. <td><p class=tiny>copyright &copy; 2000-2014 Xiph.Org</p></td>
  55. <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
  56. </tr><tr>
  57. <td><p class=tiny>libogg documentation</p></td>
  58. <td align=right><p class=tiny>libogg release 1.3.2 - 20140527</p></td>
  59. </tr>
  60. </table>
  61. </body>
  62. </html>