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