1<html>
2
3<head>
4<title>Vorbisfile - Decoding</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.2.0 - 20070723</p></td>
13</tr>
14</table>
15
16<h1>Decoding</h1>
17
18<p>
19All libvorbisfile decoding routines are declared in "vorbis/vorbisfile.h".
20<p>
21
22After <a href="initialization.html">initialization</a>, decoding audio
23is as simple as calling <a href="ov_read.html">ov_read()</a> (or the
24similar functions <a href="ov_read_float.html">ov_read_float()</a> and
25<a href="ov_read_filter.html">ov_read_filter</a>). This function works
26similarly to reading from a normal file using <tt>read()</tt>.<p>
27
28However, a few differences are worth noting:
29
30<h2>multiple stream links</h2>
31
32A Vorbis stream may consist of multiple sections (called links) that
33encode differing numbers of channels or sample rates.  It is vitally
34important to pay attention to the link numbers returned by <a
35href="ov_read.html">ov_read</a> and handle audio changes that may
36occur at link boundaries.  Such multi-section files do exist in the
37wild and are not merely a specification curiosity.
38
39<h2>returned data amount</h2>
40
41<a href="ov_read.html">ov_read</a> does not attempt to completely fill
42a large, passed in data buffer; it merely guarantees that the passed
43back data does not overflow the passed in buffer size.  Large buffers
44may be filled by iteratively looping over calls to <a
45href="ov_read.html">ov_read</a> (incrementing the buffer pointer)
46until the original buffer is filled.
47
48<h2>file cursor position</h2>
49
50Vorbis files do not necessarily start at a sample number or time offset
51of zero.  Do not be surprised if a file begins at a positive offset of
52several minutes or hours, such as would happen if a large stream (such
53as a concert recording) is chopped into multiple seperate files.
54
55<p>
56<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
57<tr bgcolor=#cccccc>
58	<td><b>function</b></td>
59	<td><b>purpose</b></td>
60</tr>
61<tr valign=top>
62	<td><a href="ov_read.html">ov_read</a></td>
63	<td>This function makes up the main chunk of a decode loop. It takes an
64OggVorbis_File structure, which must have been initialized by a previous
65call to <a href="ov_open.html"><tt>ov_open()</tt></a>, <a href="ov_fopen.html"><tt>ov_fopen()</tt></a>,
66or <a href="ov_open_callbacks.html"><tt>ov_open_callbacks()</tt></a>.</td>
67</tr>
68<tr valign=top>
69        <td><a href="ov_read_float.html">ov_read_float</a></td>
70        <td>This function decodes to floats instead of integer samples.</td>
71</tr>
72<tr valign=top>
73        <td><a href="ov_read_filter.html">ov_read_filter</a></td>
74        <td>This function works like <a href="ov_read.html">ov_read</a>, but passes the PCM data through the provided filter before converting to integer sample data.</td>
75</tr>
76</table>
77
78<br><br>
79<hr noshade>
80<table border=0 width=100%>
81<tr valign=top>
82<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
83<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
84</tr><tr>
85<td><p class=tiny>Vorbisfile documentation</p></td>
86<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
87</tr>
88</table>
89
90</body>
91
92</html>
93