celt.h | celt.h | |||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
#endif | #endif | |||
#if defined(__GNUC__) && defined(CELT_BUILD) | #if defined(__GNUC__) && defined(CELT_BUILD) | |||
#define EXPORT __attribute__ ((visibility ("default"))) | #define EXPORT __attribute__ ((visibility ("default"))) | |||
#elif defined(WIN32) | #elif defined(WIN32) | |||
#define EXPORT __declspec(dllexport) | #define EXPORT __declspec(dllexport) | |||
#else | #else | |||
#define EXPORT | #define EXPORT | |||
#endif | #endif | |||
#define _celt_check_int(x) (((void)((x) == (int)0)), (int)(x)) | ||||
/* Error codes */ | /* Error codes */ | |||
/** No error */ | /** No error */ | |||
#define CELT_OK 0 | #define CELT_OK 0 | |||
/** An (or more) invalid argument (e.g. out of range) */ | /** An (or more) invalid argument (e.g. out of range) */ | |||
#define CELT_BAD_ARG -1 | #define CELT_BAD_ARG -1 | |||
/** The mode struct passed is invalid */ | /** The mode struct passed is invalid */ | |||
#define CELT_INVALID_MODE -2 | #define CELT_INVALID_MODE -2 | |||
/** An internal error was detected */ | /** An internal error was detected */ | |||
#define CELT_INTERNAL_ERROR -3 | #define CELT_INTERNAL_ERROR -3 | |||
/** The data passed (e.g. compressed data to decoder) is corrupted */ | /** The data passed (e.g. compressed data to decoder) is corrupted */ | |||
#define CELT_CORRUPTED_DATA -4 | #define CELT_CORRUPTED_DATA -4 | |||
/** Invalid/unsupported request number */ | ||||
#define CELT_UNIMPLEMENTED -5 | ||||
/* Requests */ | /* Requests */ | |||
#define CELT_SET_COMPLEXITY_REQUEST 2 | ||||
/** Controls the complexity from 0-10 (int) */ | ||||
#define CELT_SET_COMPLEXITY(x) CELT_SET_COMPLEXITY_REQUEST, _celt_check_int | ||||
(x) | ||||
/** GET the frame size used in the current mode */ | /** GET the frame size used in the current mode */ | |||
#define CELT_GET_FRAME_SIZE 1000 | #define CELT_GET_FRAME_SIZE 1000 | |||
/** GET the lookahead used in the current mode */ | /** GET the lookahead used in the current mode */ | |||
#define CELT_GET_LOOKAHEAD 1001 | #define CELT_GET_LOOKAHEAD 1001 | |||
/** GET the number of channels used in the current mode */ | /** GET the number of channels used in the current mode */ | |||
#define CELT_GET_NB_CHANNELS 1002 | #define CELT_GET_NB_CHANNELS 1002 | |||
/** GET the bit-stream version for compatibility check */ | /** GET the bit-stream version for compatibility check */ | |||
#define CELT_GET_BITSTREAM_VERSION 2000 | #define CELT_GET_BITSTREAM_VERSION 2000 | |||
skipping to change at line 137 | skipping to change at line 145 | |||
*/ | */ | |||
EXPORT CELTEncoder *celt_encoder_create(const CELTMode *mode); | EXPORT CELTEncoder *celt_encoder_create(const CELTMode *mode); | |||
/** Destroys a an encoder state. | /** Destroys a an encoder state. | |||
@param st Encoder state to be destroyed | @param st Encoder state to be destroyed | |||
*/ | */ | |||
EXPORT void celt_encoder_destroy(CELTEncoder *st); | EXPORT void celt_encoder_destroy(CELTEncoder *st); | |||
/** Encodes a frame of audio. | /** Encodes a frame of audio. | |||
@param st Encoder state | @param st Encoder state | |||
@param pcm PCM audio in signed float format. There must be | ||||
* exactly frame_size samples per channel. The input data is | ||||
* overwritten by a copy of what the remote decoder would decode. | ||||
@param optional_synthesis If not NULL, the encoder copies the audio signal | ||||
that | ||||
* the decoder would decode. It is the same as call | ||||
ing the | ||||
* decoder on the compressed data, just faster. | ||||
@param compressed The compressed data is written here | ||||
@param nbCompressedBytes Number of bytes to use for compressing the frame | ||||
* (can change from one frame to another) | ||||
@return Number of bytes written to "compressed". Should be the same as | ||||
* "nbCompressedBytes" unless the stream is VBR. If negative, an erro | ||||
r | ||||
* has occured (see error codes). It is IMPORTANT that the length ret | ||||
urned | ||||
* be somehow transmitted to the decoder. Otherwise, no decoding is p | ||||
ossible. | ||||
*/ | ||||
EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, float *opti | ||||
onal_synthesis, unsigned char *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 b e | @param pcm PCM audio in signed 16-bit format (native endian). There must b e | |||
exactly frame_size samples per channel. The input data is | * exactly frame_size samples per channel. The input data is | |||
overwritten by a copy of what the remote decoder would decode. | * overwritten by a copy of what the remote decoder would decode. | |||
@param optional_synthesis If not NULL, the encoder copies the audio signal | ||||
that | ||||
* the decoder would decode. It is the same as call | ||||
ing the | ||||
* decoder on the compressed data, just faster. | ||||
@param compressed The compressed data is written here | @param compressed The compressed data is written here | |||
@param nbCompressedBytes Number of bytes to use for compressing the frame | @param nbCompressedBytes Number of bytes to use for compressing the frame | |||
(can change from one frame to another) | * (can change from one frame to another) | |||
@return Number of bytes written to "compressed". Should be the same as | @return Number of bytes written to "compressed". Should be the same as | |||
"nbCompressedBytes" unless the stream is VBR. If negative, an erro | * "nbCompressedBytes" unless the stream is VBR. If negative, an erro | |||
r | r | |||
has occured (see error codes). It is IMPORTANT that the length ret | * has occured (see error codes). It is IMPORTANT that the length ret | |||
urned | urned | |||
be somehow transmitted to the decoder. Otherwise, no decoding is p | * be somehow transmitted to the decoder. Otherwise, no decoding is p | |||
ossible. | ossible. | |||
*/ | ||||
EXPORT int celt_encode(CELTEncoder *st, const celt_int16_t *pcm, celt_int16 | ||||
_t *optional_synthesis, unsigned char *compressed, int nbCompressedBytes); | ||||
/** 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 | ||||
*/ | */ | |||
EXPORT int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *c ompressed, int nbCompressedBytes); | EXPORT int celt_encoder_ctl(CELTEncoder * st, int request, ...); | |||
/* Decoder stuff */ | /* Decoder stuff */ | |||
/** Creates a new decoder state. Each stream needs its own decoder state (c an't | /** Creates a new decoder state. Each stream needs its own decoder state (c an't | |||
be shared across simultaneous streams). | be shared across simultaneous streams). | |||
@param mode Contains all the information about the characteristics of the | @param mode Contains all the information about the characteristics of the | |||
stream (must be the same characteristics as used for the encod er) | stream (must be the same characteristics as used for the encod er) | |||
@return Newly created decoder state. | @return Newly created decoder state. | |||
*/ | */ | |||
EXPORT CELTDecoder *celt_decoder_create(const CELTMode *mode); | EXPORT CELTDecoder *celt_decoder_create(const CELTMode *mode); | |||
skipping to change at line 171 | skipping to change at line 207 | |||
@param st Decoder state to be destroyed | @param st Decoder state to be destroyed | |||
*/ | */ | |||
EXPORT void celt_decoder_destroy(CELTDecoder *st); | EXPORT void celt_decoder_destroy(CELTDecoder *st); | |||
/** Decodes a frame of audio. | /** Decodes a frame of audio. | |||
@param st Decoder state | @param st Decoder state | |||
@param data Compressed data produced by an encoder | @param data Compressed data produced by an encoder | |||
@param len Number of bytes to read from "data". This MUST be exactly the n umber | @param len Number of bytes to read from "data". This MUST be exactly the n umber | |||
of bytes returned by the encoder. Using a larger value WILL NOT WORK. | 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 | @param pcm One frame (frame_size samples per channel) of decoded PCM will be | |||
returned here. | returned here in float format. | |||
@return Error code. | @return Error code. | |||
*/ | */ | |||
EXPORT int celt_decode_float(CELTDecoder *st, unsigned char *data, int len, | ||||
float *pcm); | ||||
/** 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 n | ||||
umber | ||||
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. | ||||
*/ | ||||
EXPORT int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_ int16_t *pcm); | EXPORT int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_ int16_t *pcm); | |||
/* @} */ | /* @} */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /*CELT_H */ | #endif /*CELT_H */ | |||
End of changes. 10 change blocks. | ||||
11 lines changed or deleted | 71 lines changed or added | |||