cannam@86: <html>
cannam@86: 
cannam@86: <head>
cannam@86: <title>Vorbisfile - Setup/Teardown</title>
cannam@86: <link rel=stylesheet href="style.css" type="text/css">
cannam@86: </head>
cannam@86: 
cannam@86: <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
cannam@86: <table border=0 width=100%>
cannam@86: <tr>
cannam@86: <td><p class=tiny>Vorbisfile documentation</p></td>
cannam@86: <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
cannam@86: </tr>
cannam@86: </table>
cannam@86: 
cannam@86: <H1>Setup/Teardown</h1> <p>In order to decode audio using
cannam@86: libvorbisfile, a bitstream containing Vorbis audio must be properly
cannam@86: initialized before decoding and cleared when decoding is finished.
cannam@86: The simplest possible case is to use <a
cannam@86: href="ov_fopen.html">ov_fopen()</a> to open the file for access, check
cannam@86: it for Vorbis content, and prepare it for playback.  A successful <a
cannam@86: href="../libvorbis/return.html">return code</a> from <a
cannam@86: href="ov_fopen.html">ov_fopen()</a> indicates the file is ready for use.
cannam@86: Once the file is no longer needed, <a
cannam@86: href="ov_clear.html">ov_clear()</a> is used to close the file and
cannam@86: deallocate decoding resources.<p>
cannam@86: 
cannam@86: On systems other than Windows<a href="ov_open.html#winfoot">[a]</a>, an
cannam@86: application may also open a file itself using <tt>fopen()</tt>, then pass the
cannam@86: <tt>FILE *</tt> to libvorbisfile using <a
cannam@86: href="ov_open.html">ov_open()</a>. </b>Do not</b> call
cannam@86: <tt>fclose()</tt> on a file handle successfully submitted to <a
cannam@86: href="ov_open.html">ov_open()</a>; libvorbisfile does this in the <a
cannam@86: href="ov_clear.html">ov_clear()</a> call.<p>
cannam@86: 
cannam@86: An application that requires more setup flexibility may open a data
cannam@86: stream using <a href="ov_open_callbacks.html">ov_open_callbacks()</a>
cannam@86: to change default libvorbis behavior or specify non-stdio data access
cannam@86: mechanisms.<p>
cannam@86: 
cannam@86: <p>
cannam@86: All libvorbisfile initialization and deallocation routines are declared in "vorbis/vorbisfile.h".
cannam@86: <p>
cannam@86: 
cannam@86: <table border=1 color=black width=50% cellspacing=0 cellpadding=7>
cannam@86: <tr bgcolor=#cccccc>
cannam@86: 	<td><b>function</b></td>
cannam@86: 	<td><b>purpose</b></td>
cannam@86: </tr>
cannam@86: <tr valign=top>
cannam@86: 	<td><a href="ov_fopen.html">ov_fopen</a></td>
cannam@86: 	<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
cannam@86: 	used.</td>
cannam@86: </tr>
cannam@86: <tr valign=top>
cannam@86: 	<td><a href="ov_open.html">ov_open</a></td>
cannam@86: 	<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
cannam@86: 	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>
cannam@86: </tr>
cannam@86: <tr valign=top>
cannam@86: 	<td><a href="ov_open_callbacks.html">ov_open_callbacks</a></td>
cannam@86: 	<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>
cannam@86: </tr>
cannam@86: 
cannam@86: <tr valign=top>
cannam@86: <td><a href="ov_test.html">ov_test</a></td> 
cannam@86: 
cannam@86: <td>Partially opens a file just far enough to determine if the file
cannam@86: is an Ogg Vorbis file or not.  A successful return indicates that the
cannam@86: file appears to be an Ogg Vorbis file, but the <a
cannam@86: href="OggVorbis_File.html">OggVorbis_File</a> struct is not yet fully
cannam@86: initialized for actual decoding.  After a <a href="../libvorbis/return.html">successful return</a>, the file
cannam@86: may be closed using <a href="ov_clear.html">ov_clear()</a> or fully
cannam@86: opened for decoding using <a
cannam@86: href="ov_test_open.html">ov_test_open()</a>.<p> This call is intended to
cannam@86: be used as a less expensive file open test than a full <a
cannam@86: href="ov_open.html">ov_open()</a>.<p>
cannam@86: Note that libvorbisfile owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisfile.</td>
cannam@86: 
cannam@86: </tr>
cannam@86: <tr valign=top>
cannam@86: <td><a href="ov_test_callbacks.html">ov_test_callbacks</a></td>
cannam@86: <td>As above but allowing application-define I/O callbacks.<p>
cannam@86: Note that libvorbisfile owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisfile.</td>
cannam@86: 
cannam@86: </tr>
cannam@86: <tr valign=top>
cannam@86: <td><a href="ov_test_open.html">ov_test_open</a><td>
cannam@86: 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>
cannam@86: </tr>
cannam@86: <tr valign=top>
cannam@86: 	<td><a href="ov_clear.html">ov_clear</a></td> <td>Closes the
cannam@86: 	bitstream and cleans up loose ends.  Must be called when
cannam@86: 	finished with the bitstream.  After return, the <a
cannam@86: 	href="OggVorbis_File.html">OggVorbis_File</a> struct is
cannam@86: 	invalid and may not be used before being initialized again
cannam@86: 	before begin reinitialized.
cannam@86: 
cannam@86: </td>
cannam@86: </tr>
cannam@86: </table>
cannam@86: 
cannam@86: <br><br>
cannam@86: <hr noshade>
cannam@86: 
cannam@86: <table border=0 width=100%>
cannam@86: <tr valign=top>
cannam@86: <td><p class=tiny>copyright &copy; 2000-2010 Xiph.Org</p></td>
cannam@86: <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
cannam@86: </tr><tr>
cannam@86: <td><p class=tiny>Vorbisfile documentation</p></td>
cannam@86: <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
cannam@86: </tr>
cannam@86: </table>
cannam@86: 
cannam@86: </body>
cannam@86: 
cannam@86: </html>