ov_fopen.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <html>
  2. <head>
  3. <title>Vorbisfile - function - ov_fopen</title>
  4. <link rel=stylesheet href="style.css" type="text/css">
  5. </head>
  6. <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
  7. <table border=0 width=100%>
  8. <tr>
  9. <td><p class=tiny>Vorbisfile documentation</p></td>
  10. <td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
  11. </tr>
  12. </table>
  13. <h1>ov_fopen</h1>
  14. <p><i>declared in "vorbis/vorbisfile.h";</i></p>
  15. <p>This is the simplest function used to open and initialize an OggVorbis_File
  16. structure. It sets up all the related decoding structure.
  17. <p>The first argument is a file path suitable
  18. for passing to fopen(). <tt>vf</tt> should be a pointer to an empty
  19. OggVorbis_File structure -- this is used for ALL the externally visible
  20. libvorbisfile functions. Once this has been called, the same <a
  21. href="OggVorbis_File.html">OggVorbis_File</a> struct should be passed
  22. to all the libvorbisfile functions.
  23. <p>The <tt>vf</tt> structure initialized using ov_fopen() must
  24. eventually be cleaned using <a href="ov_clear.html">ov_clear()</a>.
  25. <p>
  26. It is often useful to call <tt>ov_fopen()</tt> simply to determine
  27. whether a given file is a Vorbis bitstream. If the <tt>ov_fopen()</tt>
  28. call fails, then the file is either inaccessable (errno is set) or not
  29. recognizable as Vorbis (errno unchanged). If the call succeeds but
  30. the initialized <tt>vf</tt> structure will not be used, the
  31. application is responsible for calling <a
  32. href="ov_clear.html">ov_clear()</a> to clear the decoder's buffers and
  33. close the file.<p>
  34. <br><br>
  35. <table border=0 color=black cellspacing=0 cellpadding=7>
  36. <tr bgcolor=#cccccc>
  37. <td>
  38. <pre><b>
  39. int ov_fopen(char *path,<a href="OggVorbis_File.html">OggVorbis_File</a> *vf);
  40. </b></pre>
  41. </td>
  42. </tr>
  43. </table>
  44. <h3>Parameters</h3>
  45. <dl>
  46. <dt><i>path</i></dt>
  47. <dd>Null terminated string containing a file path suitable for passing to <tt>fopen()</tt>.
  48. </dd>
  49. <dt><i>vf</i></dt>
  50. <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile
  51. functions. Once this has been called, the same <tt>OggVorbis_File</tt>
  52. struct should be passed to all the libvorbisfile functions.</dd>
  53. </dl>
  54. <h3>Return Values</h3>
  55. <blockquote>
  56. <li>0 indicates success</li>
  57. <li>less than zero for failure:</li>
  58. <ul>
  59. <li>OV_EREAD - A read from media returned an error.</li>
  60. <li>OV_ENOTVORBIS - Bitstream does not contain any Vorbis data.</li>
  61. <li>OV_EVERSION - Vorbis version mismatch.</li>
  62. <li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
  63. <li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
  64. </ul>
  65. </blockquote>
  66. <p>
  67. <h3>Notes</h3>
  68. <dl>
  69. <dt><b>[a] Threaded decode</b><p>
  70. <dd>If your decoder is threaded, it is recommended that you NOT call
  71. <tt>ov_open_callbacks()</tt>
  72. in the main control thread--instead, call <tt>ov_open_callbacks()</tt> in your decode/playback
  73. thread. This is important because <tt>ov_open_callbacks()</tt> may be a fairly time-consuming
  74. call, given that the full structure of the file is determined at this point,
  75. which may require reading large parts of the file under certain circumstances
  76. (determining all the logical bitstreams in one physical bitstream, for
  77. example). See <a href="threads.html">Thread Safety</a> for other information on using libvorbisfile with threads.
  78. <p>
  79. <dt><b>[b] Mixed media streams</b><p>
  80. <dd>
  81. As of Vorbisfile release 1.2.0, Vorbisfile is able to access the
  82. Vorbis content in mixed-media Ogg streams, not just Vorbis-only
  83. streams. For example, Vorbisfile may be used to open and access the
  84. audio from an Ogg stream consisting of Theora video and Vorbis audio.
  85. Vorbisfile 1.2.0 decodes the first logical audio stream of each
  86. physical stream section.<p>
  87. <dt><b>[c] Faster testing for Vorbis files</b><p>
  88. <dd><a href="ov_test.html">ov_test()</a> and <a
  89. href="ov_test_callbacks.html">ov_test_callbacks()</a> provide less
  90. computationally expensive ways to test a file for Vorbisness, but
  91. require more setup code.<p>
  92. </dl>
  93. <br><br>
  94. <hr noshade>
  95. <table border=0 width=100%>
  96. <tr valign=top>
  97. <td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
  98. <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
  99. </tr><tr>
  100. <td><p class=tiny>Vorbisfile documentation</p></td>
  101. <td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
  102. </tr>
  103. </table>
  104. </body>
  105. </html>