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