annotate src/libvorbis-1.3.3/doc/vorbisfile/ov_read.html @ 86:98c1576536ae

Bring in flac, ogg, vorbis
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 19 Mar 2013 17:37:49 +0000
parents
children
rev   line source
cannam@86 1 <html>
cannam@86 2
cannam@86 3 <head>
cannam@86 4 <title>Vorbisfile - function - ov_read</title>
cannam@86 5 <link rel=stylesheet href="style.css" type="text/css">
cannam@86 6 </head>
cannam@86 7
cannam@86 8 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
cannam@86 9 <table border=0 width=100%>
cannam@86 10 <tr>
cannam@86 11 <td><p class=tiny>Vorbisfile documentation</p></td>
cannam@86 12 <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
cannam@86 13 </tr>
cannam@86 14 </table>
cannam@86 15
cannam@86 16 <h1>ov_read()</h1>
cannam@86 17
cannam@86 18 <p><i>declared in "vorbis/vorbisfile.h";</i></p>
cannam@86 19
cannam@86 20 <p>
cannam@86 21 This is the main function used to decode a Vorbis file within a
cannam@86 22 loop. It returns up to the specified number of bytes of decoded PCM audio
cannam@86 23 in the requested endianness, signedness, and word size. If the audio is
cannam@86 24 multichannel, the channels are interleaved in the output buffer.
cannam@86 25 If the passed in buffer is large, <tt>ov_read()</tt> will not fill
cannam@86 26 it; the passed in buffer size is treated as a <em>limit</em> and
cannam@86 27 not a request.
cannam@86 28
cannam@86 29 <p>The output channels are in stream order and not remapped. Vorbis I
cannam@86 30 defines channel order as follows:
cannam@86 31
cannam@86 32 <ul>
cannam@86 33 <li>one channel - the stream is monophonic
cannam@86 34 <li>two channels - the stream is stereo. channel order: left, right
cannam@86 35 <li>three channels - the stream is a 1d-surround encoding. channel order: left,
cannam@86 36 center, right
cannam@86 37 <li>four channels - the stream is quadraphonic surround. channel order: front left,
cannam@86 38 front right, rear left, rear right
cannam@86 39 <li>five channels - the stream is five-channel surround. channel order: front left,
cannam@86 40 center, front right, rear left, rear right
cannam@86 41 <li>six channels - the stream is 5.1 surround. channel order: front left, center,
cannam@86 42 front right, rear left, rear right, LFE
cannam@86 43 <li>seven channels - the stream is 6.1 surround. channel order: front left, center,
cannam@86 44 front right, side left, side right, rear center, LFE
cannam@86 45 <li>eight channels - the stream is 7.1 surround. channel order: front left, center,
cannam@86 46 front right, side left, side right, rear left, rear right,
cannam@86 47 LFE
cannam@86 48 <li>greater than eight channels - channel use and order is undefined
cannam@86 49 </ul>
cannam@86 50
cannam@86 51 <p>Note that up to this point, the Vorbisfile API could more or less hide the
cannam@86 52 multiple logical bitstream nature of chaining from the toplevel
cannam@86 53 application if the toplevel application didn't particularly care.
cannam@86 54 However, when reading audio back, the application must be aware
cannam@86 55 that multiple bitstream sections do not necessarily use the same
cannam@86 56 number of channels or sampling rate. <p> <tt>ov_read()</tt> passes
cannam@86 57 back the index of the sequential logical bitstream currently being
cannam@86 58 decoded (in <tt>*bitstream</tt>) along with the PCM data in order
cannam@86 59 that the toplevel application can handle channel and/or sample
cannam@86 60 rate changes. This number will be incremented at chaining
cannam@86 61 boundaries even for non-seekable streams. For seekable streams, it
cannam@86 62 represents the actual chaining index within the physical bitstream.
cannam@86 63 <p>
cannam@86 64
cannam@86 65 <br><br>
cannam@86 66 <table border=0 color=black cellspacing=0 cellpadding=7>
cannam@86 67 <tr bgcolor=#cccccc>
cannam@86 68 <td>
cannam@86 69 <pre><b>
cannam@86 70 long ov_read(<a href="OggVorbis_File.html">OggVorbis_File</a> *vf, char *buffer, int length, int bigendianp, int word, int sgned, int *bitstream);
cannam@86 71 </b></pre>
cannam@86 72 </td>
cannam@86 73 </tr>
cannam@86 74 </table>
cannam@86 75
cannam@86 76 <h3>Parameters</h3>
cannam@86 77 <dl>
cannam@86 78 <dt><i>vf</i></dt>
cannam@86 79 <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile
cannam@86 80 functions.</dd>
cannam@86 81 <dt><i>buffer</i></dt>
cannam@86 82 <dd>A pointer to an output buffer. The decoded output is inserted into this buffer.</dd>
cannam@86 83 <dt><i>length</i></dt>
cannam@86 84 <dd>Number of bytes to be read into the buffer. Should be the same size as the buffer. A typical value is 4096.</dd>
cannam@86 85 <dt><i>bigendianp</i></dt>
cannam@86 86 <dd>Specifies big or little endian byte packing. 0 for little endian, 1 for b
cannam@86 87 ig endian. Typical value is 0.</dd>
cannam@86 88 <dt><i>word</i></dt>
cannam@86 89 <dd>Specifies word size. Possible arguments are 1 for 8-bit samples, or 2 or
cannam@86 90 16-bit samples. Typical value is 2.</dd>
cannam@86 91 <dt><i>sgned</i></dt>
cannam@86 92 <dd>Signed or unsigned data. 0 for unsigned, 1 for signed. Typically 1.</dd>
cannam@86 93 <dt><i>bitstream</i></dt>
cannam@86 94 <dd>A pointer to the number of the current logical bitstream.</dd>
cannam@86 95 </dl>
cannam@86 96
cannam@86 97
cannam@86 98 <h3>Return Values</h3>
cannam@86 99 <blockquote>
cannam@86 100 <dl>
cannam@86 101 <dt>OV_HOLE</dt>
cannam@86 102 <dd>indicates there was an interruption in the data.
cannam@86 103 <br>(one of: garbage between pages, loss of sync followed by
cannam@86 104 recapture, or a corrupt page)</dd>
cannam@86 105 <dt>OV_EBADLINK</dt>
cannam@86 106 <dd>indicates that an invalid stream section was supplied to
cannam@86 107 libvorbisfile, or the requested link is corrupt.</dd>
cannam@86 108 <dt>OV_EINVAL</dt>
cannam@86 109 <dd>indicates the initial file headers couldn't be read or
cannam@86 110 are corrupt, or that the initial open call for <i>vf</i>
cannam@86 111 failed.</dd>
cannam@86 112 <dt>0</dt>
cannam@86 113 <dd>indicates EOF</dd>
cannam@86 114 <dt><i>n</i></dt>
cannam@86 115 <dd>indicates actual number of bytes read. <tt>ov_read()</tt> will
cannam@86 116 decode at most one vorbis packet per invocation, so the value
cannam@86 117 returned will generally be less than <tt>length</tt>.
cannam@86 118 </dl>
cannam@86 119 </blockquote>
cannam@86 120
cannam@86 121 <h3>Notes</h3>
cannam@86 122 <p><b>Typical usage:</b>
cannam@86 123 <blockquote>
cannam@86 124 <tt>bytes_read = ov_read(&amp;vf,
cannam@86 125 buffer, 4096,0,2,1,&amp;current_section)</tt>
cannam@86 126 </blockquote>
cannam@86 127
cannam@86 128 This reads up to 4096 bytes into a buffer, with signed 16-bit
cannam@86 129 little-endian samples.
cannam@86 130 </p>
cannam@86 131
cannam@86 132
cannam@86 133
cannam@86 134 <br><br>
cannam@86 135 <hr noshade>
cannam@86 136 <table border=0 width=100%>
cannam@86 137 <tr valign=top>
cannam@86 138 <td><p class=tiny>copyright &copy; 2000-2010 Xiph.Org</p></td>
cannam@86 139 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
cannam@86 140 </tr><tr>
cannam@86 141 <td><p class=tiny>Vorbisfile documentation</p></td>
cannam@86 142 <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
cannam@86 143 </tr>
cannam@86 144 </table>
cannam@86 145
cannam@86 146 </body>
cannam@86 147
cannam@86 148 </html>