<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>libfishsound: fishsound.h File Reference</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.6.2-20100208 --> <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 class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="contents"> <h1>fishsound.h File Reference</h1> <p>The libfishsound C API. <a href="#_details">More...</a></p> <code>#include <<a class="el" href="constants_8h_source.html">fishsound/constants.h</a>></code><br/> <code>#include <<a class="el" href="decode_8h_source.html">fishsound/decode.h</a>></code><br/> <code>#include <<a class="el" href="encode_8h_source.html">fishsound/encode.h</a>></code><br/> <code>#include <<a class="el" href="comments_8h_source.html">fishsound/comments.h</a>></code><br/> <code>#include <<a class="el" href="deprecated_8h_source.html">fishsound/deprecated.h</a>></code><br/> <p><a href="fishsound_8h_source.html">Go to the source code of this file.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Data Structures</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structFishSoundInfo.html">FishSoundInfo</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Info about a particular encoder/decoder instance. <a href="structFishSoundInfo.html#_details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structFishSoundFormat.html">FishSoundFormat</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Info about a particular sound format. <a href="structFishSoundFormat.html#_details">More...</a><br/></td></tr> <tr><td colspan="2"><h2>Typedefs</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef void * </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">An opaque handle to a FishSound. <a href="#a8cfb7dfb102ad1af9ff35046aed3ccd9"></a><br/></td></tr> <tr><td colspan="2"><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#a2776f39cfa1540b1da3c9d423de15ae9">fish_sound_identify</a> (unsigned char *buf, long bytes)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Identify a codec based on the first few bytes of data. <a href="#a2776f39cfa1540b1da3c9d423de15ae9"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#adecddfef35cbbddcc8a76b28c365c527">fish_sound_new</a> (int mode, <a class="el" href="structFishSoundInfo.html">FishSoundInfo</a> *fsinfo)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Instantiate a new FishSound* handle. <a href="#adecddfef35cbbddcc8a76b28c365c527"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#ab1672c542e09528b3dad3ee694b124d8">fish_sound_flush</a> (<a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> *fsound)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Flush any internally buffered data, forcing encode. <a href="#ab1672c542e09528b3dad3ee694b124d8"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#a546a521c2c3c3a2ee614ae3981fbc29f">fish_sound_reset</a> (<a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> *fsound)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Reset the codec state of a FishSound object. <a href="#a546a521c2c3c3a2ee614ae3981fbc29f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#a002e2dee1a7f736699dba5bec0a81426">fish_sound_delete</a> (<a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> *fsound)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Delete a FishSound object. <a href="#a002e2dee1a7f736699dba5bec0a81426"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#a35c5182901b71a2514bc9a8f2ec839c7">fish_sound_command</a> (<a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> *fsound, int command, void *data, int datasize)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Command interface. <a href="#a35c5182901b71a2514bc9a8f2ec839c7"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#a7bc2b75ad943e2da3147bf33882860c8">fish_sound_get_interleave</a> (<a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> *fsound)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Query whether a FishSound object is using interleaved PCM. <a href="#a7bc2b75ad943e2da3147bf33882860c8"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#ad991f9f6887487f5d833de9480bcbe43">fish_sound_get_frameno</a> (<a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> *fsound)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Query the current frame number of a FishSound object. <a href="#ad991f9f6887487f5d833de9480bcbe43"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#a0d508075ecdd834ab5a4504f5e85f66b">fish_sound_set_frameno</a> (<a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> *fsound, long frameno)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the current frame number of a FishSound object. <a href="#a0d508075ecdd834ab5a4504f5e85f66b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="fishsound_8h.html#a6f4818e09b8323d8461331f46f13ab6a">fish_sound_prepare_truncation</a> (<a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> *fsound, long next_granulepos, int next_eos)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Prepare truncation details for the next block of data. <a href="#a6f4818e09b8323d8461331f46f13ab6a"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>The libfishsound C API. </p> <h2><a class="anchor" id="general"> General usage</a></h2> <p>All access is managed via a FishSound* handle. This is instantiated using <a class="el" href="fishsound_8h.html#adecddfef35cbbddcc8a76b28c365c527" title="Instantiate a new FishSound* handle.">fish_sound_new()</a> and should be deleted with <a class="el" href="fishsound_8h.html#a002e2dee1a7f736699dba5bec0a81426" title="Delete a FishSound object.">fish_sound_delete()</a> when no longer required. If there is a discontinuity in the input data (eg. after seeking in an input file), call <a class="el" href="fishsound_8h.html#a546a521c2c3c3a2ee614ae3981fbc29f" title="Reset the codec state of a FishSound object.">fish_sound_reset()</a> to reset the internal codec state.</p> <h2><a class="anchor" id="decoding"> Decoding</a></h2> <p>libfishsound provides callback based decoding: you feed it encoded audio data, and it will call your callback with decoded PCM. A more detailed explanation and a full example of decoding Ogg FLAC, Speex and Ogg Vorbis files is provided in the <a class="el" href="group__decode.html">Decoding audio data </a> section.</p> <h2><a class="anchor" id="encoding"> Encoding</a></h2> <p>libfishsound provides callback based encoding: you feed it PCM audio, and it will call your callback with encoded audio data. A more detailed explanation and a full example of encoding Ogg FLAC, Speex and Ogg Vorbis files is provided in the <a class="el" href="group__encode.html">Encoding audio data </a> section. </p> <hr/><h2>Typedef Documentation</h2> <a class="anchor" id="a8cfb7dfb102ad1af9ff35046aed3ccd9"></a><!-- doxytag: member="fishsound.h::FishSound" ref="a8cfb7dfb102ad1af9ff35046aed3ccd9" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void* <a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a></td> </tr> </table> </div> <div class="memdoc"> <p>An opaque handle to a FishSound. </p> <p>This is returned by fishsound_new() and is passed to all other fish_sound_*() functions. </p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a35c5182901b71a2514bc9a8f2ec839c7"></a><!-- doxytag: member="fishsound.h::fish_sound_command" ref="a35c5182901b71a2514bc9a8f2ec839c7" args="(FishSound *fsound, int command, void *data, int datasize)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int fish_sound_command </td> <td>(</td> <td class="paramtype"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> * </td> <td class="paramname"> <em>fsound</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>command</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"> <em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>datasize</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Command interface. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fsound</em> </td><td>A FishSound* handle </td></tr> <tr><td valign="top"></td><td valign="top"><em>command</em> </td><td>The command action </td></tr> <tr><td valign="top"></td><td valign="top"><em>data</em> </td><td>Command data </td></tr> <tr><td valign="top"></td><td valign="top"><em>datasize</em> </td><td>Size of the data in bytes </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, -1 on failure </dd></dl> </div> </div> <a class="anchor" id="a002e2dee1a7f736699dba5bec0a81426"></a><!-- doxytag: member="fishsound.h::fish_sound_delete" ref="a002e2dee1a7f736699dba5bec0a81426" args="(FishSound *fsound)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int fish_sound_delete </td> <td>(</td> <td class="paramtype"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> * </td> <td class="paramname"> <em>fsound</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Delete a FishSound object. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fsound</em> </td><td>A FishSound* handle </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, -1 on failure </dd></dl> </div> </div> <a class="anchor" id="ab1672c542e09528b3dad3ee694b124d8"></a><!-- doxytag: member="fishsound.h::fish_sound_flush" ref="ab1672c542e09528b3dad3ee694b124d8" args="(FishSound *fsound)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">long fish_sound_flush </td> <td>(</td> <td class="paramtype"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> * </td> <td class="paramname"> <em>fsound</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Flush any internally buffered data, forcing encode. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fsound</em> </td><td>A FishSound* handle </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, -1 on failure </dd></dl> </div> </div> <a class="anchor" id="ad991f9f6887487f5d833de9480bcbe43"></a><!-- doxytag: member="fishsound.h::fish_sound_get_frameno" ref="ad991f9f6887487f5d833de9480bcbe43" args="(FishSound *fsound)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">long fish_sound_get_frameno </td> <td>(</td> <td class="paramtype"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> * </td> <td class="paramname"> <em>fsound</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Query the current frame number of a FishSound object. </p> <p>For decoding, this is the greatest frame index that has been decoded and made available to a FishSoundDecoded callback. This function is safe to call from within a FishSoundDecoded callback, and corresponds to the frame number of the last frame in the current decoded block.</p> <p>For encoding, this is the greatest frame index that has been encoded. This function is safe to call from within a FishSoundEncoded callback, and corresponds to the frame number of the last frame encoded in the current block.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fsound</em> </td><td>A FishSound* handle </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>The current frame number </dd></dl> <dl><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>-1</em> </td><td>Invalid <em>fsound</em> </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a7bc2b75ad943e2da3147bf33882860c8"></a><!-- doxytag: member="fishsound.h::fish_sound_get_interleave" ref="a7bc2b75ad943e2da3147bf33882860c8" args="(FishSound *fsound)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int fish_sound_get_interleave </td> <td>(</td> <td class="paramtype"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> * </td> <td class="paramname"> <em>fsound</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Query whether a FishSound object is using interleaved PCM. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fsound</em> </td><td>A FishSound* handle </td></tr> </table> </dd> </dl> <dl><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>0</em> </td><td><em>fsound</em> uses non-interleaved PCM </td></tr> <tr><td valign="top"></td><td valign="top"><em>1</em> </td><td><em>fsound</em> uses interleaved PCM </td></tr> <tr><td valign="top"></td><td valign="top"><em>-1</em> </td><td>Invalid <em>fsound</em>, or out of memory. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a2776f39cfa1540b1da3c9d423de15ae9"></a><!-- doxytag: member="fishsound.h::fish_sound_identify" ref="a2776f39cfa1540b1da3c9d423de15ae9" args="(unsigned char *buf, long bytes)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int fish_sound_identify </td> <td>(</td> <td class="paramtype">unsigned char * </td> <td class="paramname"> <em>buf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">long </td> <td class="paramname"> <em>bytes</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Identify a codec based on the first few bytes of data. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>buf</em> </td><td>A pointer to the first few bytes of the data </td></tr> <tr><td valign="top"></td><td valign="top"><em>bytes</em> </td><td>The count of bytes available at buf </td></tr> </table> </dd> </dl> <dl><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>FISH_SOUND_xxxxxx</em> </td><td>FISH_SOUND_VORBIS, FISH_SOUND_SPEEX or FISH_SOUND_FLAC if <em>buf</em> was identified as the initial bytes of a supported codec </td></tr> <tr><td valign="top"></td><td valign="top"><em>FISH_SOUND_UNKNOWN</em> </td><td>if the codec could not be identified </td></tr> <tr><td valign="top"></td><td valign="top"><em>FISH_SOUND_ERR_SHORT_IDENTIFY</em> </td><td>if <em>bytes</em> is less than 8 </td></tr> </table> </dd> </dl> <dl class="note"><dt><b>Note:</b></dt><dd>If <em>bytes</em> is exactly 8, then only a weak check is performed, which is fast but may return a false positive. </dd> <dd> If <em>bytes</em> is greater than 8, then a stronger check is performed in which an attempt is made to decode <em>buf</em> as the initial header of each supported codec. This is unlikely to return a false positive but is only useful if <em>buf</em> is the entire payload of a packet derived from a lower layer such as Ogg framing or UDP datagrams. </dd></dl> </div> </div> <a class="anchor" id="adecddfef35cbbddcc8a76b28c365c527"></a><!-- doxytag: member="fishsound.h::fish_sound_new" ref="adecddfef35cbbddcc8a76b28c365c527" args="(int mode, FishSoundInfo *fsinfo)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a>* fish_sound_new </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>mode</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structFishSoundInfo.html">FishSoundInfo</a> * </td> <td class="paramname"> <em>fsinfo</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Instantiate a new FishSound* handle. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>mode</em> </td><td>FISH_SOUND_DECODE or FISH_SOUND_ENCODE </td></tr> <tr><td valign="top"></td><td valign="top"><em>fsinfo</em> </td><td>Encoder configuration, may be NULL for FISH_SOUND_DECODE </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>A new FishSound* handle, or NULL on error </dd></dl> </div> </div> <a class="anchor" id="a6f4818e09b8323d8461331f46f13ab6a"></a><!-- doxytag: member="fishsound.h::fish_sound_prepare_truncation" ref="a6f4818e09b8323d8461331f46f13ab6a" args="(FishSound *fsound, long next_granulepos, int next_eos)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int fish_sound_prepare_truncation </td> <td>(</td> <td class="paramtype"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> * </td> <td class="paramname"> <em>fsound</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">long </td> <td class="paramname"> <em>next_granulepos</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>next_eos</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Prepare truncation details for the next block of data. </p> <p>The semantics of these parameters derives directly from Ogg encapsulation of Vorbis, described <a href="http://www.xiph.org/ogg/vorbis/doc/Vorbis_I_spec.html#vorbis-over-ogg">here</a>.</p> <p>When decoding from Ogg, you should call this function with the <em>granulepos</em> and <em>eos</em> of the <em>ogg_packet</em> structure. This call should be made before passing the packet's data to <a class="el" href="decode_8h.html#a070a1843d6990a00e2471945d40645c7" title="Decode a block of compressed data.">fish_sound_decode()</a>. Failure to do so may result in minor decode errors on the first and/or last packet of the stream.</p> <p>When encoding into Ogg, you should call this function with the <em>granulepos</em> and <em>eos</em> that will be used for the <em>ogg_packet</em> structure. This call should be made before passing the block of audio data to fish_sound_encode_*(). Failure to do so may result in minor encoding errors on the first and/or last packet of the stream.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fsound</em> </td><td>A FishSound* handle </td></tr> <tr><td valign="top"></td><td valign="top"><em>next_granulepos</em> </td><td>The "granulepos" for the next block to decode. If unknown, set <em>next_granulepos</em> to -1. Otherwise, <em>next_granulepos</em> specifies the frameno of the final frame in the block. This is authoritative, hence can be used to indicate various forms of truncation at the beginning or end of a stream. Mid-stream, a later-than-expected "granulepos" indicates that some data was missing. </td></tr> <tr><td valign="top"></td><td valign="top"><em>next_eos</em> </td><td>A boolean indicating whether the next data block will be the last in the stream. </td></tr> </table> </dd> </dl> <dl><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>Success </td></tr> <tr><td valign="top"></td><td valign="top"><em>-1</em> </td><td>Invalid <em>fsound</em> </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a546a521c2c3c3a2ee614ae3981fbc29f"></a><!-- doxytag: member="fishsound.h::fish_sound_reset" ref="a546a521c2c3c3a2ee614ae3981fbc29f" args="(FishSound *fsound)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int fish_sound_reset </td> <td>(</td> <td class="paramtype"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> * </td> <td class="paramname"> <em>fsound</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Reset the codec state of a FishSound object. </p> <p>When decoding from a seekable file, <a class="el" href="fishsound_8h.html#a546a521c2c3c3a2ee614ae3981fbc29f" title="Reset the codec state of a FishSound object.">fish_sound_reset()</a> should be called after any seek operations. See also <a class="el" href="fishsound_8h.html#a0d508075ecdd834ab5a4504f5e85f66b" title="Set the current frame number of a FishSound object.">fish_sound_set_frameno()</a>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fsound</em> </td><td>A FishSound* handle </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, -1 on failure </dd></dl> </div> </div> <a class="anchor" id="a0d508075ecdd834ab5a4504f5e85f66b"></a><!-- doxytag: member="fishsound.h::fish_sound_set_frameno" ref="a0d508075ecdd834ab5a4504f5e85f66b" args="(FishSound *fsound, long frameno)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int fish_sound_set_frameno </td> <td>(</td> <td class="paramtype"><a class="el" href="fishsound_8h.html#a8cfb7dfb102ad1af9ff35046aed3ccd9">FishSound</a> * </td> <td class="paramname"> <em>fsound</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">long </td> <td class="paramname"> <em>frameno</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Set the current frame number of a FishSound object. </p> <p>When decoding from a seekable file, <a class="el" href="fishsound_8h.html#a0d508075ecdd834ab5a4504f5e85f66b" title="Set the current frame number of a FishSound object.">fish_sound_set_frameno()</a> should be called after any seek operations, otherwise the value returned by <a class="el" href="fishsound_8h.html#ad991f9f6887487f5d833de9480bcbe43" title="Query the current frame number of a FishSound object.">fish_sound_get_frameno()</a> will simply continue to increment. See also <a class="el" href="fishsound_8h.html#a546a521c2c3c3a2ee614ae3981fbc29f" title="Reset the codec state of a FishSound object.">fish_sound_reset()</a>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fsound</em> </td><td>A FishSound* handle </td></tr> <tr><td valign="top"></td><td valign="top"><em>frameno</em> </td><td>The current frame number. </td></tr> </table> </dd> </dl> <dl><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>Success </td></tr> <tr><td valign="top"></td><td valign="top"><em>-1</em> </td><td>Invalid <em>fsound</em> </td></tr> </table> </dd> </dl> </div> </div> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address> </body> </html>