00001
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef CELT_H
00038 #define CELT_H
00039
00040 #include "celt_types.h"
00041
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00046 #if defined(__GNUC__) && defined(CELT_BUILD)
00047 #define EXPORT __attribute__ ((visibility ("default")))
00048 #elif defined(WIN32)
00049 #define EXPORT __declspec(dllexport)
00050 #else
00051 #define EXPORT
00052 #endif
00053
00054 #define _celt_check_int(x) (((void)((x) == (celt_int32_t)0)), (celt_int32_t)(x))
00055 #define _celt_check_mode_ptr_ptr(ptr) ((ptr) + ((ptr) - (CELTMode**)(ptr)))
00056
00057
00059 #define CELT_OK 0
00060
00061 #define CELT_BAD_ARG -1
00062
00063 #define CELT_INVALID_MODE -2
00064
00065 #define CELT_INTERNAL_ERROR -3
00066
00067 #define CELT_CORRUPTED_DATA -4
00068
00069 #define CELT_UNIMPLEMENTED -5
00070
00071 #define CELT_INVALID_STATE -6
00072
00073
00074 #define CELT_GET_MODE_REQUEST 1
00075
00076 #define CELT_GET_MODE(x) CELT_GET_MODE_REQUEST, _celt_check_mode_ptr_ptr(x)
00077 #define CELT_SET_COMPLEXITY_REQUEST 2
00078
00079 #define CELT_SET_COMPLEXITY(x) CELT_SET_COMPLEXITY_REQUEST, _celt_check_int(x)
00080 #define CELT_SET_PREDICTION_REQUEST 4
00081
00086 #define CELT_SET_PREDICTION(x) CELT_SET_PREDICTION_REQUEST, _celt_check_int(x)
00087 #define CELT_SET_VBR_RATE_REQUEST 6
00088
00089 #define CELT_SET_VBR_RATE(x) CELT_SET_VBR_RATE_REQUEST, _celt_check_int(x)
00090
00091 #define CELT_RESET_STATE_REQUEST 8
00092 #define CELT_RESET_STATE CELT_RESET_STATE_REQUEST
00093
00095 #define CELT_GET_FRAME_SIZE 1000
00096
00097 #define CELT_GET_LOOKAHEAD 1001
00098
00099 #define CELT_GET_NB_CHANNELS 1002
00100
00101 #define CELT_GET_SAMPLE_RATE 1003
00102
00104 #define CELT_GET_BITSTREAM_VERSION 2000
00105
00106
00112 typedef struct CELTEncoder CELTEncoder;
00113
00117 typedef struct CELTDecoder CELTDecoder;
00118
00123 typedef struct CELTMode CELTMode;
00124
00125
00127
00128
00129
00130
00141 EXPORT CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, int *error);
00142
00147 EXPORT void celt_mode_destroy(CELTMode *mode);
00148
00150 EXPORT int celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value);
00151
00152
00153
00154
00162 EXPORT CELTEncoder *celt_encoder_create(const CELTMode *mode);
00163
00167 EXPORT void celt_encoder_destroy(CELTEncoder *st);
00168
00191 EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, float *optional_synthesis, unsigned char *compressed, int nbCompressedBytes);
00192
00211 EXPORT int celt_encode(CELTEncoder *st, const celt_int16_t *pcm, celt_int16_t *optional_synthesis, unsigned char *compressed, int nbCompressedBytes);
00212
00219 EXPORT int celt_encoder_ctl(CELTEncoder * st, int request, ...);
00220
00221
00222
00223
00230 EXPORT CELTDecoder *celt_decoder_create(const CELTMode *mode);
00231
00235 EXPORT void celt_decoder_destroy(CELTDecoder *st);
00236
00246 EXPORT int celt_decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm);
00247
00257 EXPORT int celt_decode(CELTDecoder *st, const unsigned char *data, int len, celt_int16_t *pcm);
00258
00265 EXPORT int celt_decoder_ctl(CELTDecoder * st, int request, ...);
00266
00267
00268
00269
00270
00271 #ifdef __cplusplus
00272 }
00273 #endif
00274
00275 #endif