annotate src/libvorbis-1.3.3/doc/libvorbis/overview.html @ 1:05aa0afa9217

Bring in flac, ogg, vorbis
author Chris Cannam
date Tue, 19 Mar 2013 17:37:49 +0000 (2013-03-19)
parents
children
rev   line source
Chris@1 1 <html>
Chris@1 2
Chris@1 3 <head>
Chris@1 4 <title>libvorbis - API Overview</title>
Chris@1 5 <link rel=stylesheet href="style.css" type="text/css">
Chris@1 6 </head>
Chris@1 7
Chris@1 8 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
Chris@1 9 <table border=0 width=100%>
Chris@1 10 <tr>
Chris@1 11 <td><p class=tiny>libvorbis documentation</p></td>
Chris@1 12 <td align=right><p class=tiny>libvorbis version 1.3.2 - 20101101</p></td>
Chris@1 13 </tr>
Chris@1 14 </table>
Chris@1 15
Chris@1 16 <h1>Libvorbis API Overview</h1>
Chris@1 17
Chris@1 18 <p>Libvorbis is the reference implementation of the Vorbis codec. It is
Chris@1 19 the lowest-level interface to the Vorbis encoder and decoder, working
Chris@1 20 with packets directly.</p>
Chris@1 21
Chris@1 22 <p>All libvorbis routines and structures are declared in "vorbis/codec.h".</p>
Chris@1 23
Chris@1 24 <h2>Encoding workflow</h2>
Chris@1 25
Chris@1 26 <ol>
Chris@1 27 <li>Initialize a <a href="vorbis_info.html">vorbis_info</a> structure
Chris@1 28 by calling <a href="vorbis_info_init.html">vorbis_info_init</a> and
Chris@1 29 then functions from <a href="../vorbisenc/index.html">libvorbisenc</a>
Chris@1 30 on it.</li>
Chris@1 31 <li>Initialize a <a href="vorbis_dsp_state.html">vorbis_dsp_state</a>
Chris@1 32 for encoding based on the parameters in the vorbis_info by using <a
Chris@1 33 href="vorbis_analysis_init.html">vorbis_analysis_init</a>.</li>
Chris@1 34 <li>Initialize a <a href="vorbis_comment.html">vorbis_comment</a>
Chris@1 35 structure using <a href="vorbis_comment_init.html">vorbis_comment_init</a>,
Chris@1 36 populate it with any comments you wish to store in the stream, and call
Chris@1 37 <a href="vorbis_analysis_headerout.html">vorbis_analysis_headerout</a> to
Chris@1 38 get the three Vorbis stream header packets. Output the packets.</li>
Chris@1 39 <li>Initialize a <a href="vorbis_block.html">vorbis_block</a> structure
Chris@1 40 using <a href="vorbis_block_init.html">vorbis_block_init</a>.</li>
Chris@1 41 <li>While there is more audio to encode:<ol>
Chris@1 42 <li>Submit a chunk of audio data using <a
Chris@1 43 href="vorbis_analysis_buffer.html">vorbis_analysis_buffer</a> and <a
Chris@1 44 href="vorbis_analysis_wrote.html">vorbis_analysis_wrote</a>.</li>
Chris@1 45 <li>Obtain all available blocks using <a
Chris@1 46 href="vorbis_analysis_blockout.html">vorbis_analysis_blockout</a>
Chris@1 47 in a loop. For each block obtained:<ol>
Chris@1 48 <li>Encode the block into a packet (or prepare it for bitrate management)
Chris@1 49 using <a href="vorbis_analysis.html">vorbis_analysis</a>. (It's a good
Chris@1 50 idea to always pass the blocks through the bitrate
Chris@1 51 management mechanism; more information is on the <a
Chris@1 52 href="vorbis_analysis.html">vorbis_analysis</a> page. It does not affect
Chris@1 53 the resulting packets unless you are actually using a bitrate-managed
Chris@1 54 mode.)</li>
Chris@1 55 <li>If you are using bitrate management, submit the block using <a
Chris@1 56 href="vorbis_bitrate_addblock.html">vorbis_bitrate_addblock</a> and obtain
Chris@1 57 packets using <a
Chris@1 58 href="vorbis_bitrate_flushpacket.html">vorbis_bitrate_flushpacket</a>.</li>
Chris@1 59 <li>Output any obtained packets.</li>
Chris@1 60 </ol></li>
Chris@1 61 </ol></li>
Chris@1 62 <li>Submit an empty buffer to indicate the end of input; this will result
Chris@1 63 in an end-of-stream packet after all encoding steps are done to it.</li>
Chris@1 64 <li>Destroy the structures using the appropriate vorbis_*_clear routines.</li>
Chris@1 65 </ol>
Chris@1 66
Chris@1 67 <h2>Decoding workflow</h2>
Chris@1 68
Chris@1 69 <em>Note: if you do not need to do anything more involved than just
Chris@1 70 decoding the audio from an Ogg Vorbis file, you can use the far simpler
Chris@1 71 <a href="../vorbisfile/index.html">libvorbisfile</a> interface, which
Chris@1 72 will take care of all of the demuxing and low-level decoding operations
Chris@1 73 (and even the I/O, if you want) for you.</em>
Chris@1 74
Chris@1 75 <ol>
Chris@1 76 <li>When reading the header packets of an Ogg stream, you can use <a
Chris@1 77 href="vorbis_synthesis_idheader.html">vorbis_synthesis_idheader</a> to
Chris@1 78 check whether a stream might be Vorbis.</li>
Chris@1 79 <li>Initialize a <a href="vorbis_info.html">vorbis_info</a> and a <a
Chris@1 80 href="vorbis_comment.html">vorbis_comment</a> structure using the
Chris@1 81 appropriate vorbis_*_init routines, then pass the first three packets
Chris@1 82 from the stream (the Vorbis stream header packets) to <a
Chris@1 83 href="vorbis_synthesis_headerin.html">vorbis_synthesis_headerin</a> in
Chris@1 84 order. At this point, you can see the comments and basic parameters of
Chris@1 85 the Vorbis stream.</li>
Chris@1 86 <li>Initialize a <a href="vorbis_dsp_state.html">vorbis_dsp_state</a>
Chris@1 87 for decoding based on the parameters in the vorbis_info by using <a
Chris@1 88 href="vorbis_synthesis_init.html">vorbis_synthesis_init</a>.</li>
Chris@1 89 <li>Initialize a <a href="vorbis_block.html">vorbis_block</a> structure
Chris@1 90 using <a href="vorbis_block_init.html">vorbis_block_init</a>.</li>
Chris@1 91 <li>While there are more packets to decode:<ol>
Chris@1 92 <li>Decode the next packet into a block using <a
Chris@1 93 href="vorbis_synthesis.html">vorbis_synthesis</a>.</li>
Chris@1 94 <li>Submit the block to the reassembly layer using <a
Chris@1 95 href="vorbis_synthesis_blockin.html">vorbis_synthesis_blockin</a>.</li>
Chris@1 96 <li>Obtain some decoded audio using <a
Chris@1 97 href="vorbis_synthesis_pcmout.html">vorbis_synthesis_pcmout</a> and <a
Chris@1 98 href="vorbis_synthesis_read.html">vorbis_synthesis_read</a>. Any audio data
Chris@1 99 returned but not marked as consumed using vorbis_synthesis_read carries
Chris@1 100 over to the next call to vorbis_synthesis_pcmout.</li>
Chris@1 101 </ol></li>
Chris@1 102 <li>Destroy the structures using the appropriate vorbis_*_clear routines.</li>
Chris@1 103 </ol>
Chris@1 104
Chris@1 105 <h2>Metadata workflow</h2>
Chris@1 106
Chris@1 107 <em>Note: if you do not need to do anything more involved than just
Chris@1 108 reading the metadata from an Ogg Vorbis file, <a
Chris@1 109 href="../vorbisfile/index.html">libvorbisfile</a> can do this for you.</em>
Chris@1 110
Chris@1 111 <ol>
Chris@1 112 <li>Follow the decoding workflow above until you have access to the comments
Chris@1 113 and basic parameters of the Vorbis stream.</li>
Chris@1 114 <li>If you want to alter the comments, copy the first packet to the output
Chris@1 115 file, then create a packet for the modified comments using <a
Chris@1 116 href="vorbis_commentheader_out.html">vorbis_commentheader_out</a> and output
Chris@1 117 it, then copy the third packet and all subsequent packets into the output
Chris@1 118 file.</li>
Chris@1 119 </ol>
Chris@1 120
Chris@1 121 <br><br>
Chris@1 122 <hr noshade>
Chris@1 123 <table border=0 width=100%>
Chris@1 124 <tr valign=top>
Chris@1 125 <td><p class=tiny>copyright &copy; 2010 Xiph.Org</p></td>
Chris@1 126 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a></p></td>
Chris@1 127 </tr><tr>
Chris@1 128 <td><p class=tiny>libvorbis documentation</p></td>
Chris@1 129 <td align=right><p class=tiny>libvorbis version 1.3.2 - 20101101</p></td>
Chris@1 130 </tr>
Chris@1 131 </table>
Chris@1 132
Chris@1 133 </body>
Chris@1 134
Chris@1 135 </html>
Chris@1 136