libfishsound  1.0.0
Typedefs | Functions
decode.h File Reference

Decode functions and callback prototypes. More...

Go to the source code of this file.

Typedefs

typedef int(* FishSoundDecoded_Float) (FishSound *fsound, float *pcm[], long frames, void *user_data)
 Signature of a callback for libfishsound to call when it has decoded PCM audio data, and you want this provided as non-interleaved floats. More...
 
typedef int(* FishSoundDecoded_FloatIlv) (FishSound *fsound, float **pcm, long frames, void *user_data)
 Signature of a callback for libfishsound to call when it has decoded PCM audio data, and you want this provided as interleaved floats. More...
 

Functions

int fish_sound_set_decoded_float (FishSound *fsound, FishSoundDecoded_Float decoded, void *user_data)
 Set the callback for libfishsound to call when it has a block of decoded PCM audio ready, and you want this provided as non-interleaved floats. More...
 
int fish_sound_set_decoded_float_ilv (FishSound *fsound, FishSoundDecoded_FloatIlv decoded, void *user_data)
 Set the callback for libfishsound to call when it has a block of decoded PCM audio ready, and you want this provided as interleaved floats. More...
 
long fish_sound_decode (FishSound *fsound, unsigned char *buf, long bytes)
 Decode a block of compressed data. More...
 

Detailed Description

Decode functions and callback prototypes.

Typedef Documentation

◆ FishSoundDecoded_Float

typedef int(* FishSoundDecoded_Float) (FishSound *fsound, float *pcm[], long frames, void *user_data)

Signature of a callback for libfishsound to call when it has decoded PCM audio data, and you want this provided as non-interleaved floats.

Parameters
fsoundThe FishSound* handle
pcmThe decoded audio
framesThe count of frames decoded
user_dataArbitrary user data
Return values
FISH_SOUND_CONTINUEContinue decoding
FISH_SOUND_STOP_OKStop decoding immediately and return control to the fish_sound_decode() caller
FISH_SOUND_STOP_ERRStop decoding immediately, purge buffered data, and return control to the fish_sound_decode() caller

◆ FishSoundDecoded_FloatIlv

typedef int(* FishSoundDecoded_FloatIlv) (FishSound *fsound, float **pcm, long frames, void *user_data)

Signature of a callback for libfishsound to call when it has decoded PCM audio data, and you want this provided as interleaved floats.

Parameters
fsoundThe FishSound* handle
pcmThe decoded audio
framesThe count of frames decoded
user_dataArbitrary user data
Return values
FISH_SOUND_CONTINUEContinue decoding
FISH_SOUND_STOP_OKStop decoding immediately and return control to the fish_sound_decode() caller
FISH_SOUND_STOP_ERRStop decoding immediately, purge buffered data, and return control to the fish_sound_decode() caller

Function Documentation

◆ fish_sound_decode()

long fish_sound_decode ( FishSound fsound,
unsigned char *  buf,
long  bytes 
)

Decode a block of compressed data.

No internal buffering is done, so a complete compressed audio packet must be passed each time.

Parameters
fsoundA FishSound* handle (created with mode FISH_SOUND_DECODE)
bufA buffer containing a compressed audio packet
bytesA count of bytes to decode (i.e. the length of buf)
Returns
The number of bytes consumed
Return values
FISH_SOUND_ERR_STOP_OKDecoding was stopped by a FishSoundDecode* callback returning FISH_SOUND_STOP_OK before any input bytes were consumed. This will occur when PCM is decoded from previously buffered input, and stopping is immediately requested.
FISH_SOUND_ERR_STOP_ERRDecoding was stopped by a FishSoundDecode* callback returning FISH_SOUND_STOP_ERR before any input bytes were consumed. This will occur when PCM is decoded from previously buffered input, and stopping is immediately requested.
FISH_SOUND_ERR_BADNot a valid FishSound* handle
FISH_SOUND_ERR_OUT_OF_MEMORYOut of memory

◆ fish_sound_set_decoded_float()

int fish_sound_set_decoded_float ( FishSound fsound,
FishSoundDecoded_Float  decoded,
void *  user_data 
)

Set the callback for libfishsound to call when it has a block of decoded PCM audio ready, and you want this provided as non-interleaved floats.

Parameters
fsoundA FishSound* handle (created with mode FISH_SOUND_DECODE)
decodedThe callback to call
user_dataArbitrary user data to pass to the callback
Return values
0Success
FISH_SOUND_ERR_BADNot a valid FishSound* handle
FISH_SOUND_ERR_OUT_OF_MEMORYOut of memory

◆ fish_sound_set_decoded_float_ilv()

int fish_sound_set_decoded_float_ilv ( FishSound fsound,
FishSoundDecoded_FloatIlv  decoded,
void *  user_data 
)

Set the callback for libfishsound to call when it has a block of decoded PCM audio ready, and you want this provided as interleaved floats.

Parameters
fsoundA FishSound* handle (created with mode FISH_SOUND_DECODE)
decodedThe callback to call
user_dataArbitrary user data to pass to the callback
Return values
0Success
FISH_SOUND_ERR_BADNot a valid FishSound* handle
FISH_SOUND_ERR_OUT_OF_MEMORYOut of memory