initialization.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <html>
  2. <head>
  3. <title>Vorbisfile - Setup/Teardown</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>Vorbisfile documentation</p></td>
  10. <td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
  11. </tr>
  12. </table>
  13. <H1>Setup/Teardown</h1> <p>In order to decode audio using
  14. libvorbisfile, a bitstream containing Vorbis audio must be properly
  15. initialized before decoding and cleared when decoding is finished.
  16. The simplest possible case is to use <a
  17. href="ov_fopen.html">ov_fopen()</a> to open the file for access, check
  18. it for Vorbis content, and prepare it for playback. A successful <a
  19. href="return.html">return code</a> from <a
  20. href="ov_fopen.html">ov_fopen()</a> indicates the file is ready for use.
  21. Once the file is no longer needed, <a
  22. href="ov_clear.html">ov_clear()</a> is used to close the file and
  23. deallocate decoding resources.<p>
  24. On systems other than Windows<a href="ov_open.html#winfoot">[a]</a>, an
  25. application may also open a file itself using <tt>fopen()</tt>, then pass the
  26. <tt>FILE *</tt> to libvorbisfile using <a
  27. href="ov_open.html">ov_open()</a>. </b>Do not</b> call
  28. <tt>fclose()</tt> on a file handle successfully submitted to <a
  29. href="ov_open.html">ov_open()</a>; libvorbisfile does this in the <a
  30. href="ov_clear.html">ov_clear()</a> call.<p>
  31. An application that requires more setup flexibility may open a data
  32. stream using <a href="ov_open_callbacks.html">ov_open_callbacks()</a>
  33. to change default libvorbis behavior or specify non-stdio data access
  34. mechanisms.<p>
  35. <p>
  36. All libvorbisfile initialization and deallocation routines are declared in "vorbis/vorbisfile.h".
  37. <p>
  38. <table border=1 color=black width=50% cellspacing=0 cellpadding=7>
  39. <tr bgcolor=#cccccc>
  40. <td><b>function</b></td>
  41. <td><b>purpose</b></td>
  42. </tr>
  43. <tr valign=top>
  44. <td><a href="ov_fopen.html">ov_fopen</a></td>
  45. <td>Opens a file and initializes the Ogg Vorbis bitstream with default values. This must be called before other functions in the library may be
  46. used.</td>
  47. </tr>
  48. <tr valign=top>
  49. <td><a href="ov_open.html">ov_open</a></td>
  50. <td>Initializes the Ogg Vorbis bitstream with default values from a passed in file handle. This must be called before other functions in the library may be
  51. used. <a href="#winfoot"><em>Do not use this call under Windows [a];</em></a> Use <a href="ov_fopen.html">ov_fopen()</a> or <a href="ov_open_callbacks.html">ov_open_callbacks()</a> instead.</td>
  52. </tr>
  53. <tr valign=top>
  54. <td><a href="ov_open_callbacks.html">ov_open_callbacks</a></td>
  55. <td>Initializes the Ogg Vorbis bitstream from a file handle and custom file/bitstream manipulation routines. Used instead of <a href="ov_open.html">ov_open()</a> or <a href="ov_fopen.html">ov_fopen()</a> when altering or replacing libvorbis's default stdio I/O behavior, or when a bitstream must be initialized from a <tt>FILE *</tt> under Windows.</td>
  56. </tr>
  57. <tr valign=top>
  58. <td><a href="ov_test.html">ov_test</a></td>
  59. <td>Partially opens a file just far enough to determine if the file
  60. is an Ogg Vorbis file or not. A successful return indicates that the
  61. file appears to be an Ogg Vorbis file, but the <a
  62. href="OggVorbis_File.html">OggVorbis_File</a> struct is not yet fully
  63. initialized for actual decoding. After a <a href="return.html">successful return</a>, the file
  64. may be closed using <a href="ov_clear.html">ov_clear()</a> or fully
  65. opened for decoding using <a
  66. href="ov_test_open.html">ov_test_open()</a>.<p> This call is intended to
  67. be used as a less expensive file open test than a full <a
  68. href="ov_open.html">ov_open()</a>.<p>
  69. Note that libvorbisfile owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisfile.</td>
  70. </tr>
  71. <tr valign=top>
  72. <td><a href="ov_test_callbacks.html">ov_test_callbacks</a></td>
  73. <td>As above but allowing application-define I/O callbacks.<p>
  74. Note that libvorbisfile owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisfile.</td>
  75. </tr>
  76. <tr valign=top>
  77. <td><a href="ov_test_open.html">ov_test_open</a><td>
  78. Finish opening a file after a successful call to <a href="ov_test.html">ov_test()</a> or <a href="ov_test_callbacks.html">ov_test_callbacks()</a>.</td>
  79. </tr>
  80. <tr valign=top>
  81. <td><a href="ov_clear.html">ov_clear</a></td> <td>Closes the
  82. bitstream and cleans up loose ends. Must be called when
  83. finished with the bitstream. After return, the <a
  84. href="OggVorbis_File.html">OggVorbis_File</a> struct is
  85. invalid and may not be used before being initialized again
  86. before begin reinitialized.
  87. </td>
  88. </tr>
  89. </table>
  90. <br><br>
  91. <hr noshade>
  92. <table border=0 width=100%>
  93. <tr valign=top>
  94. <td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
  95. <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
  96. </tr><tr>
  97. <td><p class=tiny>Vorbisfile documentation</p></td>
  98. <td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
  99. </tr>
  100. </table>
  101. </body>
  102. </html>