<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>libfishsound: Decoding audio data</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.8 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> </div> <div class="contents"> <h1>Decoding audio data</h1>To decode audio data using libfishsound:. <a href="#_details">More...</a> <p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> </table> To decode audio data using libfishsound:. <p> <ul> <li>create a FishSound* object with mode FISH_SOUND_DECODE. <a class="el" href="fishsound_8h.html#decddfef35cbbddcc8a76b28c365c527" title="Instantiate a new FishSound* handle.">fish_sound_new()</a> will return a new FishSound* object, initialised for decoding, and the <a class="el" href="structFishSoundInfo.html" title="Info about a particular encoder/decoder instance.">FishSoundInfo</a> structure will be cleared.</li><li>provide a FishSoundDecoded_* callback for libfishsound to call when it has decoded audio.</li><li>(optionally) specify whether you want to receive interleaved or per-channel PCM data, using a <a class="el" href="deprecated_8h.html#8e6b76134675d948015fe4afa3fe4104" title="DEPRECATED FUNCTION.">fish_sound_set_interleave()</a>. The default is for per-channel (non-interleaved) PCM.</li><li>feed encoded audio data to libfishsound via <a class="el" href="decode_8h.html#070a1843d6990a00e2471945d40645c7" title="Decode a block of compressed data.">fish_sound_decode()</a>. libfishsound will decode the audio for you, calling the FishSoundDecoded_* callback you provided earlier each time it has a block of audio ready.</li><li>when finished, call <a class="el" href="fishsound_8h.html#002e2dee1a7f736699dba5bec0a81426" title="Delete a FishSound object.">fish_sound_delete()</a>.</li></ul> <p> This procedure is illustrated in src/examples/fishsound-decode.c. Note that this example additionally:<ul> <li>uses <a href="http://www.annodex.net/software/liboggz/">liboggz</a> to demultiplex audio data from an Ogg encapsulated FLAC, Speex or Vorbis stream. The step of feeding encoded data to libfishsound is done within the OggzReadPacket callback.</li><li>uses <a href="http://www.mega-nerd.com/libsndfile/">libsndfile</a> to write the decoded audio to a WAV file.</li></ul> <p> Hence this example code demonstrates all that is needed to decode Ogg FLAC, Speex or Ogg Vorbis files:<p> <div class="fragment"><pre class="fragment"></pre></div> </div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Feb 3 22:16:44 2010 for libfishsound by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> </body> </html>