#ifndef _WAMR_CODEC_H_ #define _WAMR_CODEC_H_ #if 0 #if defined _WIN32 || defined __CYGWIN__ #ifdef EVRC_BUILDING_DLL #ifdef __GNUC__ #define DLL_PUBLIC __attribute__ ((dllexport)) #else #define DLL_PUBLIC __declspec(dllexport) // Note: actually gcc seems to also supports this syntax. #endif #else #ifdef __GNUC__ #define DLL_PUBLIC __attribute__ ((dllimport)) #else #define DLL_PUBLIC __declspec(dllimport) // Note: actually gcc seems to also supports this syntax. #endif #endif #define DLL_LOCAL #else #if __GNUC__ >= 4 #define DLL_PUBLIC __attribute__ ((visibility ("default"))) #define DLL_LOCAL __attribute__ ((visibility ("hidden"))) #else #define DLL_PUBLIC #define DLL_LOCAL #endif #endif #endif #include #include "cnst.h" #define MMS_IO #if defined _WIN32 #include "stdint_win32.h" #else #include #endif #ifdef __cplusplus extern "C" { #endif /* frame size in serial bitstream file (frame type + serial stream + flags) */ #define SERIAL_FRAMESIZE (1+MAX_SERIAL_SIZE+5) #define MAX_PACKED_SIZE (MAX_SERIAL_SIZE / 8 + 2) #define UMR475 0 #define UMR515 1 #define UMR59 2 #define UMR67 3 #define UMR74 4 #define UMR795 5 #define UMR102 6 #define UMR122 7 #define UMRDTX 8 #define UN_MODES 9 /* number of (SPC) modes */ #define AMRC_INIT_OK 0 #define AMRC_INIT_FAILED 1 #define AMRC_CODEC_SUCC 0 #define AMRC_CODEC_ERROR -1 #define AMRC_CODEC_BUFFER_SMALL -2 #define AMRC_CODEC_BUFFER_ERR -3 #define PACKED_SIZE_ITEM 16 //packed_size的元素个数 extern const short packed_size[16]; int wamr_encoder_init(); void wamr_encoder_uninit(); int wamr_decoder_init(); void wamr_decoder_uninit(); //new_speech,input pcm speech //speech_size, has to be 160 //outPacked, output amr packed buffer //outPacked_size, size of outPacked, can not small than 32 //outLen, real output size number for outPacked //mode, encode mode //return AMRC_CODEC_SUCC for if no error int wamr_encoder_encode_frame(short *new_speech, int speech_size, unsigned char *outPacked, int outPacked_size, unsigned short *outLen, int mode); int wamr_decoder_decode_frame(unsigned char *inpackedBits, unsigned short inpacked_size, short *outSpeech, unsigned short out_size); #ifdef __cplusplus } #endif #endif