celt.h | celt.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O R | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O R | |||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*/ | */ | |||
#ifndef CELT_H | #ifndef CELT051_H | |||
#define CELT_H | #define CELT051_H | |||
#include "celt_types.h" | #include "celt_types.h" | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#ifndef CELT_H | ||||
#define CELT_H | ||||
#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)) | #define _celt_check_int(x) (((void)((x) == (int)0)), (int)(x)) | |||
skipping to change at line 105 | skipping to change at line 108 | |||
/** State of the decoder. One decoder state is needed for each stream. It i s | /** State of the decoder. One decoder state is needed for each stream. It i s | |||
initialised once at the beginning of the stream. Do *not* re-initialise | initialised once at the beginning of the stream. Do *not* re-initialise | |||
the state for every frame */ | the state for every frame */ | |||
typedef struct CELTDecoder CELTDecoder; | typedef struct CELTDecoder CELTDecoder; | |||
/** The mode contains all the information necessary to create an encoder. B oth | /** The mode contains all the information necessary to create an encoder. B oth | |||
the encoder and decoder need to be initialised with exactly the same mo de, | the encoder and decoder need to be initialised with exactly the same mo de, | |||
otherwise the quality will be very bad */ | otherwise the quality will be very bad */ | |||
typedef struct CELTMode CELTMode; | typedef struct CELTMode CELTMode; | |||
#endif | ||||
/** \defgroup codec Encoding and decoding */ | /** \defgroup codec Encoding and decoding */ | |||
/* @{ */ | /* @{ */ | |||
/* Mode calls */ | /* Mode calls */ | |||
/** 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 96000 Hz) | @param Fs Sampling rate (32000 to 96000 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 | |||
*/ | */ | |||
EXPORT CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_ size, int *error); | EXPORT CELTMode *celt051_mode_create(celt_int32_t Fs, int channels, int fra me_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 | |||
*/ | */ | |||
EXPORT void celt_mode_destroy(CELTMode *mode); | EXPORT void celt051_mode_destroy(CELTMode *mode); | |||
/** Query information from a mode */ | /** Query information from a mode */ | |||
EXPORT int celt_mode_info(const CELTMode *mode, int request, celt_int32_t * value); | EXPORT int celt051_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. | |||
*/ | */ | |||
EXPORT CELTEncoder *celt_encoder_create(const CELTMode *mode); | EXPORT CELTEncoder *celt051_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 celt051_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 | @param pcm PCM audio in signed float format. There must be | |||
* 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 | @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 | * the decoder would decode. It is the same as call ing the | |||
* decoder on the compressed data, just faster. | * 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 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. | |||
*/ | */ | |||
EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, float *opti onal_synthesis, unsigned char *compressed, int nbCompressedBytes); | EXPORT int celt051_encode_float(CELTEncoder *st, const float *pcm, float *o ptional_synthesis, unsigned char *compressed, int nbCompressedBytes); | |||
/** 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 optional_synthesis If not NULL, the encoder copies the audio signal that | @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 | * the decoder would decode. It is the same as call ing the | |||
* decoder on the compressed data, just faster. | * 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 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. | |||
*/ | */ | |||
EXPORT int celt_encode(CELTEncoder *st, const celt_int16_t *pcm, celt_int16 _t *optional_synthesis, unsigned char *compressed, int nbCompressedBytes); | EXPORT int celt051_encode(CELTEncoder *st, const celt_int16_t *pcm, celt_in t16_t *optional_synthesis, unsigned char *compressed, int nbCompressedBytes ); | |||
/** Query and set encoder parameters | /** Query and set encoder parameters | |||
@param st Encoder state | @param st Encoder state | |||
@param request Parameter to change or query | @param request Parameter to change or query | |||
@param value Pointer to a 32-bit int value | @param value Pointer to a 32-bit int value | |||
@return Error code | @return Error code | |||
*/ | */ | |||
EXPORT int celt_encoder_ctl(CELTEncoder * st, int request, ...); | EXPORT int celt051_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 *celt051_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 | |||
*/ | */ | |||
EXPORT void celt_decoder_destroy(CELTDecoder *st); | EXPORT void celt051_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 in float format. | 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); | EXPORT int celt051_decode_float(CELTDecoder *st, unsigned char *data, int l en, float *pcm); | |||
/** 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 in 16-bit PCM format (native endian). | returned here in 16-bit PCM format (native endian). | |||
@return Error code. | @return Error code. | |||
*/ | */ | |||
EXPORT int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_ int16_t *pcm); | EXPORT int celt051_decode(CELTDecoder *st, unsigned char *data, int len, ce lt_int16_t *pcm); | |||
/* @} */ | /* @} */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /*CELT_H */ | #endif /*CELT051_H */ | |||
End of changes. 16 change blocks. | ||||
14 lines changed or deleted | 19 lines changed or added | |||
celt_header.h | celt_header.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O R | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O R | |||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*/ | */ | |||
#ifndef CELT_HEADER_H | #ifndef CELT051_HEADER_H | |||
#define CELT_HEADER_H | #define CELT051_HEADER_H | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#include "celt.h" | #include "celt.h" | |||
#include "celt_types.h" | #include "celt_types.h" | |||
/** Header data to be used for Ogg files (or possibly other encapsulation) | /** Header data to be used for Ogg files (or possibly other encapsulation) | |||
@brief Header data | @brief Header data | |||
skipping to change at line 56 | skipping to change at line 56 | |||
char codec_id[8]; /**< MUST be "CELT " (four spaces) */ | char codec_id[8]; /**< MUST be "CELT " (four spaces) */ | |||
char codec_version[20]; /**< Version used (as string) */ | char codec_version[20]; /**< Version used (as string) */ | |||
celt_int32_t version_id; /**< Version id (negative for until stre am is frozen) */ | celt_int32_t version_id; /**< Version id (negative for until stre am is frozen) */ | |||
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; | } CELT051Header; | |||
/** Creates a basic header struct */ | /** Creates a basic header struct */ | |||
EXPORT void celt_header_init(CELTHeader *header, const CELTMode *m); | EXPORT void celt051_header_init(CELT051Header *header, const CELTMode *m); | |||
EXPORT int celt_header_to_packet(const CELTHeader *header, unsigned char *p acket, celt_uint32_t size); | EXPORT int celt051_header_to_packet(const CELT051Header *header, unsigned c har *packet, celt_uint32_t size); | |||
EXPORT int celt_header_from_packet(const unsigned char *packet, celt_uint32 _t size, CELTHeader *header); | EXPORT int celt051_header_from_packet(const unsigned char *packet, celt_uin t32_t size, CELT051Header *header); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* CELT_HEADER_H */ | #endif /* CELT_HEADER_H */ | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||