Home Units Hierarchy Routines All identifiers

Unit unaLibCELT

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

libcelt Delphi wrapper.

1.0.2010.11

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
record unaLibCELTAPI  
Class unaLibCELTcoder Base abstract libcelt coder.
Class unaLibCELTdecoder libcelt decoder.
Class unaLibCELTencoder libcelt encoder.
packed record _CELTDecoder  
packed record _CELTEncoder  
packed record _CELTMode  

Functions and Procedures

function celt_loadDLL(var proc: unaLibCELTAPI; const pathAndName: wString = c_libceltDLL): int;
function celt_unloadDLL(var proc: unaLibCELTAPI): int;

Types

celt_int32 = int32;
pCELTEncoder = ˆ_CELTEncoder;
pCELTDecoder = ˆ_CELTDecoder;
pCELTMode = ˆ_CELTMode;
proc_celt_mode_create = function (Fs: celt_int32; frame_size: int; var error: int): pCELTMode; cdecl;
proc_celt_mode_destroy = procedure (mode: pCELTMode); cdecl;
proc_celt_mode_info = function (mode: pCELTMode; request: int; value: celt_int32): int; cdecl;
proc_celt_encoder_get_size = function (channels: int): int; cdecl;
proc_celt_encoder_get_size_custom = function (mode: pCELTMode; channels: int): int; cdecl;
proc_celt_encoder_create = function (sampling_rate: int; channels: int; out error: int): pCELTEncoder; cdecl;
proc_celt_encoder_create_custom = function (mode: pCELTMode; channels: int; out error: int): pCELTEncoder; cdecl;
proc_celt_encoder_init = function (st: pCELTEncoder; sampling_rate: int; channels: int; out error: int): pCELTEncoder; cdecl;
proc_celt_encoder_init_custom = function (st: pCELTEncoder; mode: pCELTMode; channels: int; out error: int): pCELTEncoder; cdecl;
proc_celt_encoder_destroy = procedure (st: pCELTEncoder); cdecl;
proc_celt_encode_float = function (st: pCELTEncoder; pcm: pfloat; frame_size: int; compressed: pointer; maxCompressedBytes: int): int; cdecl;
proc_celt_encode = function (st: pCELTEncoder; pcm: pInt16array; frame_size: int; compressed: pointer; maxCompressedBytes: int): int; cdecl;
proc_celt_encoder_ctl = function (st: pCELTEncoder; request: int; value: pInt32): int; cdecl;
proc_celt_decoder_get_size = function (channels: int): int; cdecl;
proc_celt_decoder_get_size_custom = function (mode: pCELTMode; channels: int): int; cdecl;
proc_celt_decoder_create = function (sampling_rate: int; channels: int; out error: int): pCELTDecoder; cdecl;
proc_celt_decoder_create_custom = function (mode: pCELTMode; channels: int; out error: int): pCELTDecoder; cdecl;
proc_celt_decoder_init = function (st: pCELTDecoder; sampling_rate: int; channels: int; out error: int): pCELTDecoder; cdecl;
proc_celt_decoder_init_custom = function (st: pCELTDecoder; mode: pCELTMode; channels: int; out error: int): pCELTDecoder; cdecl;
proc_celt_decoder_destroy = procedure (st: pCELTDecoder); cdecl;
proc_celt_decode_float = function (st: pCELTDecoder; data: pointer; len: int; pcm: pFloat; frame_size: int): int; cdecl;
proc_celt_decode = function (st: pCELTDecoder; data: pointer; len: int; pcm: pInt16array; frame_size: int): int; cdecl;
proc_celt_decoder_ctl = function (st: pCELTDecoder; request: int; value: pInt32): int; cdecl;
proc_celt_strerror = function (error: int): paChar; cdecl;
punaLibCELTAPI = ˆunaLibCELTAPI;
unaLibCELTcoderDataAvail = procedure(sender: unaObject; data: pointer; len: int) of object;

Constants

CELT_ALLOC_FAIL = -7;
CELT_BAD_ARG = -1;
CELT_CORRUPTED_DATA = -4;
CELT_GET_BITSTREAM_VERSION = 2000;
CELT_GET_LOOKAHEAD = 1001;
CELT_GET_MODE_REQUEST = 1;
CELT_GET_SAMPLE_RATE = 1003;
CELT_INTERNAL_ERROR = -3;
CELT_INVALID_MODE = -2;
CELT_INVALID_STATE = -6;
CELT_OK = 0;
CELT_RESET_STATE = CELT_RESET_STATE_REQUEST;
CELT_RESET_STATE_REQUEST = 8;
CELT_SET_BITRATE_REQUEST = 6;
CELT_SET_CHANNELS_REQUEST = 10002;
CELT_SET_COMPLEXITY_REQUEST = 2;
CELT_SET_END_BAND_REQUEST = 10001;
CELT_SET_INPUT_CLIPPING_REQUEST = 14;
CELT_SET_PREDICTION_REQUEST = 4;
CELT_SET_START_BAND_REQUEST = 10000;
CELT_SET_VBR_CONSTRAINT_REQUEST = 10;
CELT_SET_VBR_REQUEST = 12;
CELT_UNIMPLEMENTED = -5;
c_libceltDLL = 'libcelt.dll';

Description

Functions and Procedures

function celt_loadDLL(var proc: unaLibCELTAPI; const pathAndName: wString = c_libceltDLL): int;

Loads the CELT DLL.

Returns

0 if successuf, -1 is some API is missing or Windows specific error code.

function celt_unloadDLL(var proc: unaLibCELTAPI): int;

Unloads the CELT DLL.

Returns

0 if successuf, or Windows specific error code.

Types

celt_int32 = int32;

* GET the bit-stream version for compatibility check */

pCELTEncoder = ˆ_CELTEncoder;

Contains the state of an encoder. One encoder state is needed for each stream. It is initialised once at the beginning of the stream. Do *not* re-initialise the state for every frame.

Encoder state

pCELTDecoder = ˆ_CELTDecoder;

State of the decoder. One decoder state is needed for each stream. It is initialised once at the beginning of the stream. Do *not* re-initialise the state for every frame

pCELTMode = ˆ_CELTMode;

The mode contains all the information necessary to create an encoder. Both the encoder and decoder need to be initialised with exactly the same mode, otherwise the quality will be very bad

proc_celt_mode_create = function (Fs: celt_int32; frame_size: int; var error: int): pCELTMode; cdecl;

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.

Parameters
Fs
Sampling rate (32000 to 96000 Hz)
frame_size
Number of samples (per channel) to encode in each packet (even values; 64 - 512)
error
Returned error code (if NULL, no error will be returned)
Returns

A newly created mode

proc_celt_mode_destroy = procedure (mode: pCELTMode); cdecl;

Destroys a mode struct. Only call this after all encoders and decoders using this mode are destroyed as well.

Parameters
mode
Mode to be destroyed
proc_celt_mode_info = function (mode: pCELTMode; request: int; value: celt_int32): int; cdecl;

Query information from a mode

proc_celt_encoder_get_size = function (channels: int): int; cdecl;
 
Returns

size of mode struct with custom data?

proc_celt_encoder_get_size_custom = function (mode: pCELTMode; channels: int): int; cdecl;
 
Returns

size of mode struct with custom data?

proc_celt_encoder_create = function (sampling_rate: int; channels: int; out error: int): pCELTEncoder; cdecl;

Creates a new encoder state. Each stream needs its own encoder state (can't be shared across simultaneous streams).

Parameters
sampling_rate
Sampling rate
channels
Number of channels
error
Returns an error code
Returns

Newly created encoder state.

proc_celt_encoder_create_custom = function (mode: pCELTMode; channels: int; out error: int): pCELTEncoder; cdecl;

Creates a new encoder state. Each stream needs its own encoder state (can't be shared across simultaneous streams).

* the stream (must be the same characteristics as used for the * decoder)

Parameters
mode
Contains all the information about the characteristics of
channels
Number of channels
error
Returns an error code
Returns

Newly created encoder state.

proc_celt_encoder_init = function (st: pCELTEncoder; sampling_rate: int; channels: int; out error: int): pCELTEncoder; cdecl;

Re-initializes the encoder?

proc_celt_encoder_init_custom = function (st: pCELTEncoder; mode: pCELTMode; channels: int; out error: int): pCELTEncoder; cdecl;

Re-initializes the encoder?

proc_celt_encoder_destroy = procedure (st: pCELTEncoder); cdecl;

Destroys a an encoder state.

Parameters
st
Encoder state to be destroyed
proc_celt_encode_float = function (st: pCELTEncoder; pcm: pfloat; frame_size: int; compressed: pointer; maxCompressedBytes: int): int; cdecl;

Encodes a frame of audio.

* 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. * optional_synthesis. * (can change from one frame to another) * "maxCompressedBytes" 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.

Parameters
st
Encoder state
pcm
PCM audio in float format, with a normal range of ±1.0.
compressed
The compressed data is written here. This may not alias pcm or
maxCompressedBytes
Maximum number of bytes to use for compressing the frame
Returns

Number of bytes written to "compressed". Will be the same as

proc_celt_encode = function (st: pCELTEncoder; pcm: pInt16array; frame_size: int; compressed: pointer; maxCompressedBytes: int): int; cdecl;

Encodes a frame of audio.

* exactly frame_size samples per channel. * optional_synthesis. * (can change from one frame to another) * "maxCompressedBytes" 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.

Parameters
st
Encoder state
pcm
PCM audio in signed 16-bit format (native endian). There must be
compressed
The compressed data is written here. This may not alias pcm or
nbCompressedBytes
Maximum number of bytes to use for compressing the frame
Returns

Number of bytes written to "compressed". Will be the same as

proc_celt_encoder_ctl = function (st: pCELTEncoder; request: int; value: pInt32): int; cdecl;

Query and set encoder parameters

Parameters
st
Encoder state
request
Parameter to change or query
value
Pointer to a 32-bit int value
Returns

Error code

proc_celt_decoder_get_size = function (channels: int): int; cdecl;
 
proc_celt_decoder_get_size_custom = function (mode: pCELTMode; channels: int): int; cdecl;
 
proc_celt_decoder_create = function (sampling_rate: int; channels: int; out error: int): pCELTDecoder; cdecl;

Creates a new decoder state. Each stream needs its own decoder state (can't be shared across simultaneous streams).

Parameters
sampling_rate
Sampling rate
channels
Number of channels
error
Returns an error code
Returns

Newly created decoder state.

proc_celt_decoder_create_custom = function (mode: pCELTMode; channels: int; out error: int): pCELTDecoder; cdecl;

Creates a new decoder state. Each stream needs its own decoder state (can't be shared across simultaneous streams).

stream (must be the same characteristics as used for the encoder)

Parameters
mode
Contains all the information about the characteristics of the
channels
Number of channels
error
Returns an error code
Returns

Newly created decoder state.

proc_celt_decoder_init = function (st: pCELTDecoder; sampling_rate: int; channels: int; out error: int): pCELTDecoder; cdecl;

Re-initializes decoder?

proc_celt_decoder_init_custom = function (st: pCELTDecoder; mode: pCELTMode; channels: int; out error: int): pCELTDecoder; cdecl;

Re-initializes decoder?

proc_celt_decoder_destroy = procedure (st: pCELTDecoder); cdecl;

Destroys a a decoder state.

Parameters
st
Decoder state to be destroyed
proc_celt_decode_float = function (st: pCELTDecoder; data: pointer; len: int; pcm: pFloat; frame_size: int): int; cdecl;

Decodes a frame of audio.

of bytes returned by the encoder. Using a larger value WILL NOT WORK. returned here in float format.

Parameters
st
Decoder state
data
Compressed data produced by an encoder
len
Number of bytes to read from "data". This MUST be exactly the number
pcm
One frame (frame_size samples per channel) of decoded PCM will be
Returns

Error code.

proc_celt_decode = function (st: pCELTDecoder; data: pointer; len: int; pcm: pInt16array; frame_size: int): int; cdecl;

Decodes a frame of audio.

of bytes returned by the encoder. Using a larger value WILL NOT WORK. returned here in 16-bit PCM format (native endian).

Parameters
st
Decoder state
data
Compressed data produced by an encoder
len
Number of bytes to read from "data". This MUST be exactly the number
pcm
One frame (frame_size samples per channel) of decoded PCM will be
Returns

Error code.

proc_celt_decoder_ctl = function (st: pCELTDecoder; request: int; value: pInt32): int; cdecl;

Query and set decoder parameters

Parameters
st
Decoder state
request
Parameter to change or query
value
Pointer to a 32-bit int value
Returns

Error code

proc_celt_strerror = function (error: int): paChar; cdecl;

Returns the English string that corresponds to an error code

Parameters
error
Error code (negative for an error, 0 for success
Returns

Constant string (must NOT be freed)

punaLibCELTAPI = ˆunaLibCELTAPI;

#endif /*CELT_H */

unaLibCELTcoderDataAvail = procedure(sender: unaObject; data: pointer; len: int) of object;

Data avail event.

Constants

CELT_ALLOC_FAIL = -7;

* An encoder or decoder structure is invalid or already freed */

CELT_BAD_ARG = -1;

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

CELT_CORRUPTED_DATA = -4;

* An internal error was detected */

CELT_GET_BITSTREAM_VERSION = 2000;

* GET the sample rate used in the current mode */

CELT_GET_LOOKAHEAD = 1001;
 
CELT_GET_MODE_REQUEST = 1;

* Memory allocation has failed */ Requests */

CELT_GET_SAMPLE_RATE = 1003;

* GET the lookahead used in the current mode */

CELT_INTERNAL_ERROR = -3;

* The mode struct passed is invalid */

CELT_INVALID_MODE = -2;
 
CELT_INVALID_STATE = -6;

* Invalid/unsupported request number */

CELT_OK = 0;

#ifndef CELT_H #define CELT_H #include "celt_types.h" #ifdef __cplusplus extern "C" { #endif Error codes */ * No error */

CELT_RESET_STATE = CELT_RESET_STATE_REQUEST;

* Reset the encoder/decoder memories to zero*/

CELT_RESET_STATE_REQUEST = 8;

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

CELT_SET_BITRATE_REQUEST = 6;

#define CELT_SET_PREDICTION(x) CELT_SET_PREDICTION_REQUEST, _celt_check_int(x)

CELT_SET_CHANNELS_REQUEST = 10002;
 
CELT_SET_COMPLEXITY_REQUEST = 2;

* Get the CELTMode used by an encoder or decoder */

CELT_SET_END_BAND_REQUEST = 10001;
 
CELT_SET_INPUT_CLIPPING_REQUEST = 14;
 
CELT_SET_PREDICTION_REQUEST = 4;

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

CELT_SET_START_BAND_REQUEST = 10000;
 
CELT_SET_VBR_CONSTRAINT_REQUEST = 10;
 
CELT_SET_VBR_REQUEST = 12;
 
CELT_UNIMPLEMENTED = -5;

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

c_libceltDLL = 'libcelt.dll';
 

Author

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09