| fishsound.h | | fishsound.h | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 65 | |
| * For more information on the design and history of libfishsound, see the | | * For more information on the design and history of libfishsound, see the | |
| * \link about About \endlink section of this documentation, and the | | * \link about About \endlink section of this documentation, and the | |
| * <a href="http://www.annodex.net/software/libfishsound/">libfishsound</a> | | * <a href="http://www.annodex.net/software/libfishsound/">libfishsound</a> | |
| * homepage. | | * homepage. | |
| * | | * | |
| * \subsection contents Contents | | * \subsection contents Contents | |
| * | | * | |
| * - \link fishsound.h fishsound.h \endlink: | | * - \link fishsound.h fishsound.h \endlink: | |
| * Documentation of the FishSound API. | | * Documentation of the FishSound API. | |
| * | | * | |
|
| | | * - \link comments.h Handling comments \endlink: | |
| | | * How to add and retrieve \a name = \a value metadata in Vorbis and Speex | |
| | | * streams. | |
| | | * | |
| * - \link decode Decoding audio data \endlink: | | * - \link decode Decoding audio data \endlink: | |
| * How to decode audio data with FishSound, including source for a fully | | * How to decode audio data with FishSound, including source for a fully | |
| * working Ogg Vorbis and Ogg Speex decoder. | | * working Ogg Vorbis and Ogg Speex decoder. | |
| * | | * | |
| * - \link encode Encoding audio data \endlink: | | * - \link encode Encoding audio data \endlink: | |
| * How to encode audio data with FishSound, including source for a fully | | * How to encode audio data with FishSound, including source for a fully | |
| * working Ogg Vorbis and Ogg Speex encoder. | | * working Ogg Vorbis and Ogg Speex encoder. | |
| * | | * | |
| * - \link configuration Configuration \endlink: | | * - \link configuration Configuration \endlink: | |
| * Customizing libfishsound to only decode or encode, | | * Customizing libfishsound to only decode or encode, | |
| | | | |
| skipping to change at line 334 | | skipping to change at line 338 | |
| * - provide a FishSoundDecoded callback for libfishsound to call when it h
as | | * - provide a FishSoundDecoded callback for libfishsound to call when it h
as | |
| * decoded audio. | | * decoded audio. | |
| * - (optionally) specify whether you want to receive interleaved or | | * - (optionally) specify whether you want to receive interleaved or | |
| * per-channel PCM data, using a fish_sound_set_interleave(). | | * per-channel PCM data, using a fish_sound_set_interleave(). | |
| * The default is for per-channel (non-interleaved) PCM. | | * The default is for per-channel (non-interleaved) PCM. | |
| * - feed encoded audio data to libfishsound via fish_sound_decode(). | | * - feed encoded audio data to libfishsound via fish_sound_decode(). | |
| * libfishsound will decode the audio for you, calling the FishSoundDecoded | | * libfishsound will decode the audio for you, calling the FishSoundDecoded | |
| * callback you provided earlier each time it has a block of audio ready. | | * callback you provided earlier each time it has a block of audio ready. | |
| * - when finished, call fish_sound_delete(). | | * - when finished, call fish_sound_delete(). | |
| * | | * | |
|
| * This procedure is illustrated in src/examples/decode.c. Note that this | | * This procedure is illustrated in src/examples/fishsound-decode.c. | |
| * example additionally: | | * Note that this example additionally: | |
| * - uses <a href="http://www.annodex.net/software/liboggz/">liboggz</a> to | | * - uses <a href="http://www.annodex.net/software/liboggz/">liboggz</a> to | |
| * demultiplex audio data from an Ogg encapsulated Vorbis or Speex stream. | | * demultiplex audio data from an Ogg encapsulated Vorbis or Speex stream. | |
| * Hence, the step of feeding encoded data to libfishsound is done within | | * Hence, the step of feeding encoded data to libfishsound is done within | |
| * the OggzReadPacket callback. | | * the OggzReadPacket callback. | |
| * - uses <a href="http://www.mega-nerd.com/libsndfile/">libsndfile</a> to | | * - uses <a href="http://www.mega-nerd.com/libsndfile/">libsndfile</a> to | |
| * write the decoded audio to a WAV file. | | * write the decoded audio to a WAV file. | |
| * | | * | |
| * Hence this example code demonstrates all that is needed to decode both | | * Hence this example code demonstrates all that is needed to decode both | |
| * Ogg Vorbis and Ogg Speex files: | | * Ogg Vorbis and Ogg Speex files: | |
| * | | * | |
|
| * \include decode.c | | * \include fishsound-decode.c | |
| */ | | */ | |
| | | | |
| /** \defgroup encode Encoding audio data | | /** \defgroup encode Encoding audio data | |
| * | | * | |
| * To encode audio data using libfishsound: | | * To encode audio data using libfishsound: | |
| * | | * | |
| * - create a FishSound* object with mode FISH_SOUND_ENCODE, and with a | | * - create a FishSound* object with mode FISH_SOUND_ENCODE, and with a | |
| * FishSoundInfo structure filled in with the required encoding parameters. | | * FishSoundInfo structure filled in with the required encoding parameters. | |
| * fish_sound_new() will return a new FishSound* object initialised for | | * fish_sound_new() will return a new FishSound* object initialised for | |
| * encoding. | | * encoding. | |
| | | | |
| skipping to change at line 368 | | skipping to change at line 372 | |
| * has a block of encoded audio | | * has a block of encoded audio | |
| * - (optionally) specify whether you will be providing interleaved or | | * - (optionally) specify whether you will be providing interleaved or | |
| * per-channel PCM data, using a fish_sound_set_interleave(). | | * per-channel PCM data, using a fish_sound_set_interleave(). | |
| * The default is for per-channel (non-interleaved) PCM. | | * The default is for per-channel (non-interleaved) PCM. | |
| * - feed raw PCM audio data to libfishsound via fish_sound_encode(). | | * - feed raw PCM audio data to libfishsound via fish_sound_encode(). | |
| * libfishsound will encode the audio for you, calling the FishSoundEncoded | | * libfishsound will encode the audio for you, calling the FishSoundEncoded | |
| * callback you provided earlier each time it has a block of encoded audio | | * callback you provided earlier each time it has a block of encoded audio | |
| * ready. | | * ready. | |
| * - when finished, call fish_sound_delete(). | | * - when finished, call fish_sound_delete(). | |
| * | | * | |
|
| * This procedure is illustrated in src/examples/encode.c. Note that this | | * This procedure is illustrated in src/examples/fishsound-encode.c. | |
| * example additionally: | | * Note that this example additionally: | |
| * - uses <a href="http://www.mega-nerd.com/libsndfile/">libsndfile</a> to | | * - uses <a href="http://www.mega-nerd.com/libsndfile/">libsndfile</a> to | |
| * read input from a PCM audio file (WAV, AIFF, etc.) | | * read input from a PCM audio file (WAV, AIFF, etc.) | |
| * - uses <a href="http://www.annodex.net/software/liboggz/">liboggz</a> to | | * - uses <a href="http://www.annodex.net/software/liboggz/">liboggz</a> to | |
| * encapsulate the encoded Vorbis or Speex data in an Ogg stream. | | * encapsulate the encoded Vorbis or Speex data in an Ogg stream. | |
| * | | * | |
| * Hence this example code demonstrates all that is needed to encode | | * Hence this example code demonstrates all that is needed to encode | |
| * Ogg Vorbis and Ogg Speex files: | | * Ogg Vorbis and Ogg Speex files: | |
| * | | * | |
|
| * \include encode.c | | * \include fishsound-encode.c | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * Info about a particular encoder/decoder instance | | * Info about a particular encoder/decoder instance | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| /** Sample rate of audio data in Hz */ | | /** Sample rate of audio data in Hz */ | |
| int samplerate; | | int samplerate; | |
| | | | |
| /** Count of channels */ | | /** Count of channels */ | |
| | | | |
| skipping to change at line 443 | | skipping to change at line 447 | |
| * \param buf The encoded data | | * \param buf The encoded data | |
| * \param bytes The count of bytes encoded | | * \param bytes The count of bytes encoded | |
| * \param user_data Arbitrary user data | | * \param user_data Arbitrary user data | |
| * \retval 0 to continue | | * \retval 0 to continue | |
| * \retval non-zero to stop encoding immediately and | | * \retval non-zero to stop encoding immediately and | |
| * return control to the fish_sound_encode() caller | | * return control to the fish_sound_encode() caller | |
| */ | | */ | |
| typedef int (*FishSoundEncoded) (FishSound * fsound, unsigned char * buf, | | typedef int (*FishSoundEncoded) (FishSound * fsound, unsigned char * buf, | |
| long bytes, void * user_data); | | long bytes, void * user_data); | |
| | | | |
|
| | | #ifdef __cplusplus | |
| | | extern "C" { | |
| | | #endif | |
| | | | |
| /** | | /** | |
| * Identify a codec based on the first few bytes of data. | | * Identify a codec based on the first few bytes of data. | |
| * \param buf A pointer to the first few bytes of the data | | * \param buf A pointer to the first few bytes of the data | |
| * \param bytes The count of bytes available at buf | | * \param bytes The count of bytes available at buf | |
| * \retval FISH_SOUND_xxxxxx FISH_SOUND_VORBIS, FISH_SOUND_SPEEX if | | * \retval FISH_SOUND_xxxxxx FISH_SOUND_VORBIS, FISH_SOUND_SPEEX if | |
| * \a buf was identified as the initial bytes of a supported codec | | * \a buf was identified as the initial bytes of a supported codec | |
| * \retval FISH_SOUND_UNKNOWN if the codec could not be identified | | * \retval FISH_SOUND_UNKNOWN if the codec could not be identified | |
| * \retval FISH_SOUND_ERR_SHORT_IDENTIFY if \a bytes is less than 8 | | * \retval FISH_SOUND_ERR_SHORT_IDENTIFY if \a bytes is less than 8 | |
| * \note If \a bytes is exactly 8, then only a weak check is performed, | | * \note If \a bytes is exactly 8, then only a weak check is performed, | |
| * which is fast but may return a false positive. | | * which is fast but may return a false positive. | |
| | | | |
| skipping to change at line 522 | | skipping to change at line 530 | |
| long fish_sound_encode (FishSound * fsound, float ** pcm, long frames); | | long fish_sound_encode (FishSound * fsound, float ** pcm, long frames); | |
| | | | |
| /** | | /** | |
| * Flush any internally buffered data, forcing encode | | * Flush any internally buffered data, forcing encode | |
| * \param fsound A FishSound* handle | | * \param fsound A FishSound* handle | |
| * \returns 0 on success, -1 on failure | | * \returns 0 on success, -1 on failure | |
| */ | | */ | |
| long fish_sound_flush (FishSound * fsound); | | long fish_sound_flush (FishSound * fsound); | |
| | | | |
| /** | | /** | |
|
| * Reset the codec state of a FishSound object | | * Reset the codec state of a FishSound object. | |
| | | * | |
| | | * When decoding from a seekable file, fish_sound_reset() should be called | |
| | | * after any seek operations. See also fish_sound_set_frameno(). | |
| | | * | |
| * \param fsound A FishSound* handle | | * \param fsound A FishSound* handle | |
| * \returns 0 on success, -1 on failure | | * \returns 0 on success, -1 on failure | |
| */ | | */ | |
| int fish_sound_reset (FishSound * fsound); | | int fish_sound_reset (FishSound * fsound); | |
| | | | |
| /** | | /** | |
| * Delete a FishSound object | | * Delete a FishSound object | |
| * \param fsound A FishSound* handle | | * \param fsound A FishSound* handle | |
| * \returns 0 on success, -1 on failure | | * \returns 0 on success, -1 on failure | |
| */ | | */ | |
| | | | |
| skipping to change at line 566 | | skipping to change at line 578 | |
| * Set the PCM format used by a FishSound object. The default value is | | * Set the PCM format used by a FishSound object. The default value is | |
| * non-interleaved. | | * non-interleaved. | |
| * \param fsound A FishSound* handle | | * \param fsound A FishSound* handle | |
| * \param interleave Whether to use interleaved PCM or not. Valid values ar
e | | * \param interleave Whether to use interleaved PCM or not. Valid values ar
e | |
| * 0 for non-interleaved, and 1 for interleaved. | | * 0 for non-interleaved, and 1 for interleaved. | |
| * \retval 0 Success | | * \retval 0 Success | |
| * \retval -1 Invalid \a fsound | | * \retval -1 Invalid \a fsound | |
| */ | | */ | |
| int fish_sound_set_interleave (FishSound * fsound, int interleave); | | int fish_sound_set_interleave (FishSound * fsound, int interleave); | |
| | | | |
|
| | | /** | |
| | | * Query the current frame number of a FishSound object. | |
| | | * | |
| | | * 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 fra | |
| | | me | |
| | | * number of the last frame in the current decoded block. | |
| | | * | |
| | | * For encoding, this is the greatest frame index that has been encoded. Th | |
| | | is | |
| | | * 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. | |
| | | * | |
| | | * \param fsound A FishSound* handle | |
| | | * \returns The current frame number | |
| | | * \retval -1 Invalid \a fsound | |
| | | */ | |
| | | long fish_sound_get_frameno (FishSound * fsound); | |
| | | | |
| | | /** | |
| | | * Set the current frame number of a FishSound object. | |
| | | * | |
| | | * When decoding from a seekable file, fish_sound_set_frameno() should be | |
| | | * called after any seek operations, otherwise the value returned by | |
| | | * fish_sound_get_frameno() will simply continue to increment. See also | |
| | | * fish_sound_reset(). | |
| | | * | |
| | | * \param fsound A FishSound* handle | |
| | | * \param frameno The current frame number. | |
| | | * \retval 0 Success | |
| | | * \retval -1 Invalid \a fsound | |
| | | */ | |
| | | int fish_sound_set_frameno (FishSound * fsound, long frameno); | |
| | | | |
| | | #ifdef __cplusplus | |
| | | } | |
| | | #endif | |
| | | | |
| | | #include <fishsound/comments.h> | |
| | | | |
| #endif /* __FISH_SOUND_H__ */ | | #endif /* __FISH_SOUND_H__ */ | |
| | | | |
End of changes. 8 change blocks. |
| 7 lines changed or deleted | | 61 lines changed or added | |
|