00001
00002
00003
00004
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
00038
00039 #ifndef CELT_H
00040 #define CELT_H
00041
00042 #include "celt_types.h"
00043
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047
00048 #if defined(__GNUC__) && defined(CELT_BUILD)
00049 #define EXPORT __attribute__ ((visibility ("default")))
00050 #elif defined(WIN32)
00051 #define EXPORT __declspec(dllexport)
00052 #else
00053 #define EXPORT
00054 #endif
00055
00056 #define _celt_check_int(x) (((void)((x) == (celt_int32)0)), (celt_int32)(x))
00057 #define _celt_check_mode_ptr_ptr(ptr) ((ptr) + ((ptr) - (CELTMode**)(ptr)))
00058
00059
00061 #define CELT_OK 0
00062
00063 #define CELT_BAD_ARG -1
00064
00065 #define CELT_INVALID_MODE -2
00066
00067 #define CELT_INTERNAL_ERROR -3
00068
00069 #define CELT_CORRUPTED_DATA -4
00070
00071 #define CELT_UNIMPLEMENTED -5
00072
00073 #define CELT_INVALID_STATE -6
00074
00075 #define CELT_ALLOC_FAIL -7
00076
00077
00078 #define CELT_GET_MODE_REQUEST 1
00079
00080 #define CELT_GET_MODE(x) CELT_GET_MODE_REQUEST, _celt_check_mode_ptr_ptr(x)
00081 #define CELT_SET_COMPLEXITY_REQUEST 2
00082
00083 #define CELT_SET_COMPLEXITY(x) CELT_SET_COMPLEXITY_REQUEST, _celt_check_int(x)
00084 #define CELT_SET_PREDICTION_REQUEST 4
00085
00090 #define CELT_SET_PREDICTION(x) CELT_SET_PREDICTION_REQUEST, _celt_check_int(x)
00091 #define CELT_SET_VBR_RATE_REQUEST 6
00092
00093 #define CELT_SET_VBR_RATE(x) CELT_SET_VBR_RATE_REQUEST, _celt_check_int(x)
00094
00095 #define CELT_RESET_STATE_REQUEST 8
00096 #define CELT_RESET_STATE CELT_RESET_STATE_REQUEST
00097
00099 #define CELT_GET_FRAME_SIZE 1000
00100
00101 #define CELT_GET_LOOKAHEAD 1001
00102
00103 #define CELT_GET_SAMPLE_RATE 1003
00104
00106 #define CELT_GET_BITSTREAM_VERSION 2000
00107
00108
00114 typedef struct CELTEncoder CELTEncoder;
00115
00119 typedef struct CELTDecoder CELTDecoder;
00120
00125 typedef struct CELTMode CELTMode;
00126
00127
00129
00130
00131
00132
00142 EXPORT CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error);
00143
00148 EXPORT void celt_mode_destroy(CELTMode *mode);
00149
00151 EXPORT int celt_mode_info(const CELTMode *mode, int request, celt_int32 *value);
00152
00153
00154
00155
00165 EXPORT CELTEncoder *celt_encoder_create(const CELTMode *mode, int channels, int *error);
00166
00170 EXPORT void celt_encoder_destroy(CELTEncoder *st);
00171
00194 EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, float *optional_synthesis, unsigned char *compressed, int nbCompressedBytes);
00195
00214 EXPORT int celt_encode(CELTEncoder *st, const celt_int16 *pcm, celt_int16 *optional_synthesis, unsigned char *compressed, int nbCompressedBytes);
00215
00222 EXPORT int celt_encoder_ctl(CELTEncoder * st, int request, ...);
00223
00224
00225
00226
00235 EXPORT CELTDecoder *celt_decoder_create(const CELTMode *mode, int channels, int *error);
00236
00240 EXPORT void celt_decoder_destroy(CELTDecoder *st);
00241
00251 EXPORT int celt_decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm);
00252
00262 EXPORT int celt_decode(CELTDecoder *st, const unsigned char *data, int len, celt_int16 *pcm);
00263
00270 EXPORT int celt_decoder_ctl(CELTDecoder * st, int request, ...);
00271
00272
00277 EXPORT const char *celt_strerror(int error);
00278
00279
00280
00281
00282 #ifdef __cplusplus
00283 }
00284 #endif
00285
00286 #endif