00001 <html> 00002 00003 <head> 00004 <title>Vorbisfile - Setup/Teardown</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>Vorbisfile documentation</p></td> 00012 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td> 00013 </tr> 00014 </table> 00015 00016 <H1>Setup/Teardown</h1> <p>In order to decode audio using 00017 libvorbisfile, a bitstream containing Vorbis audio must be properly 00018 initialized before decoding and cleared when decoding is finished. 00019 The simplest possible case is to use <tt>fopen()</tt> to open a Vorbis 00020 file and then pass the <tt>FILE *</tt> to an <a 00021 href="ov_open.html">ov_open()</a> call. A successful <a 00022 href="return.html">return code</a> from <a 00023 href="ov_open.html">ov_open()</a> indicates the file is ready for use. 00024 Once the file is no longer needed, <a 00025 href="ov_clear.html">ov_clear()</a> is used to close the file and 00026 deallocate decoding resources. </b>Do not</b> call <tt>fclose()</tt> on the 00027 file; libvorbisfile does this in the <a 00028 href="ov_clear.html">ov_clear()</a> call. 00029 00030 <p> 00031 All libvorbisfile initialization and deallocation routines are declared in "vorbis/vorbisfile.h". 00032 <p> 00033 00034 <table border=1 color=black width=50% cellspacing=0 cellpadding=7> 00035 <tr bgcolor=#cccccc> 00036 <td><b>function</b></td> 00037 <td><b>purpose</b></td> 00038 </tr> 00039 <tr valign=top> 00040 <td><a href="ov_open.html">ov_open</a></td> 00041 <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 00042 used.</td> 00043 </tr> 00044 <tr valign=top> 00045 <td><a href="ov_open_callbacks.html">ov_open_callbacks</a></td> 00046 <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> 00047 </tr> 00048 00049 <tr valign=top> 00050 <td><a href="ov_test.html">ov_test</a></td> 00051 00052 <td>Partially opens a file just far enough to determine if the file 00053 is an Ogg Vorbis file or not. A successful return indicates that the 00054 file appears to be an Ogg Vorbis file, but the <a 00055 href="OggVorbis_File.html">OggVorbis_File</a> struct is not yet fully 00056 initialized for actual decoding. After a <a href="return.html">successful return</a>, the file 00057 may be closed using <a href="ov_clear.html">ov_clear()</a> or fully 00058 opened for decoding using <a 00059 href="ov_test_open.html">ov_test_open()</a>.<p> This call is intended to 00060 be used as a less expensive file open test than a full <a 00061 href="ov_open.html">ov_open()</a>.<p> 00062 Note that libvorbisfile owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisfile.</td> 00063 00064 </tr> 00065 <tr valign=top> 00066 <td><a href="ov_test_callbacks.html">ov_test_callbacks</a></td> 00067 <td>As above but allowing application-define I/O callbacks.<p> 00068 Note that libvorbisfile owns the passed in file resource is it returns success; do not <tt>fclose()</tt> files owned by libvorbisfile.</td> 00069 00070 </tr> 00071 <tr valign=top> 00072 <td><a href="ov_test_open.html">ov_test_open</a><td> 00073 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> 00074 </tr> 00075 <tr valign=top> 00076 <td><a href="ov_clear.html">ov_clear</a></td> <td>Closes the 00077 bitstream and cleans up loose ends. Must be called when 00078 finished with the bitstream. After return, the <a 00079 href="OggVorbis_File.html">OggVorbis_File</a> struct is 00080 invalid and may not be used before being initialized again 00081 before begin reinitialized. 00082 00083 </td> 00084 </tr> 00085 </table> 00086 00087 <br><br> 00088 <hr noshade> 00089 <table border=0 width=100%> 00090 <tr valign=top> 00091 <td><p class=tiny>copyright © 2003 Xiph.org</p></td> 00092 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td> 00093 </tr><tr> 00094 <td><p class=tiny>Vorbisfile documentation</p></td> 00095 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td> 00096 </tr> 00097 </table> 00098 00099 </body> 00100 00101 </html>