123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- #ifndef SPEEX_H
- #define SPEEX_H
- #include "speex_types.h"
- #include "speex_bits.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define SPEEX_SET_ENH 0
- #define SPEEX_GET_ENH 1
- #define SPEEX_GET_FRAME_SIZE 3
- #define SPEEX_SET_QUALITY 4
- #define SPEEX_SET_MODE 6
- #define SPEEX_GET_MODE 7
- #define SPEEX_SET_LOW_MODE 8
- #define SPEEX_GET_LOW_MODE 9
- #define SPEEX_SET_HIGH_MODE 10
- #define SPEEX_GET_HIGH_MODE 11
- #define SPEEX_SET_VBR 12
- #define SPEEX_GET_VBR 13
- #define SPEEX_SET_VBR_QUALITY 14
- #define SPEEX_GET_VBR_QUALITY 15
- #define SPEEX_SET_COMPLEXITY 16
- #define SPEEX_GET_COMPLEXITY 17
- #define SPEEX_SET_BITRATE 18
- #define SPEEX_GET_BITRATE 19
- #define SPEEX_SET_HANDLER 20
- #define SPEEX_SET_USER_HANDLER 22
- #define SPEEX_SET_SAMPLING_RATE 24
- #define SPEEX_GET_SAMPLING_RATE 25
- #define SPEEX_RESET_STATE 26
- #define SPEEX_GET_RELATIVE_QUALITY 29
- #define SPEEX_SET_VAD 30
- #define SPEEX_GET_VAD 31
- #define SPEEX_SET_ABR 32
- #define SPEEX_GET_ABR 33
- #define SPEEX_SET_DTX 34
- #define SPEEX_GET_DTX 35
- #define SPEEX_SET_SUBMODE_ENCODING 36
- #define SPEEX_GET_SUBMODE_ENCODING 37
- #define SPEEX_GET_LOOKAHEAD 39
- #define SPEEX_SET_PLC_TUNING 40
- #define SPEEX_GET_PLC_TUNING 41
- #define SPEEX_SET_VBR_MAX_BITRATE 42
- #define SPEEX_GET_VBR_MAX_BITRATE 43
- #define SPEEX_SET_HIGHPASS 44
- #define SPEEX_GET_HIGHPASS 45
- #define SPEEX_GET_ACTIVITY 47
- #define SPEEX_SET_PF 0
- #define SPEEX_GET_PF 1
- #define SPEEX_MODE_FRAME_SIZE 0
- #define SPEEX_SUBMODE_BITS_PER_FRAME 1
- #define SPEEX_LIB_GET_MAJOR_VERSION 1
- #define SPEEX_LIB_GET_MINOR_VERSION 3
- #define SPEEX_LIB_GET_MICRO_VERSION 5
- #define SPEEX_LIB_GET_EXTRA_VERSION 7
- #define SPEEX_LIB_GET_VERSION_STRING 9
- #define SPEEX_NB_MODES 3
- #define SPEEX_MODEID_NB 0
- #define SPEEX_MODEID_WB 1
- #define SPEEX_MODEID_UWB 2
- struct SpeexMode;
- typedef void *(*encoder_init_func)(const struct SpeexMode *mode);
- typedef void (*encoder_destroy_func)(void *st);
- typedef int (*encode_func)(void *state, void *in, SpeexBits *bits);
- typedef int (*encoder_ctl_func)(void *state, int request, void *ptr);
- typedef void *(*decoder_init_func)(const struct SpeexMode *mode);
- typedef void (*decoder_destroy_func)(void *st);
- typedef int (*decode_func)(void *state, SpeexBits *bits, void *out);
- typedef int (*decoder_ctl_func)(void *state, int request, void *ptr);
- typedef int (*mode_query_func)(const void *mode, int request, void *ptr);
- typedef struct SpeexMode {
-
- const void *mode;
-
- mode_query_func query;
-
- const char *modeName;
-
- int modeID;
-
- int bitstream_version;
-
- encoder_init_func enc_init;
-
- encoder_destroy_func enc_destroy;
-
- encode_func enc;
-
- decoder_init_func dec_init;
-
- decoder_destroy_func dec_destroy;
-
- decode_func dec;
-
- encoder_ctl_func enc_ctl;
-
- decoder_ctl_func dec_ctl;
- } SpeexMode;
- void *speex_encoder_init(const SpeexMode *mode);
- void speex_encoder_destroy(void *state);
- int speex_encode(void *state, float *in, SpeexBits *bits);
- int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits);
- int speex_encoder_ctl(void *state, int request, void *ptr);
- void *speex_decoder_init(const SpeexMode *mode);
- void speex_decoder_destroy(void *state);
- int speex_decode(void *state, SpeexBits *bits, float *out);
- int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out);
- int speex_decoder_ctl(void *state, int request, void *ptr);
- int speex_mode_query(const SpeexMode *mode, int request, void *ptr);
- int speex_lib_ctl(int request, void *ptr);
- extern const SpeexMode speex_nb_mode;
- extern const SpeexMode speex_wb_mode;
- extern const SpeexMode speex_uwb_mode;
- extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES];
- const SpeexMode * speex_lib_get_mode (int mode);
- #ifndef WIN32
- #define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode (mode))
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|