00001 <html> 00002 00003 <head> 00004 <title>Vorbisfile - Decoding</title> 00005 <link rel=stylesheet href="style.css" type="text/css"> 00006 </head> 00007 00008 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff"> 00009 <table border=0 width=100%> 00010 <tr> 00011 <td><p class=tiny>Vorbisfile documentation</p></td> 00012 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td> 00013 </tr> 00014 </table> 00015 00016 <h1>Decoding</h1> 00017 00018 <p> 00019 All libvorbisfile decoding routines are declared in "vorbis/vorbisfile.h". 00020 <p> 00021 00022 After <a href="initialization.html">initialization</a>, decoding audio 00023 is as simple as calling <a href="ov_read.html">ov_read()</a>. This 00024 function works similarly to reading from a normal file using 00025 <tt>read()</tt>.<p> 00026 00027 However, a few differences are worth noting: 00028 00029 <h2>multiple stream links</h2> 00030 00031 A Vorbis stream may consist of multiple sections (called links) that 00032 encode differing numbers of channels or sample rates. It is vitally 00033 important to pay attention to the link numbers returned by <a 00034 href="ov_read.html">ov_read</a> and handle audio changes that may 00035 occur at link boundaries. Such multi-section files do exist in the 00036 wild and are not merely a specification curiosity. 00037 00038 <h2>returned data amount</h2> 00039 00040 <a href="ov_read.html">ov_read</a> does not attempt to completely fill 00041 a large, passed in data buffer; it merely guarantees that the passed 00042 back data does not overflow the passed in buffer size. Large buffers 00043 may be filled by iteratively looping over calls to <a 00044 href="ov_read.html">ov_read</a> (incrementing the buffer pointer) 00045 until the original buffer is filled. 00046 00047 <h2>file cursor position</h2> 00048 00049 Vorbis files do not necessarily start at a sample number or time offset 00050 of zero. Do not be surprised if a file begins at a positive offset of 00051 several minutes or hours, such as would happen if a large stream (such 00052 as a concert recording) is chopped into multiple seperate files. 00053 00054 <p> 00055 <table border=1 color=black width=50% cellspacing=0 cellpadding=7> 00056 <tr bgcolor=#cccccc> 00057 <td><b>function</b></td> 00058 <td><b>purpose</b></td> 00059 </tr> 00060 <tr valign=top> 00061 <td><a href="ov_read.html">ov_read</a></td> 00062 <td>This function makes up the main chunk of a decode loop. It takes an 00063 OggVorbis_File structure, which must have been initialized by a previous 00064 call to <a href="ov_open.html"><tt>ov_open()</tt></a>.</td> 00065 </tr> 00066 <tr valign=top> 00067 <td><a href="ov_read_float.html">ov_read_float</a></td> 00068 <td>This function decodes to floats instead of integer samples.</td> 00069 </tr> 00070 </table> 00071 00072 <br><br> 00073 <hr noshade> 00074 <table border=0 width=100%> 00075 <tr valign=top> 00076 <td><p class=tiny>copyright © 2003 Xiph.org</p></td> 00077 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td> 00078 </tr><tr> 00079 <td><p class=tiny>Vorbisfile documentation</p></td> 00080 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td> 00081 </tr> 00082 </table> 00083 00084 </body> 00085 00086 </html>