Merge branch_beta3 onto the mainline.
[platform/upstream/libvorbis.git] / doc / vorbisfile / ov_read.html
1 <html>
2
3 <head>
4 <title>vorbisfile - function - ov_read</title>
5 <link rel=stylesheet href="style.css" type="text/css">
6 </head>
7
8 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
9 <table border=0 width=100%>
10 <tr>
11 <td><p class=tiny>vorbisfile documentation</p></td>
12 <td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
13 </tr>
14 </table>
15
16 <h1>ov_read</h1>
17
18 <p><i>declared in "vorbis/vorbisfile.h";</i></p>
19
20 <p>This is the main function used to decode a Vorbis file within a loop.
21 <p>This function deals with more complicated bitstream chaining issues.  Up to this point, everything could more or less hide the multiple
22    logical bitstream nature of chaining from the toplevel application
23    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
24    have to have the same number of channels or sampling rate.
25 <p>
26    ov_read returns the sequential logical bitstream number currently
27    being decoded along with the PCM data in order that the toplevel
28    application can take action on channel/sample rate changes.  This
29    number will be incremented even for streamed (non-seekable) streams
30    For seekable streams, it represents the actual logical bitstream
31    index within the physical bitstream.
32 <p>
33
34 <br><br>
35 <table border=0 color=black cellspacing=0 cellpadding=7>
36 <tr bgcolor=#cccccc>
37         <td>
38 <pre><b>
39 long ov_read(<a href="OggVorbis_File.html">OggVorbis_File</a> *vf, char *buffer, int length, int bigendianp, int word, int sgned, int *bitstream);
40 </b></pre>
41         </td>
42 </tr>
43 </table>
44
45 <h3>Parameters</h3>
46 <dl>
47 <dt><i>vf</i></dt>
48 <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
49 functions.</dd>
50 <dt><i>buffer</i></dt>
51 <dd>A pointer to an output buffer.  The decoded output is inserted into this buffer.</dd>
52 <dt><i>length</i></dt>
53 <dd>Number of bytes to be read into the buffer. Should be the same size as the buffer.  A typical value is 4096.</dd>
54 <dt><i>bigendianp</i></dt>
55 <dd>Specifies big or little endian byte packing.  0 for little endian, 1 for big endian.  Typical value is 0.</dd>
56 <dt><i>word</i></dt>
57 <dd>Specifies word size.  Possible arguments are 1 for 8-bit samples, or 2 or 16-bit samples.  Typical value is 2.</dd>
58 <dt><i>sgned</i></dt>
59 <dd>Signed or unsigned data.  0 for unsigned, 1 for signed.  Typically 1.</dd>
60 <dt><i>bitstream</i></dt>
61 <dd></dd>A pointer to the number of the current logical bitstream.
62 </dl>
63
64
65 <h3>Return Values</h3>
66 <blockquote>
67 <li>
68 OV_HOLE indicates there was an interruption in the data. (one of: garbage between pages, loss of sync followed by recapture, or a corrupt page)</li>\r
69 <li>
70 OV_EBADLINK     indicates that an invalid stream section was supplied to libvorbisfile, \r
71                 or the requested link is corrupt. \r
72 </li>
73
74 <li>
75 0 indicates EOF</li>
76 <li><i>n</i> indicates actual number of bytes read.  Within a logical bitstream, the number should equal <tt>length</tt>.  At the end of a logical bitstream, the number of bytes read will equal the remaining number of bytes in the bitstream.</li>
77 </blockquote>
78 <p>
79 <h3>Notes</h3>
80 <p><b>Typical usage:</b> <tt>bytes_read = ov_read(&amp;vf, buffer, 4096,0,2,1,&amp;current_section)</tt>
81 <br>This reads up to 4096 bytes into a buffer, with signed 16-bit little-endian
82 samples.
83 <br>
84 <br><br>
85 <hr noshade>
86 <table border=0 width=100%>
87 <tr valign=top>
88 <td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>
89 <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>
90 </tr><tr>
91 <td><p class=tiny>vorbisfile documentation</p></td>
92 <td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
93 </tr>
94 </table>
95
96
97 </body>
98
99 </html>