mp4decapi.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. --
  16. -- Description : API of MPEG-4 Decoder
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: mp4decapi.h,v $
  23. -- $Date: 2010/03/23 10:31:18 $
  24. -- $Revision: 1.27 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __MP4DECAPI_H__
  28. #define __MP4DECAPI_H__
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif
  33. #include "basetype.h"
  34. #include "decapicommon.h"
  35. /*------------------------------------------------------------------------------
  36. API type definitions
  37. ------------------------------------------------------------------------------*/
  38. typedef enum MP4DecStrmFmt_ {
  39. MP4DEC_MPEG4,
  40. MP4DEC_SORENSON,
  41. MP4DEC_CUSTOM_1
  42. } MP4DecStrmFmt;
  43. /* Return values */
  44. typedef enum MP4DecRet_{
  45. MP4DEC_OK = 0,
  46. MP4DEC_STRM_PROCESSED = 1,
  47. MP4DEC_PIC_RDY = 2,
  48. MP4DEC_PIC_DECODED = 3,
  49. MP4DEC_HDRS_RDY = 4,
  50. MP4DEC_DP_HDRS_RDY = 5,
  51. MP4DEC_VOS_END = 14,
  52. MP4DEC_HDRS_NOT_RDY = 15,
  53. MP4DEC_PARAM_ERROR = -1,
  54. MP4DEC_STRM_ERROR = -2,
  55. MP4DEC_NOT_INITIALIZED = -4,
  56. MP4DEC_MEMFAIL = -5,
  57. MP4DEC_INITFAIL = -6,
  58. MP4DEC_FORMAT_NOT_SUPPORTED = -7,
  59. MP4DEC_STRM_NOT_SUPPORTED = -8,
  60. MP4DEC_HW_RESERVED = -254,
  61. MP4DEC_HW_TIMEOUT = -255,
  62. MP4DEC_HW_BUS_ERROR = -256,
  63. MP4DEC_SYSTEM_ERROR = -257,
  64. MP4DEC_DWL_ERROR = -258
  65. } MP4DecRet;
  66. /* decoder output picture format */
  67. typedef enum MP4DecOutFormat_
  68. {
  69. MP4DEC_SEMIPLANAR_YUV420 = 0x020001,
  70. MP4DEC_TILED_YUV420 = 0x020002
  71. } MP4DecOutFormat;
  72. typedef struct
  73. {
  74. u32 *pVirtualAddress;
  75. u32 busAddress;
  76. } MP4DecLinearMem;
  77. /* Decoder instance */
  78. typedef void *MP4DecInst;
  79. /* Input structure */
  80. typedef struct MP4DecInput_{
  81. const u8 *pStream; /* Pointer to stream to be decoded */
  82. u32 streamBusAddress; /* DMA bus address of the input stream */
  83. u32 dataLen; /* Number of bytes to be decoded */
  84. u32 enableDeblock; /* Enable deblocking of post processed picture */
  85. /* NOTE: This parameter is not valid if the decoder
  86. * is not used in pipeline mode with the post
  87. * processor i.e. it has no effect on the
  88. * decoding process */
  89. u32 picId;
  90. } MP4DecInput;
  91. /* Time code */
  92. typedef struct TimeCode_{
  93. u32 hours;
  94. u32 minutes;
  95. u32 seconds;
  96. u32 timeIncr;
  97. u32 timeRes;
  98. } MP4DecTime;
  99. typedef struct MP4DecOutput_{
  100. const u8 *pStrmCurrPos;
  101. u32 strmCurrBusAddress; /* DMA bus address location where the decoding
  102. ended */
  103. u32 dataLeft;
  104. } MP4DecOutput;
  105. /* stream info filled by MP4DecGetInfo */
  106. typedef struct MP4DecInfo_{
  107. u32 frameWidth;
  108. u32 frameHeight;
  109. u32 codedWidth;
  110. u32 codedHeight;
  111. u32 streamFormat;
  112. u32 profileAndLevelIndication;
  113. u32 videoFormat;
  114. u32 videoRange;
  115. u32 parWidth;
  116. u32 parHeight;
  117. u32 userDataVOSLen;
  118. u32 userDataVISOLen;
  119. u32 userDataVOLLen;
  120. u32 userDataGOVLen;
  121. u32 interlacedSequence;
  122. u32 multiBuffPpSize;
  123. MP4DecOutFormat outputFormat;
  124. } MP4DecInfo;
  125. /* User data type */
  126. typedef enum {
  127. MP4DEC_USER_DATA_VOS = 0,
  128. MP4DEC_USER_DATA_VISO,
  129. MP4DEC_USER_DATA_VOL,
  130. MP4DEC_USER_DATA_GOV
  131. } MP4DecUserDataType;
  132. /* User data configuration */
  133. typedef struct {
  134. MP4DecUserDataType userDataType;
  135. u8 *pUserDataVOS;
  136. u32 userDataVOSMaxLen;
  137. u8 *pUserDataVISO;
  138. u32 userDataVISOMaxLen;
  139. u8 *pUserDataVOL;
  140. u32 userDataVOLMaxLen;
  141. u8 *pUserDataGOV;
  142. u32 userDataGOVMaxLen;
  143. } MP4DecUserConf;
  144. /* Version information */
  145. typedef struct MP4DecVersion_{
  146. u32 major; /* API major version */
  147. u32 minor; /* API minor version */
  148. } MP4DecApiVersion;
  149. typedef struct MP4DecBuild_
  150. {
  151. u32 swBuild; /* Software build ID */
  152. u32 hwBuild; /* Hardware build ID */
  153. DecHwConfig hwConfig; /* hardware supported configuration */
  154. } MP4DecBuild;
  155. typedef struct
  156. {
  157. const u8 *pOutputPicture;
  158. u32 outputPictureBusAddress;
  159. u32 frameWidth;
  160. u32 frameHeight;
  161. u32 codedWidth;
  162. u32 codedHeight;
  163. u32 keyPicture;
  164. u32 picId;
  165. u32 interlaced;
  166. u32 fieldPicture;
  167. u32 topField;
  168. u32 nbrOfErrMBs;
  169. MP4DecTime timeCode;
  170. } MP4DecPicture;
  171. /*------------------------------------------------------------------------------
  172. Prototypes of Decoder API functions
  173. ------------------------------------------------------------------------------*/
  174. MP4DecApiVersion MP4DecGetAPIVersion(void);
  175. MP4DecBuild MP4DecGetBuild(void);
  176. MP4DecRet MP4DecInit(MP4DecInst * pDecInst, MP4DecStrmFmt strmFmt,
  177. u32 useVideoFreezeConcealment,
  178. u32 numFrameBuffers );
  179. MP4DecRet MP4DecDecode(MP4DecInst decInst,
  180. const MP4DecInput * pInput,
  181. MP4DecOutput * pOutput);
  182. MP4DecRet MP4DecSetInfo(MP4DecInst * pDecInst,
  183. const u32 width,
  184. const u32 height );
  185. MP4DecRet MP4DecGetInfo(MP4DecInst decInst,
  186. MP4DecInfo * pDecInfo);
  187. MP4DecRet MP4DecGetUserData(MP4DecInst decInst,
  188. const MP4DecInput * pInput,
  189. MP4DecUserConf * pUserDataConfig);
  190. MP4DecRet MP4DecNextPicture(MP4DecInst decInst,
  191. MP4DecPicture *pPicture,
  192. u32 endOfStream);
  193. void MP4DecRelease(MP4DecInst decInst);
  194. MP4DecRet MP4DecPeek(MP4DecInst decInst,
  195. MP4DecPicture *pPicture);
  196. /*------------------------------------------------------------------------------
  197. Prototype of the API trace funtion. Traces all API entries and returns.
  198. This must be implemented by the application using the decoder API!
  199. Argument:
  200. string - trace message, a null terminated string
  201. ------------------------------------------------------------------------------*/
  202. void MP4DecTrace(const char *string);
  203. #ifdef __cplusplus
  204. }
  205. #endif
  206. #endif /* __MP4DECAPI_H__ */