00001 <html> 00002 00003 <head> 00004 <title>Tremor - function - ov_read</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_read()</h1> 00017 00018 <p><i>declared in "ivorbisfile.h";</i></p> 00019 00020 <p> 00021 This is the main function used to decode a Vorbis file within a 00022 loop. It returns up to the specified number of bytes of decoded audio 00023 in host-endian, signed 16 bit PCM format. If the audio is 00024 multichannel, the channels are interleaved in the output buffer. 00025 If the passed in buffer is large, <tt>ov_read()</tt> will not fill 00026 it; the passed in buffer size is treated as a <em>limit</em> and 00027 not a request. 00028 <p> 00029 00030 Note that up to this point, the Tremor API could more or less hide the 00031 multiple logical bitstream nature of chaining from the toplevel 00032 application if the toplevel application didn't particularly care. 00033 However, when reading audio back, the application must be aware 00034 that multiple bitstream sections do not necessarily use the same 00035 number of channels or sampling rate. <p> <tt>ov_read()</tt> passes 00036 back the index of the sequential logical bitstream currently being 00037 decoded (in <tt>*bitstream</tt>) along with the PCM data in order 00038 that the toplevel application can handle channel and/or sample 00039 rate changes. This number will be incremented at chaining 00040 boundaries even for non-seekable streams. For seekable streams, it 00041 represents the actual chaining index within the physical bitstream. 00042 <p> 00043 00044 <br><br> 00045 <table border=0 color=black cellspacing=0 cellpadding=7> 00046 <tr bgcolor=#cccccc> 00047 <td> 00048 <pre><b> 00049 long ov_read(<a href="OggVorbis_File.html">OggVorbis_File</a> *vf, char *buffer, int length, int *bitstream); 00050 </b></pre> 00051 </td> 00052 </tr> 00053 </table> 00054 00055 <h3>Parameters</h3> 00056 <dl> 00057 <dt><i>vf</i></dt> 00058 <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisidec 00059 functions.</dd> 00060 <dt><i>buffer</i></dt> 00061 <dd>A pointer to an output buffer. The decoded output is inserted into this buffer.</dd> 00062 <dt><i>length</i></dt> 00063 <dd>Number of bytes to be read into the buffer. Should be the same size as the buffer. A typical value is 4096.</dd> 00064 <dt><i>bitstream</i></dt> 00065 <dd>A pointer to the number of the current logical bitstream.</dd> 00066 </dl> 00067 00068 00069 <h3>Return Values</h3> 00070 <blockquote> 00071 <dl> 00072 <dt>OV_HOLE</dt> 00073 <dd>indicates there was an interruption in the data. 00074 <br>(one of: garbage between pages, loss of sync followed by 00075 recapture, or a corrupt page)</dd> 00076 <dt>OV_EBADLINK</dt> 00077 <dd>indicates that an invalid stream section was supplied to 00078 libvorbisidec, or the requested link is corrupt.</dd> 00079 <dt>0</dt> 00080 <dd>indicates EOF</dd> 00081 <dt><i>n</i></dt> 00082 <dd>indicates actual number of bytes read. <tt>ov_read()</tt> will 00083 decode at most one vorbis packet per invocation, so the value 00084 returned will generally be less than <tt>length</tt>. 00085 </dl> 00086 </blockquote> 00087 00088 <h3>Notes</h3> 00089 <p><b>Typical usage:</b> 00090 <blockquote> 00091 <tt>bytes_read = ov_read(&vf, 00092 buffer, 4096,&current_section)</tt> 00093 </blockquote> 00094 00095 This reads up to 4096 bytes into a buffer, with signed 16-bit 00096 little-endian samples. 00097 </p> 00098 00099 00100 00101 <br><br> 00102 <hr noshade> 00103 <table border=0 width=100%> 00104 <tr valign=top> 00105 <td><p class=tiny>copyright © 2002 Xiph.org</p></td> 00106 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td> 00107 </tr><tr> 00108 <td><p class=tiny>Tremor documentation</p></td> 00109 <td align=right><p class=tiny>Tremor version 1.0 - 20020403</p></td> 00110 </tr> 00111 </table> 00112 00113 </body> 00114 00115 </html>