<html> <head> <title>Tremor - Setup/Teardown</title> <link rel=stylesheet href="style.css" type="text/css"> </head> <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff"> <table border=0 width=100%> <tr> <td><p class=tiny>Tremor documentation</p></td> <td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td> </tr> </table> <H1>Setup/Teardown</h1> <p>In order to decode audio using libvorbisidec, a bitstream containing Vorbis audio must be properly initialized before decoding and cleared when decoding is finished. The simplest possible case is to use <tt>fopen()</tt> to open a Vorbis file and then pass the <tt>FILE *</tt> to an <a href="ov_open.html">ov_open()</a> call. A successful <a href="return.html">return code</a> from <a href="ov_open.html">ov_open()</a> indicates the file is ready for use. Once the file is no longer needed, <a href="ov_clear.html">ov_clear()</a> is used to close the file and deallocate decoding resources. </b>Do not</b> call <tt>fclose()</tt> on the file; libvorbisidec does this in the <a href="ov_clear.html">ov_clear()</a> call. <p> All libvorbisidec initialization and deallocation routines are declared in "ivorbisfile.h". <p> <table border=1 color=black width=50% cellspacing=0 cellpadding=7> <tr bgcolor=#cccccc> <td><b>function</b></td> <td><b>purpose</b></td> </tr> <tr valign=top> <td><a href="ov_open.html">ov_open</a></td> <td>Initializes the Ogg Vorbis bitstream with a pointer to a bitstream and default values. This must be called before other functions in the library may be used.</td> </tr> <tr valign=top> <td><a href="ov_open_callbacks.html">ov_open_callbacks</a></td> <td>Initializes the Ogg Vorbis bitstream with a pointer to a bitstream, default values, and custom file/bitstream manipulation routines. Used instead of <a href="ov_open.html">ov_open()</a> when working with other than stdio based I/O.</td> </tr> <tr valign=top> <td><a href="ov_test.html">ov_test</a></td> <td>Partially opens a file just far enough to determine if the file is an Ogg Vorbis file or not. A successful return indicates that the file appears to be an Ogg Vorbis file, but the <a href="OggVorbis_File.html">OggVorbis_File</a> struct is not yet fully initialized for actual decoding. After a <a href="return.html">successful return</a>, the file may be closed using <a href="ov_clear.html">ov_clear()</a> or fully opened for decoding using <a href="ov_test_open.html">ov_test_open()</a>.<p> This call is intended to be used as a less expensive file open test than a full <a href="ov_open.html">ov_open()</a>.<p> Note that libvorbisidec owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisidec.</td> </tr> <tr valign=top> <td><a href="ov_test_callbacks.html">ov_test_callbacks</a></td> <td>As above but allowing application-define I/O callbacks.<p> Note that libvorbisidec owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisidec.</td> </tr> <tr valign=top> <td><a href="ov_test_open.html">ov_test_open</a><td> 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> </tr> <tr valign=top> <td><a href="ov_clear.html">ov_clear</a></td> <td>Closes the bitstream and cleans up loose ends. Must be called when finished with the bitstream. After return, the <a href="OggVorbis_File.html">OggVorbis_File</a> struct is invalid and may not be used before being initialized again before begin reinitialized. </td> </tr> </table> <br><br> <hr noshade> <table border=0 width=100%> <tr valign=top> <td><p class=tiny>copyright © 2002 Xiph.org</p></td> <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td> </tr><tr> <td><p class=tiny>Tremor documentation</p></td> <td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td> </tr> </table> </body> </html>