1 /* GPL-2.0 WITH Linux-syscall-note OR Apache 2.0 */ 2 /* Copyright (c) 2021 Fuzhou Rockchip Electronics Co., Ltd */ 3 4 #ifndef INCLUDE_RT_MPI_RK_COMM_AENC_H_ 5 #define INCLUDE_RT_MPI_RK_COMM_AENC_H_ 6 7 #include "rk_type.h" 8 #include "rk_common.h" 9 #include "rk_comm_aio.h" 10 11 #ifdef __cplusplus 12 #if __cplusplus 13 extern "C" { 14 #endif 15 #endif /* End of #ifdef __cplusplus */ 16 17 typedef struct rkAENC_ATTR_CODEC_S { 18 RK_CODEC_ID_E enType; 19 AUDIO_BIT_WIDTH_E enBitwidth; 20 RK_U32 u32Channels; 21 RK_U32 u32SampleRate; 22 RK_U32 u32Bitrate; 23 24 RK_U32 u32Resv[4]; /* resv for user */ 25 RK_VOID *pstResv; /* resv for user */ 26 } AENC_ATTR_CODEC_S; 27 28 typedef struct rkAENC_CHN_ATTR_S { 29 RK_CODEC_ID_E enType; /* audio codec id */ 30 RK_U32 u32BufCount; /* encode buffer count */ 31 32 AENC_ATTR_CODEC_S stCodecAttr; 33 } AENC_CHN_ATTR_S; 34 35 typedef struct rkAENC_ENCODER_S { 36 RK_CODEC_ID_E enType; 37 RK_U32 u32MaxFrmLen; 38 RK_CHAR aszName[17]; 39 RK_S32 (*pfnOpenEncoder)(RK_VOID *pEncoderAttr, RK_VOID **ppEncoder); 40 RK_S32 (*pfnEncodeFrm)(RK_VOID *pEncoder, RK_VOID *pParam); 41 RK_S32 (*pfnCloseEncoder)(RK_VOID *pEncoder); 42 } AENC_ENCODER_S; 43 44 typedef enum rkEN_AENC_ERR_CODE_E { 45 AENC_ERR_ENCODER_ERR = 64, 46 AENC_ERR_VQE_ERR = 65, 47 AENC_ERR_REGISTER_ERR = 66 48 } EN_AENC_ERR_CODE_E; 49 50 /* result of register AENC */ 51 typedef enum rkENC_ENCODER_RESULT { 52 AENC_ENCODER_OK = RK_SUCCESS, 53 AENC_ENCODER_TRY_AGAIN, 54 AENC_ENCODER_ERROR, 55 AENC_ENCODER_EOS, 56 } AENC_ENCODER_RESULT; 57 58 /* invlalid device ID */ 59 #define RK_ERR_AENC_INVALID_DEVID RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_INVALID_DEVID) 60 /* invlalid channel ID */ 61 #define RK_ERR_AENC_INVALID_CHNID RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_INVALID_CHNID) 62 /* at lease one parameter is illagal ,eg, an illegal enumeration value */ 63 #define RK_ERR_AENC_ILLEGAL_PARAM RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_ILLEGAL_PARAM) 64 /* channel exists */ 65 #define RK_ERR_AENC_EXIST RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_EXIST) 66 /* channel unexists */ 67 #define RK_ERR_AENC_UNEXIST RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_UNEXIST) 68 /* using a NULL point */ 69 #define RK_ERR_AENC_NULL_PTR RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_NULL_PTR) 70 /* try to enable or initialize system,device or channel, before configing attribute */ 71 #define RK_ERR_AENC_NOT_CONFIG RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_NOT_CONFIG) 72 /* operation is not supported by NOW */ 73 #define RK_ERR_AENC_NOT_SUPPORT RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_NOT_SUPPORT) 74 /* operation is not permitted ,eg, try to change static attribute */ 75 #define RK_ERR_AENC_NOT_PERM RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_NOT_PERM) 76 /* failure caused by malloc memory */ 77 #define RK_ERR_AENC_NOMEM RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_NOMEM) 78 /* failure caused by malloc buffer */ 79 #define RK_ERR_AENC_NOBUF RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_NOBUF) 80 /* no data in buffer */ 81 #define RK_ERR_AENC_BUF_EMPTY RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_BUF_EMPTY) 82 /* no buffer for new data */ 83 #define RK_ERR_AENC_BUF_FULL RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_BUF_FULL) 84 /* system is not ready,had not initialed or loaded*/ 85 #define RK_ERR_AENC_SYS_NOTREADY RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, RK_ERR_NOTREADY) 86 /* encoder internal err */ 87 #define RK_ERR_AENC_ENCODER_ERR RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, AENC_ERR_ENCODER_ERR) 88 /* vqe internal err */ 89 #define RK_ERR_AENC_VQE_ERR RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, AENC_ERR_VQE_ERR) 90 /* register Aenc fail */ 91 #define RK_ERR_AENC_REGISTER_ERR RK_DEF_ERR(RK_ID_AENC, RK_ERR_LEVEL_ERROR, AENC_ERR_REGISTER_ERR) 92 93 94 #ifdef __cplusplus 95 #if __cplusplus 96 } 97 #endif 98 #endif /* End of #ifdef __cplusplus */ 99 100 #endif/* End of #ifndef INCLUDE_RT_MPI_RK_COMM_AENC_H_*/ 101