f39437677e72608d678c920589fda8b84b1b8dbc
[platform/upstream/libvorbis.git] / doc / vorbisfile / decoding.html
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.3.2 - 20101101</p></td>
13 </tr>
14 </table>
15
16 <h1>Decoding</h1>
17
18 <p>
19 All libvorbisfile decoding routines are declared in "vorbis/vorbisfile.h".
20 <p>
21
22 After <a href="initialization.html">initialization</a>, decoding audio
23 is as simple as calling <a href="ov_read.html">ov_read()</a> (or the
24 similar 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
26 similarly to reading from a normal file using <tt>read()</tt>.<p>
27
28 However, a few differences are worth noting:
29
30 <h2>multiple stream links</h2>
31
32 A Vorbis stream may consist of multiple sections (called links) that
33 encode differing numbers of channels or sample rates.  It is vitally
34 important to pay attention to the link numbers returned by <a
35 href="ov_read.html">ov_read</a> and handle audio changes that may
36 occur at link boundaries.  Such multi-section files do exist in the
37 wild 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
42 a large, passed in data buffer; it merely guarantees that the passed
43 back data does not overflow the passed in buffer size.  Large buffers
44 may be filled by iteratively looping over calls to <a
45 href="ov_read.html">ov_read</a> (incrementing the buffer pointer)
46 until the original buffer is filled.
47
48 <h2>file cursor position</h2>
49
50 Vorbis files do not necessarily start at a sample number or time offset
51 of zero.  Do not be surprised if a file begins at a positive offset of
52 several minutes or hours, such as would happen if a large stream (such
53 as 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
64 OggVorbis_File structure, which must have been initialized by a previous
65 call to <a href="ov_open.html"><tt>ov_open()</tt></a>, <a href="ov_fopen.html"><tt>ov_fopen()</tt></a>, 
66 or <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; 2000-2010 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.3.2 - 20101101</p></td>
87 </tr>
88 </table>
89
90 </body>
91
92 </html>