examples/sfexamples/oggvorbiscodec/src/tremor/doc/ov_open.html

00001 <html>
00002 
00003 <head>
00004 <title>Tremor - function - ov_open</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>Tremor documentation</p></td>
00012 <td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
00013 </tr>
00014 </table>
00015 
00016 <h1>ov_open</h1>
00017 
00018 <p><i>declared in "ivorbisfile.h";</i></p>
00019 
00020 <p>This is the main function used to open and initialize an OggVorbis_File
00021 structure. It sets up all the related decoding structure.
00022 <p>The first argument must be a file pointer to an already opened file
00023 or pipe (it need not be seekable--though this obviously restricts what
00024 can be done with the bitstream). <tt>vf</tt> should be a pointer to the
00025 OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
00026 functions. Once this has been called, the same <a href="OggVorbis_File.html">OggVorbis_File</a>
00027 struct should be passed to all the libvorbisidec functions.
00028 <p>Also, you should be aware that ov_open(), once successful, takes complete possession of the file resource.  After you have opened a file using ov_open(), you MUST close it using <a href="ov_clear.html">ov_clear()</a>, not fclose() or any other function.
00029 <p>
00030 It is often useful to call <tt>ov_open()</tt>
00031 simply to determine whether a given file is a vorbis bitstream. If the
00032 <tt>ov_open()</tt>
00033 call fails, then the file is not recognizable as such. 
00034 When you use <tt>ov_open()
00035 </tt>for
00036 this, you should <tt>fclose()</tt> the file pointer if, and only if, the
00037 <tt>ov_open()</tt>
00038 call fails. If it succeeds, you must call <a href="ov_clear.html">ov_clear()</a> to clear
00039 the decoder's buffers and close the file for you.<p>
00040 
00041 (Note that <a href="ov_test.html">ov_test()</a> provides a less expensive way to test a file for Vorbisness.)<p>
00042 
00043 <br><br>
00044 <table border=0 color=black cellspacing=0 cellpadding=7>
00045 <tr bgcolor=#cccccc>
00046         <td>
00047 <pre><b>
00048 int ov_open(FILE *f,<a href="OggVorbis_File.html">OggVorbis_File</a> *vf,char *initial,long ibytes);
00049 </b></pre>
00050         </td>
00051 </tr>
00052 </table>
00053 
00054 <h3>Parameters</h3>
00055 <dl>
00056 <dt><i>f</i></dt>
00057 <dd>File pointer to an already opened file
00058 or pipe (it need not be seekable--though this obviously restricts what
00059 can be done with the bitstream).</dd>
00060 <dt><i>vf</i></dt>
00061 <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
00062 functions. Once this has been called, the same <tt>OggVorbis_File</tt>
00063 struct should be passed to all the libvorbisidec functions.</dd>
00064 <dt><i>initial</i></dt>
00065 <dd>Typically set to NULL.  This parameter is useful if some data has already been
00066 read from the file and the stream is not seekable. It is used in conjunction with <tt>ibytes</tt>.  In this case, <tt>initial</tt>
00067 should be a pointer to a buffer containing the data read.</dd>
00068 <dt><i>ibytes</i></dt>
00069 <dd>Typically set to 0.  This parameter is useful if some data has already been
00070 read from the file and the stream is not seekable. In this case, <tt>ibytes</tt>
00071 should contain the length (in bytes) of the buffer.  Used together with <tt>initial</tt></dd>
00072 </dl>
00073 
00074 
00075 <h3>Return Values</h3>
00076 <blockquote>
00077 <li>0 indicates success</li>
00078 
00079 <li>less than zero for failure:</li>
00080 <ul>
00081 <li>OV_EREAD - A read from media returned an error.</li>
00082 <li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
00083 <li>OV_EVERSION - Vorbis version mismatch.</li>
00084 <li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
00085 <li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
00086 </ul>
00087 </blockquote>
00088 <p>
00089 
00090 <h3>Notes</h3>
00091 <p>If your decoder is threaded, it is recommended that you NOT call
00092 <tt>ov_open()</tt>
00093 in the main control thread--instead, call <tt>ov_open()</tt> IN your decode/playback
00094 thread. This is important because <tt>ov_open()</tt> may be a fairly time-consuming
00095 call, given that the full structure of the file is determined at this point,
00096 which may require reading large parts of the file under certain circumstances
00097 (determining all the logical bitstreams in one physical bitstream, for
00098 example).  See <a href="threads.html">Thread Safety</a> for other information on using libvorbisidec with threads.
00099 
00100 
00101 <br><br>
00102 <hr noshade>
00103 <table border=0 width=100%>
00104 <tr valign=top>
00105 <td><p class=tiny>copyright &copy; 2002 Xiph.org</p></td>
00106 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
00107 </tr><tr>
00108 <td><p class=tiny>Tremor documentation</p></td>
00109 <td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
00110 </tr>
00111 </table>
00112 
00113 </body>
00114 
00115 </html>

Generated by  doxygen 1.6.2