cannam@86: <html> cannam@86: cannam@86: <head> cannam@86: <title>Vorbisfile - Decoding</title> cannam@86: <link rel=stylesheet href="style.css" type="text/css"> cannam@86: </head> cannam@86: cannam@86: <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff"> cannam@86: <table border=0 width=100%> cannam@86: <tr> cannam@86: <td><p class=tiny>Vorbisfile documentation</p></td> cannam@86: <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td> cannam@86: </tr> cannam@86: </table> cannam@86: cannam@86: <h1>Decoding</h1> cannam@86: cannam@86: <p> cannam@86: All libvorbisfile decoding routines are declared in "vorbis/vorbisfile.h". cannam@86: <p> cannam@86: cannam@86: After <a href="initialization.html">initialization</a>, decoding audio cannam@86: is as simple as calling <a href="ov_read.html">ov_read()</a> (or the cannam@86: similar functions <a href="ov_read_float.html">ov_read_float()</a> and cannam@86: <a href="ov_read_filter.html">ov_read_filter</a>). This function works cannam@86: similarly to reading from a normal file using <tt>read()</tt>.<p> cannam@86: cannam@86: However, a few differences are worth noting: cannam@86: cannam@86: <h2>multiple stream links</h2> cannam@86: cannam@86: A Vorbis stream may consist of multiple sections (called links) that cannam@86: encode differing numbers of channels or sample rates. It is vitally cannam@86: important to pay attention to the link numbers returned by <a cannam@86: href="ov_read.html">ov_read</a> and handle audio changes that may cannam@86: occur at link boundaries. Such multi-section files do exist in the cannam@86: wild and are not merely a specification curiosity. cannam@86: cannam@86: <h2>returned data amount</h2> cannam@86: cannam@86: <a href="ov_read.html">ov_read</a> does not attempt to completely fill cannam@86: a large, passed in data buffer; it merely guarantees that the passed cannam@86: back data does not overflow the passed in buffer size. Large buffers cannam@86: may be filled by iteratively looping over calls to <a cannam@86: href="ov_read.html">ov_read</a> (incrementing the buffer pointer) cannam@86: until the original buffer is filled. cannam@86: cannam@86: <h2>file cursor position</h2> cannam@86: cannam@86: Vorbis files do not necessarily start at a sample number or time offset cannam@86: of zero. Do not be surprised if a file begins at a positive offset of cannam@86: several minutes or hours, such as would happen if a large stream (such cannam@86: as a concert recording) is chopped into multiple seperate files. cannam@86: cannam@86: <p> cannam@86: <table border=1 color=black width=50% cellspacing=0 cellpadding=7> cannam@86: <tr bgcolor=#cccccc> cannam@86: <td><b>function</b></td> cannam@86: <td><b>purpose</b></td> cannam@86: </tr> cannam@86: <tr valign=top> cannam@86: <td><a href="ov_read.html">ov_read</a></td> cannam@86: <td>This function makes up the main chunk of a decode loop. It takes an cannam@86: OggVorbis_File structure, which must have been initialized by a previous cannam@86: call to <a href="ov_open.html"><tt>ov_open()</tt></a>, <a href="ov_fopen.html"><tt>ov_fopen()</tt></a>, cannam@86: or <a href="ov_open_callbacks.html"><tt>ov_open_callbacks()</tt></a>.</td> cannam@86: </tr> cannam@86: <tr valign=top> cannam@86: <td><a href="ov_read_float.html">ov_read_float</a></td> cannam@86: <td>This function decodes to floats instead of integer samples.</td> cannam@86: </tr> cannam@86: <tr valign=top> cannam@86: <td><a href="ov_read_filter.html">ov_read_filter</a></td> cannam@86: <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> cannam@86: </tr> cannam@86: </table> cannam@86: cannam@86: <br><br> cannam@86: <hr noshade> cannam@86: <table border=0 width=100%> cannam@86: <tr valign=top> cannam@86: <td><p class=tiny>copyright © 2000-2010 Xiph.Org</p></td> cannam@86: <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td> cannam@86: </tr><tr> cannam@86: <td><p class=tiny>Vorbisfile documentation</p></td> cannam@86: <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td> cannam@86: </tr> cannam@86: </table> cannam@86: cannam@86: </body> cannam@86: cannam@86: </html>