ov_read.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <html>
  2. <head>
  3. <title>Tremor - function - ov_read</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_read()</h1>
  14. <p><i>declared in "ivorbisfile.h";</i></p>
  15. <p>
  16. This is the main function used to decode a Vorbis file within a
  17. loop. It returns up to the specified number of bytes of decoded audio
  18. in host-endian, signed 16 bit PCM format. If the audio is
  19. multichannel, the channels are interleaved in the output buffer.
  20. If the passed in buffer is large, <tt>ov_read()</tt> will not fill
  21. it; the passed in buffer size is treated as a <em>limit</em> and
  22. not a request.
  23. <p>
  24. Note that up to this point, the Tremor API could more or less hide the
  25. multiple logical bitstream nature of chaining from the toplevel
  26. application if the toplevel application didn't particularly care.
  27. However, when reading audio back, the application must be aware
  28. that multiple bitstream sections do not necessarily use the same
  29. number of channels or sampling rate. <p> <tt>ov_read()</tt> passes
  30. back the index of the sequential logical bitstream currently being
  31. decoded (in <tt>*bitstream</tt>) along with the PCM data in order
  32. that the toplevel application can handle channel and/or sample
  33. rate changes. This number will be incremented at chaining
  34. boundaries even for non-seekable streams. For seekable streams, it
  35. represents the actual chaining index within the physical bitstream.
  36. <p>
  37. <br><br>
  38. <table border=0 color=black cellspacing=0 cellpadding=7>
  39. <tr bgcolor=#cccccc>
  40. <td>
  41. <pre><b>
  42. long ov_read(<a href="OggVorbis_File.html">OggVorbis_File</a> *vf, char *buffer, int length, int *bitstream);
  43. </b></pre>
  44. </td>
  45. </tr>
  46. </table>
  47. <h3>Parameters</h3>
  48. <dl>
  49. <dt><i>vf</i></dt>
  50. <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec
  51. functions.</dd>
  52. <dt><i>buffer</i></dt>
  53. <dd>A pointer to an output buffer. The decoded output is inserted into this buffer.</dd>
  54. <dt><i>length</i></dt>
  55. <dd>Number of bytes to be read into the buffer. Should be the same size as the buffer. A typical value is 4096.</dd>
  56. <dt><i>bitstream</i></dt>
  57. <dd>A pointer to the number of the current logical bitstream.</dd>
  58. </dl>
  59. <h3>Return Values</h3>
  60. <blockquote>
  61. <dl>
  62. <dt>OV_HOLE</dt>
  63. <dd>indicates there was an interruption in the data.
  64. <br>(one of: garbage between pages, loss of sync followed by
  65. recapture, or a corrupt page)</dd>
  66. <dt>OV_EBADLINK</dt>
  67. <dd>indicates that an invalid stream section was supplied to
  68. libvorbisidec, or the requested link is corrupt.</dd>
  69. <dt>0</dt>
  70. <dd>indicates EOF</dd>
  71. <dt><i>n</i></dt>
  72. <dd>indicates actual number of bytes read. <tt>ov_read()</tt> will
  73. decode at most one vorbis packet per invocation, so the value
  74. returned will generally be less than <tt>length</tt>.
  75. </dl>
  76. </blockquote>
  77. <h3>Notes</h3>
  78. <p><b>Typical usage:</b>
  79. <blockquote>
  80. <tt>bytes_read = ov_read(&amp;vf,
  81. buffer, 4096,&amp;current_section)</tt>
  82. </blockquote>
  83. This reads up to 4096 bytes into a buffer, with signed 16-bit
  84. little-endian samples.
  85. </p>
  86. <br><br>
  87. <hr noshade>
  88. <table border=0 width=100%>
  89. <tr valign=top>
  90. <td><p class=tiny>copyright &copy; 2002 Xiph.org</p></td>
  91. <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
  92. </tr><tr>
  93. <td><p class=tiny>Tremor documentation</p></td>
  94. <td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td>
  95. </tr>
  96. </table>
  97. </body>
  98. </html>