4 <title>vorbisfile - function - ov_read</title>
5 <link rel=stylesheet href="style.css" type="text/css">
8 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
9 <table border=0 width=100%>
11 <td><p class=tiny>vorbisfile documentation</p></td>
12 <td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
18 <p><i>declared in "vorbis/vorbisfile.h";</i></p>
21 This is the main function used to decode a Vorbis file within a loop.
23 This function deals with more complicated bitstream chaining issues.
24 Up to this point, everything could more or less hide the multiple
25 logical bitstream nature of chaining from the toplevel application
26 if the toplevel application didn't particularly care. However, when we actually read audio back, we must be aware that multiple bitstream sections do not necessarily
27 have to have the same number of channels or sampling rate.
29 <tt>ov_read()</tt> passes back the index of the sequential logical
30 bitstream currently being decoded along with the PCM data in order
31 that the toplevel application can take action on channel/sample rate
32 changes. This number will be incremented at chaining boundaries even
33 for non-seekable streams. For seekable streams, it represents the
34 actual chaining index within the physical bitstream.
35 <tt>ov_read()</tt> passes back the logical bitstream number currently
36 being decoded along with the PCM data in order that the toplevel
37 application can take action on channel/sample rate changes.
41 <table border=0 color=black cellspacing=0 cellpadding=7>
45 long ov_read(<a href="OggVorbis_File.html">OggVorbis_File</a> *vf, char *buffer, int length, int bigendianp, int word, int sgned, int *bitstream);
54 <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
56 <dt><i>buffer</i></dt>
57 <dd>A pointer to an output buffer. The decoded output is inserted into this buffer.</dd>
58 <dt><i>length</i></dt>
59 <dd>Number of bytes to be read into the buffer. Should be the same size as the buffer. A typical value is 4096.</dd>
60 <dt><i>bigendianp</i></dt>
61 <dd>Specifies big or little endian byte packing. 0 for little endian, 1 for big endian. Typical value is 0.</dd>
63 <dd>Specifies word size. Possible arguments are 1 for 8-bit samples, or 2 or 16-bit samples. Typical value is 2.</dd>
65 <dd>Signed or unsigned data. 0 for unsigned, 1 for signed. Typically 1.</dd>
66 <dt><i>bitstream</i></dt>
67 <dd>A pointer to the number of the current logical bitstream.</dd>
71 <h3>Return Values</h3>
75 <dd>indicates there was an interruption in the data.
76 <br>(one of: garbage between pages, loss of sync followed by
77 recapture, or a corrupt page)</dd>
79 <dd>indicates that an invalid stream section was supplied to
80 libvorbisfile, or the requested link is corrupt.</dd>
82 <dd>indicates EOF</dd>
84 <dd>indicates actual number of bytes read. <tt>ov_read()</tt> will
85 decode at most one vorbis packet per invocation, so the value
86 returned will generally be less than <tt>length</tt>.
91 <p><b>Typical usage:</b>
93 <tt>bytes_read = ov_read(&vf,
94 buffer, 4096,0,2,1,&current_section)</tt>
97 This reads up to 4096 bytes into a buffer, with signed 16-bit
98 little-endian samples.
104 <table border=0 width=100%>
106 <td><p class=tiny>copyright © 2000 vorbis team</p></td>
107 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
109 <td><p class=tiny>vorbisfile documentation</p></td>
110 <td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>