ov_open_callbacks.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <html>
  2. <head>
  3. <title>Tremor - function - ov_open_callbacks</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>Tremor documentation</p></td>
  10. <td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
  11. </tr>
  12. </table>
  13. <h1>ov_open_callbacks</h1>
  14. <p><i>declared in "ivorbisfile.h";</i></p>
  15. <p>This is an alternative function used to open and initialize an OggVorbis_File
  16. 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.
  17. <p>Once this has been called, the same <tt>OggVorbis_File</tt>
  18. struct should be passed to all the libvorbisidec functions.
  19. <p>
  20. It is often useful to call <tt>ov_open_callbacks()</tt>
  21. simply to determine whether a given file is a vorbis bitstream. If the
  22. <tt>ov_open_callbacks()</tt>
  23. call fails, then the file is not recognizable as such. When you use <tt>ov_open_callbacks()
  24. </tt>for
  25. this, you should <tt>fclose()</tt> the file pointer if, and only if, the
  26. <tt>ov_open_callbacks()</tt>
  27. call fails. If it succeeds, you must call <a href=ov_clear.html>ov_clear()</a> to clear
  28. the decoder's buffers and close the file for you.<p>
  29. See also <a href="callbacks.html">Callbacks and Non-stdio I/O</a> for information on designing and specifying the required callback functions.<p>
  30. <br><br>
  31. <table border=0 color=black cellspacing=0 cellpadding=7>
  32. <tr bgcolor=#cccccc>
  33. <td>
  34. <pre><b>
  35. 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);
  36. </b></pre>
  37. </td>
  38. </tr>
  39. </table>
  40. <h3>Parameters</h3>
  41. <dl>
  42. <dt><i>f</i></dt>
  43. <dd>File pointer to an already opened file
  44. or pipe (it need not be seekable--though this obviously restricts what
  45. can be done with the bitstream).</dd>
  46. <dt><i>vf</i></dt>
  47. <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
  48. functions. Once this has been called, the same <tt>OggVorbis_File</tt>
  49. struct should be passed to all the libvorbisidec functions.</dd>
  50. <dt><i>initial</i></dt>
  51. <dd>Typically set to NULL. This parameter is useful if some data has already been
  52. 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>
  53. should be a pointer to a buffer containing the data read.</dd>
  54. <dt><i>ibytes</i></dt>
  55. <dd>Typically set to 0. This parameter is useful if some data has already been
  56. read from the file and the stream is not seekable. In this case, <tt>ibytes</tt>
  57. should contain the length (in bytes) of the buffer. Used together with <tt>initial</tt>.</dd>
  58. <dt><i>callbacks</i></dt>
  59. <dd>Pointer to a completed <a href="ov_callbacks.html">ov_callbacks</a> struct which indicates desired custom file manipulation routines.</dd>
  60. </dl>
  61. <h3>Return Values</h3>
  62. <blockquote>
  63. <li>0 for success</li>
  64. <li>less than zero for failure:</li>
  65. <ul>
  66. <li>OV_EREAD - A read from media returned an error.</li>
  67. <li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
  68. <li>OV_EVERSION - Vorbis version mismatch.</li>
  69. <li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
  70. <li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
  71. </ul>
  72. </blockquote>
  73. <p>
  74. <h3>Notes</h3>
  75. <p>If your decoder is threaded, it is recommended that you NOT call
  76. <tt>ov_open_callbacks()</tt>
  77. in the main control thread--instead, call <tt>ov_open_callbacks()</tt> IN your decode/playback
  78. thread. This is important because <tt>ov_open_callbacks()</tt> may be a fairly time-consuming
  79. call, given that the full structure of the file is determined at this point,
  80. which may require reading large parts of the file under certain circumstances
  81. (determining all the logical bitstreams in one physical bitstream, for
  82. example).
  83. See <a href="threads.html">Thread Safety</a> for other information on using libvorbisidec with threads.
  84. <br><br>
  85. <hr noshade>
  86. <table border=0 width=100%>
  87. <tr valign=top>
  88. <td><p class=tiny>copyright &copy; 2002 Xiph.org</p></td>
  89. <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
  90. </tr><tr>
  91. <td><p class=tiny>Tremor documentation</p></td>
  92. <td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
  93. </tr>
  94. </table>
  95. </body>
  96. </html>