hi_comm_adec.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /******************************************************************************
  2. Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_comm_adec.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software group
  7. Created : 2006/12/15
  8. Last Modified :
  9. Description :
  10. Function List :
  11. History :
  12. 1.Date : 2006/12/15
  13. Author : z50825
  14. Modification : Created file
  15. 2.Date : 2007/5/10
  16. Author : z50825
  17. Modification : add err code
  18. ******************************************************************************/
  19. #ifndef __HI_COMM_ADEC_H__
  20. #define __HI_COMM_ADEC_H__
  21. #include "hi_type.h"
  22. #include "hi_common.h"
  23. #include "hi_comm_aio.h"
  24. #ifdef __cplusplus
  25. #if __cplusplus
  26. extern "C"{
  27. #endif
  28. #endif /* End of #ifdef __cplusplus */
  29. typedef struct hiADEC_ATTR_G711_S
  30. {
  31. HI_U32 resv;
  32. }ADEC_ATTR_G711_S;
  33. typedef struct hiADEC_ATTR_G726_S
  34. {
  35. G726_BPS_E enG726bps;
  36. }ADEC_ATTR_G726_S;
  37. typedef struct hiADEC_ATTR_ADPCM_S
  38. {
  39. ADPCM_TYPE_E enADPCMType;
  40. }ADEC_ATTR_ADPCM_S;
  41. typedef struct hiADEC_ATTR_LPCM_S
  42. {
  43. HI_U32 resv;
  44. }ADEC_ATTR_LPCM_S;
  45. typedef enum hiADEC_MODE_E
  46. {
  47. ADEC_MODE_PACK = 0,/*require input is valid dec pack(a
  48. complete frame encode result),
  49. e.g.the stream get from AENC is a
  50. valid dec pack, the stream know actually
  51. pack len from file is also a dec pack.
  52. this mode is high-performative*/
  53. ADEC_MODE_STREAM ,/*input is stream,low-performative,
  54. if you couldn't find out whether a stream is
  55. vaild dec pack,you could use
  56. this mode*/
  57. ADEC_MODE_BUTT
  58. }ADEC_MODE_E;
  59. typedef struct hiADEC_CH_ATTR_S
  60. {
  61. PAYLOAD_TYPE_E enType;
  62. HI_U32 u32BufSize; /*buf size[2~MAX_AUDIO_FRAME_NUM]*/
  63. ADEC_MODE_E enMode; /*decode mode*/
  64. HI_VOID ATTRIBUTE *pValue;
  65. }ADEC_CHN_ATTR_S;
  66. typedef struct hiADEC_DECODER_S
  67. {
  68. PAYLOAD_TYPE_E enType;
  69. HI_CHAR aszName[17];
  70. HI_S32 (*pfnOpenDecoder)(HI_VOID *pDecoderAttr, HI_VOID **ppDecoder); /*struct ppDecoder is packed by user,user malloc and free memory for this struct */
  71. HI_S32 (*pfnDecodeFrm)(HI_VOID *pDecoder, HI_U8 **pu8Inbuf,HI_S32 *ps32LeftByte,
  72. HI_U16 *pu16Outbuf,HI_U32 *pu32OutLen,HI_U32 *pu32Chns);
  73. HI_S32 (*pfnGetFrmInfo)(HI_VOID *pDecoder, HI_VOID *pInfo);
  74. HI_S32 (*pfnCloseDecoder)(HI_VOID *pDecoder);
  75. HI_S32 (*pfnResetDecoder)(HI_VOID *pDecoder);
  76. } ADEC_DECODER_S;
  77. typedef enum hiEN_ADEC_ERR_CODE_E
  78. {
  79. ADEC_ERR_DECODER_ERR = 64,
  80. ADEC_ERR_BUF_LACK,
  81. } EN_ADEC_ERR_CODE_E;
  82. /* invlalid device ID */
  83. #define HI_ERR_ADEC_INVALID_DEVID HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
  84. /* invlalid channel ID */
  85. #define HI_ERR_ADEC_INVALID_CHNID HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  86. /* at lease one parameter is illagal ,eg, an illegal enumeration value */
  87. #define HI_ERR_ADEC_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
  88. /* channel exists */
  89. #define HI_ERR_ADEC_EXIST HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
  90. /* channel unexists */
  91. #define HI_ERR_ADEC_UNEXIST HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  92. /* using a NULL point */
  93. #define HI_ERR_ADEC_NULL_PTR HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
  94. /* try to enable or initialize system,device or channel, before configing attribute */
  95. #define HI_ERR_ADEC_NOT_CONFIG HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
  96. /* operation is not supported by NOW */
  97. #define HI_ERR_ADEC_NOT_SUPPORT HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
  98. /* operation is not permitted ,eg, try to change stati attribute */
  99. #define HI_ERR_ADEC_NOT_PERM HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  100. /* failure caused by malloc memory */
  101. #define HI_ERR_ADEC_NOMEM HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
  102. /* failure caused by malloc buffer */
  103. #define HI_ERR_ADEC_NOBUF HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
  104. /* no data in buffer */
  105. #define HI_ERR_ADEC_BUF_EMPTY HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
  106. /* no buffer for new data */
  107. #define HI_ERR_ADEC_BUF_FULL HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
  108. /* system is not ready,had not initialed or loaded*/
  109. #define HI_ERR_ADEC_SYS_NOTREADY HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  110. /* decoder internal err */
  111. #define HI_ERR_ADEC_DECODER_ERR HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_DECODER_ERR)
  112. /* input buffer not enough to decode one frame */
  113. #define HI_ERR_ADEC_BUF_LACK HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_BUF_LACK)
  114. #ifdef __cplusplus
  115. #if __cplusplus
  116. }
  117. #endif
  118. #endif /* End of #ifdef __cplusplus */
  119. #endif/* End of #ifndef __HI_COMM_ADEC_H__*/