celt.h | celt.h | |||
---|---|---|---|---|
skipping to change at line 46 | skipping to change at line 46 | |||
#ifndef CELT_H | #ifndef CELT_H | |||
#define CELT_H | #define CELT_H | |||
#include "celt_types.h" | #include "celt_types.h" | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#if defined(__GNUC__) && defined(CELT_BUILD) | ||||
#define EXPORT __attribute__ ((visibility ("default"))) | ||||
#elif defined(WIN32) | ||||
#define EXPORT __declspec(dllexport) | ||||
#else | ||||
#define EXPORT | ||||
#endif | ||||
/* 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 */ | |||
skipping to change at line 101 | skipping to change at line 109 | |||
/** Creates a new mode struct. This will be passed to an encoder or decoder . | /** 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 | The mode MUST NOT BE DESTROYED until the encoders and decoders that use it | |||
are destroyed as well. | are destroyed as well. | |||
@param Fs Sampling rate (32000 to 64000 Hz) | @param Fs Sampling rate (32000 to 64000 Hz) | |||
@param channels Number of channels | @param channels Number of channels | |||
@param frame_size Number of samples (per channel) to encode in each packet (64 - 256) | @param frame_size Number of samples (per channel) to encode in each packet (64 - 256) | |||
@param lookahead Extra latency (in samples per channel) in addition to the frame size (between 32 and frame_size). The larger that value, the better the quality (at the expense of latency) | @param lookahead Extra latency (in samples per channel) in addition to the frame size (between 32 and frame_size). The larger that value, the better the quality (at the expense of latency) | |||
@param error Returned error code (if NULL, no error will be returned) | @param error Returned error code (if NULL, no error will be returned) | |||
@return A newly created mode | @return A newly created mode | |||
*/ | */ | |||
CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, i nt lookahead, int *error); | EXPORT CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_ size, int *error); | |||
/** Destroys a mode struct. Only call this after all encoders and decoders | /** Destroys a mode struct. Only call this after all encoders and decoders | |||
using this mode are destroyed as well. | using this mode are destroyed as well. | |||
@param mode Mode to be destroyed | @param mode Mode to be destroyed | |||
*/ | */ | |||
void celt_mode_destroy(CELTMode *mode); | EXPORT void celt_mode_destroy(CELTMode *mode); | |||
/** Query information from a mode */ | /** Query information from a mode */ | |||
int celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value); | EXPORT int celt_mode_info(const CELTMode *mode, int request, celt_int32_t * value); | |||
/* Encoder stuff */ | /* Encoder stuff */ | |||
/** Creates a new encoder state. Each stream needs its own encoder state (c an't | /** Creates a new encoder state. Each stream needs its own encoder 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 stream | @param mode Contains all the information about the characteristics of the stream | |||
(must be the same characteristics as used for the decoder) | (must be the same characteristics as used for the decoder) | |||
@return Newly created encoder state. | @return Newly created encoder state. | |||
*/ | */ | |||
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 | |||
*/ | */ | |||
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 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 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 r | "nbCompressedBytes" unless the stream is VBR. If negative, an erro r | |||
has occured (see error codes). It is IMPORTANT that the length ret urned | 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. | be somehow transmitted to the decoder. Otherwise, no decoding is p ossible. | |||
*/ | */ | |||
int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compress ed, int nbCompressedBytes); | EXPORT int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *c ompressed, int nbCompressedBytes); | |||
/* 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. | |||
*/ | */ | |||
CELTDecoder *celt_decoder_create(const CELTMode *mode); | EXPORT CELTDecoder *celt_decoder_create(const CELTMode *mode); | |||
/** Destroys a a decoder state. | /** Destroys a a decoder state. | |||
@param st Decoder state to be destroyed | @param st Decoder state to be destroyed | |||
*/ | */ | |||
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. | |||
@return Error code. | @return Error code. | |||
*/ | */ | |||
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. | ||||
9 lines changed or deleted | 17 lines changed or added | |||
celt_header.h | celt_header.h | |||
---|---|---|---|---|
skipping to change at line 59 | skipping to change at line 59 | |||
celt_int32_t header_size; /**< Size of this header */ | celt_int32_t header_size; /**< Size of this header */ | |||
celt_int32_t sample_rate; /**< Sampling rate of the original audio */ | celt_int32_t sample_rate; /**< Sampling rate of the original audio */ | |||
celt_int32_t nb_channels; /**< Number of channels */ | celt_int32_t nb_channels; /**< Number of channels */ | |||
celt_int32_t frame_size; /**< Samples per frame (per channel) */ | celt_int32_t frame_size; /**< Samples per frame (per channel) */ | |||
celt_int32_t overlap; /**< Overlapping samples (per channel) * / | celt_int32_t overlap; /**< Overlapping samples (per channel) * / | |||
celt_int32_t bytes_per_packet; /**< Number of bytes per compressed pack et (0 if unknown) */ | celt_int32_t bytes_per_packet; /**< Number of bytes per compressed pack et (0 if unknown) */ | |||
celt_int32_t extra_headers; /**< Number of additional headers that f ollow this header */ | celt_int32_t extra_headers; /**< Number of additional headers that f ollow this header */ | |||
} CELTHeader; | } CELTHeader; | |||
/** Creates a basic header struct */ | /** Creates a basic header struct */ | |||
void celt_header_init(CELTHeader *header, const CELTMode *m); | EXPORT void celt_header_init(CELTHeader *header, const CELTMode *m); | |||
int celt_header_to_packet(const CELTHeader *header, unsigned char *packet, celt_uint32_t size); | EXPORT int celt_header_to_packet(const CELTHeader *header, unsigned char *p acket, celt_uint32_t size); | |||
int celt_header_from_packet(const unsigned char *packet, celt_uint32_t size , CELTHeader *header); | EXPORT int celt_header_from_packet(const unsigned char *packet, celt_uint32 _t size, CELTHeader *header); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* CELT_HEADER_H */ | #endif /* CELT_HEADER_H */ | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||