libcelt.celt

@file celt.h @brief Contains all the functions for encoding and decoding audio

Members

Functions

celt_decode
int celt_decode(CELTDecoder* st, ubyte* data, int len, celt_int16* pcm, int frame_size)

Decodes a frame of audio. @param st Decoder state @param data Compressed data produced by an encoder @param len Number of bytes to read from "data". This MUST be exactly the number of bytes returned by the encoder. Using a larger value WILL NOT WORK. @param pcm One frame (frame_size samples per channel) of decoded PCM will be returned here in 16-bit PCM format (native endian). @return Error code.

celt_decode_float
int celt_decode_float(CELTDecoder* st, ubyte* data, int len, float* pcm, int frame_size)

Decodes a frame of audio. @param st Decoder state @param data Compressed data produced by an encoder @param len Number of bytes to read from "data". This MUST be exactly the number of bytes returned by the encoder. Using a larger value WILL NOT WORK. @param pcm One frame (frame_size samples per channel) of decoded PCM will be returned here in float format. @return Error code.

celt_decoder_create
CELTDecoder* celt_decoder_create(CELTMode* mode, int channels, int* error)

Creates a new decoder state. Each stream needs its own decoder state (can't be shared across simultaneous streams). @param mode Contains all the information about the characteristics of the stream (must be the same characteristics as used for the encoder) @param channels Number of channels @param error Returns an error code @return Newly created decoder state.

celt_decoder_ctl
int celt_decoder_ctl(CELTDecoder* st, int request, ...)

Query and set decoder parameters @param st Decoder state @param request Parameter to change or query @param value Pointer to a 32-bit int value @return Error code

celt_decoder_destroy
void celt_decoder_destroy(CELTDecoder* st)

Destroys a a decoder state. @param st Decoder state to be destroyed

celt_encode
int celt_encode(CELTEncoder* st, celt_int16* pcm, int frame_size, ubyte* compressed, int nbCompressedBytes)

Encodes a frame of audio. @param st Encoder state @param pcm PCM audio in signed 16-bit format (native endian). There must be exactly frame_size samples per channel. @param compressed The compressed data is written here. This may not alias pcm or optional_synthesis. @param nbCompressedBytes Maximum number of bytes to use for compressing the frame (can change from one frame to another) @return Number of bytes written to "compressed". Will be the same as "nbCompressedBytes" unless the stream is VBR and will never be larger. If negative, an error has occurred (see error codes). It is IMPORTANT that the length returned be somehow transmitted to the decoder. Otherwise, no decoding is possible.

celt_encode_float
int celt_encode_float(CELTEncoder* st, float* pcm, int frame_size, ubyte* compressed, int nbCompressedBytes)

Encodes a frame of audio. @param st Encoder state @param pcm PCM audio in float format, with a normal range of ±1.0. Samples with a range beyond ±1.0 are supported but will be clipped by decoders using the integer API and should only be used if it is known that the far end supports extended dynmaic range. There must be exactly frame_size samples per channel. @param compressed The compressed data is written here. This may not alias pcm or optional_synthesis. @param nbCompressedBytes Maximum number of bytes to use for compressing the frame (can change from one frame to another) @return Number of bytes written to "compressed". Will be the same as "nbCompressedBytes" unless the stream is VBR and will never be larger. If negative, an error has occurred (see error codes). It is IMPORTANT that the length returned be somehow transmitted to the decoder. Otherwise, no decoding is possible.

celt_encode_resynthesis
int celt_encode_resynthesis(CELTEncoder* st, celt_int16* pcm, celt_int16* optional_resynthesis, int frame_size, ubyte* compressed, int nbCompressedBytes)

Encodes a frame of audio. @param st Encoder state @param pcm PCM audio in signed 16-bit format (native endian). There must be exactly frame_size samples per channel. @param optional_resynthesis If not NULL, the encoder copies the audio signal that the decoder would decode. It is the same as calling the decoder on the compressed data, just faster. This may alias pcm. @param compressed The compressed data is written here. This may not alias pcm or optional_synthesis. @param nbCompressedBytes Maximum number of bytes to use for compressing the frame (can change from one frame to another) @return Number of bytes written to "compressed". Will be the same as "nbCompressedBytes" unless the stream is VBR and will never be larger. If negative, an error has occurred (see error codes). It is IMPORTANT that the length returned be somehow transmitted to the decoder. Otherwise, no decoding is possible.

celt_encode_resynthesis_float
int celt_encode_resynthesis_float(CELTEncoder* st, float* pcm, float* optional_resynthesis, int frame_size, ubyte* compressed, int nbCompressedBytes)

Encodes a frame of audio. @param st Encoder state @param pcm PCM audio in float format, with a normal range of ±1.0. Samples with a range beyond ±1.0 are supported but will be clipped by decoders using the integer API and should only be used if it is known that the far end supports extended dynmaic range. There must be exactly frame_size samples per channel. @param optional_resynthesis If not NULL, the encoder copies the audio signal that the decoder would decode. It is the same as calling the decoder on the compressed data, just faster. This may alias pcm. @param compressed The compressed data is written here. This may not alias pcm or optional_synthesis. @param nbCompressedBytes Maximum number of bytes to use for compressing the frame (can change from one frame to another) @return Number of bytes written to "compressed". Will be the same as "nbCompressedBytes" unless the stream is VBR and will never be larger. If negative, an error has occurred (see error codes). It is IMPORTANT that the length returned be somehow transmitted to the decoder. Otherwise, no decoding is possible.

celt_encoder_create
CELTEncoder* celt_encoder_create(CELTMode* mode, int channels, int* error)

Creates a new encoder state. Each stream needs its own encoder state (can't be shared across simultaneous streams). @param mode Contains all the information about the characteristics of * the stream (must be the same characteristics as used for the * decoder) @param channels Number of channels @param error Returns an error code @return Newly created encoder state.

celt_encoder_ctl
int celt_encoder_ctl(CELTEncoder* st, int request, ...)

Query and set encoder parameters @param st Encoder state @param request Parameter to change or query @param value Pointer to a 32-bit int value @return Error code

celt_encoder_destroy
void celt_encoder_destroy(CELTEncoder* st)

Destroys a an encoder state. @param st Encoder state to be destroyed

celt_mode_create
CELTMode* celt_mode_create(celt_int32 Fs, int frame_size, int* error)

Creates a new mode struct. This will be passed to an encoder or decoder. The mode MUST NOT BE DESTROYED until the encoders and decoders that use it are destroyed as well. @param Fs Sampling rate (32000 to 96000 Hz) @param frame_size Number of samples (per channel) to encode in each packet (even values; 64 - 512) @param error Returned error code (if NULL, no error will be returned) @return A newly created mode

celt_mode_destroy
void celt_mode_destroy(CELTMode* mode)

Destroys a mode struct. Only call this after all encoders and decoders using this mode are destroyed as well. @param mode Mode to be destroyed

celt_mode_info
int celt_mode_info(CELTMode* mode, int request, celt_int32* value)

Query information from a mode

celt_strerror
char* celt_strerror(int error)

Returns the English string that corresponds to an error code @param error Error code (negative for an error, 0 for success @return Constant string (must NOT be freed)

Manifest constants

CELT_ALLOC_FAIL
enum CELT_ALLOC_FAIL;

Memory allocation has failed

CELT_BAD_ARG
enum CELT_BAD_ARG;

An (or more) invalid argument (e.g. out of range)

CELT_CORRUPTED_DATA
enum CELT_CORRUPTED_DATA;

The data passed (e.g. compressed data to decoder) is corrupted

CELT_GET_BITSTREAM_VERSIO
enum CELT_GET_BITSTREAM_VERSIO;

GET the bit-stream version for compatibility check

CELT_GET_LOOKAHEAD
enum CELT_GET_LOOKAHEAD;

GET the lookahead used in the current mode

CELT_GET_MODE_REQUEST
enum CELT_GET_MODE_REQUEST;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
CELT_GET_SAMPLE_RATE
enum CELT_GET_SAMPLE_RATE;

GET the sample rate used in the current mode

CELT_INTERNAL_ERROR
enum CELT_INTERNAL_ERROR;

An internal error was detected

CELT_INVALID_MODE
enum CELT_INVALID_MODE;

The mode struct passed is invalid

CELT_INVALID_STATE
enum CELT_INVALID_STATE;

An encoder or decoder structure is invalid or already freed

CELT_OK
enum CELT_OK;

No error

CELT_RESET_STATE
enum CELT_RESET_STATE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
CELT_RESET_STATE_REQUEST
enum CELT_RESET_STATE_REQUEST;

Reset the encoder/decoder memories to zero

CELT_SET_COMPLEXITY_REQUEST
enum CELT_SET_COMPLEXITY_REQUEST;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
CELT_SET_PREDICTION_REQUEST
enum CELT_SET_PREDICTION_REQUEST;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
CELT_SET_START_BAND_REQUEST
enum CELT_SET_START_BAND_REQUEST;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
CELT_SET_VBR_RATE_REQUEST
enum CELT_SET_VBR_RATE_REQUEST;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
CELT_UNIMPLEMENTED
enum CELT_UNIMPLEMENTED;

Invalid/unsupported request number

_celt_check_int
enum _celt_check_int;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
_celt_check_mode_ptr_ptr
enum _celt_check_mode_ptr_ptr;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Templates

CELT_GET_MODE
template CELT_GET_MODE(x...)

Get the CELTMode used by an encoder or decoder

CELT_SET_COMPLEXITY
template CELT_SET_COMPLEXITY(x...)

Controls the complexity from 0-10 (int)

CELT_SET_PREDICTION
template CELT_SET_PREDICTION(x...)

Controls the use of interframe prediction. 0=Independent frames 1=Short term interframe prediction allowed 2=Long term prediction allowed

CELT_SET_START_BAND
template CELT_SET_START_BAND(x...)

Controls the complexity from 0-10 (int)

CELT_SET_VBR_RATE
template CELT_SET_VBR_RATE(int x)

Set the target VBR rate in bits per second(int); 0=CBR (default)

Tuple
template Tuple(E...)
Undocumented in source.

Meta