cannam@86: <html> cannam@86: cannam@86: <head> cannam@86: <title>Vorbisfile - function - ov_fopen</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>ov_fopen</h1> cannam@86: cannam@86: <p><i>declared in "vorbis/vorbisfile.h";</i></p> cannam@86: cannam@86: <p>This is the simplest function used to open and initialize an OggVorbis_File cannam@86: structure. It sets up all the related decoding structure. cannam@86: <p>The first argument is a file path suitable cannam@86: for passing to fopen(). <tt>vf</tt> should be a pointer to an empty cannam@86: OggVorbis_File structure -- this is used for ALL the externally visible cannam@86: libvorbisfile functions. Once this has been called, the same <a cannam@86: href="OggVorbis_File.html">OggVorbis_File</a> struct should be passed cannam@86: to all the libvorbisfile functions. cannam@86: <p>The <tt>vf</tt> structure initialized using ov_fopen() must cannam@86: eventually be cleaned using <a href="ov_clear.html">ov_clear()</a>. cannam@86: cannam@86: <p> cannam@86: It is often useful to call <tt>ov_fopen()</tt> simply to determine cannam@86: whether a given file is a Vorbis bitstream. If the <tt>ov_fopen()</tt> cannam@86: call fails, then the file is either inaccessable (errno is set) or not cannam@86: recognizable as Vorbis (errno unchanged). If the call succeeds but cannam@86: the initialized <tt>vf</tt> structure will not be used, the cannam@86: application is responsible for calling <a cannam@86: href="ov_clear.html">ov_clear()</a> to clear the decoder's buffers and cannam@86: close the file.<p> cannam@86: cannam@86: <br><br> cannam@86: <table border=0 color=black cellspacing=0 cellpadding=7> cannam@86: <tr bgcolor=#cccccc> cannam@86: <td> cannam@86: <pre><b> cannam@86: int ov_fopen(char *path,<a href="OggVorbis_File.html">OggVorbis_File</a> *vf); cannam@86: </b></pre> cannam@86: </td> cannam@86: </tr> cannam@86: </table> cannam@86: cannam@86: <h3>Parameters</h3> cannam@86: <dl> cannam@86: <dt><i>path</i></dt> cannam@86: <dd>Null terminated string containing a file path suitable for passing to <tt>fopen()</tt>. cannam@86: </dd> cannam@86: <dt><i>vf</i></dt> cannam@86: <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile cannam@86: functions. Once this has been called, the same <tt>OggVorbis_File</tt> cannam@86: struct should be passed to all the libvorbisfile functions.</dd> cannam@86: </dl> cannam@86: cannam@86: cannam@86: <h3>Return Values</h3> cannam@86: <blockquote> cannam@86: <li>0 indicates success</li> cannam@86: cannam@86: <li>less than zero for failure:</li> cannam@86: <ul> cannam@86: <li>OV_EREAD - A read from media returned an error.</li> cannam@86: <li>OV_ENOTVORBIS - Bitstream does not contain any Vorbis data.</li> cannam@86: <li>OV_EVERSION - Vorbis version mismatch.</li> cannam@86: <li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li> cannam@86: <li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li> cannam@86: </ul> cannam@86: </blockquote> cannam@86: <p> cannam@86: cannam@86: <h3>Notes</h3> cannam@86: <dl> cannam@86: cannam@86: <dt><b>[a] Threaded decode</b><p> cannam@86: <dd>If your decoder is threaded, it is recommended that you NOT call cannam@86: <tt>ov_open_callbacks()</tt> cannam@86: in the main control thread--instead, call <tt>ov_open_callbacks()</tt> in your decode/playback cannam@86: thread. This is important because <tt>ov_open_callbacks()</tt> may be a fairly time-consuming cannam@86: call, given that the full structure of the file is determined at this point, cannam@86: which may require reading large parts of the file under certain circumstances cannam@86: (determining all the logical bitstreams in one physical bitstream, for cannam@86: example). See <a href="threads.html">Thread Safety</a> for other information on using libvorbisfile with threads. cannam@86: <p> cannam@86: cannam@86: <dt><b>[b] Mixed media streams</b><p> cannam@86: <dd> cannam@86: As of Vorbisfile release 1.2.0, Vorbisfile is able to access the cannam@86: Vorbis content in mixed-media Ogg streams, not just Vorbis-only cannam@86: streams. For example, Vorbisfile may be used to open and access the cannam@86: audio from an Ogg stream consisting of Theora video and Vorbis audio. cannam@86: Vorbisfile 1.2.0 decodes the first logical audio stream of each cannam@86: physical stream section.<p> cannam@86: cannam@86: <dt><b>[c] Faster testing for Vorbis files</b><p> cannam@86: <dd><a href="ov_test.html">ov_test()</a> and <a cannam@86: href="ov_test_callbacks.html">ov_test_callbacks()</a> provide less cannam@86: computationally expensive ways to test a file for Vorbisness, but cannam@86: require more setup code.<p> cannam@86: cannam@86: </dl> cannam@86: cannam@86: <br><br> cannam@86: <hr noshade> cannam@86: <table border=0 width=100%> cannam@86: <tr valign=top> cannam@86: <td><p class=tiny>copyright © 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>