mpeg2decapi.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 2007 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 for the 8170 MPEG-2 Decoder
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: mpeg2decapi.h,v $
  23. -- $Date: 2010/03/23 08:59:19 $
  24. -- $Revision: 1.17 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __MPEG2DECAPI_H__
  28. #define __MPEG2DECAPI_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. /* Return values */
  39. typedef enum
  40. {
  41. MPEG2DEC_OK = 0,
  42. MPEG2DEC_STRM_PROCESSED = 1,
  43. MPEG2DEC_PIC_RDY = 2,
  44. MPEG2DEC_HDRS_RDY = 3,
  45. MPEG2DEC_HDRS_NOT_RDY = 4,
  46. MPEG2DEC_PIC_DECODED = 5,
  47. MPEG2DEC_PARAM_ERROR = -1,
  48. MPEG2DEC_STRM_ERROR = -2,
  49. MPEG2DEC_NOT_INITIALIZED = -3,
  50. MPEG2DEC_MEMFAIL = -4,
  51. MPEG2DEC_INITFAIL = -5,
  52. MPEG2DEC_STREAM_NOT_SUPPORTED = -8,
  53. MPEG2DEC_HW_RESERVED = -254,
  54. MPEG2DEC_HW_TIMEOUT = -255,
  55. MPEG2DEC_HW_BUS_ERROR = -256,
  56. MPEG2DEC_SYSTEM_ERROR = -257,
  57. MPEG2DEC_DWL_ERROR = -258,
  58. MPEG2DEC_FORMAT_NOT_SUPPORTED = -1000
  59. } Mpeg2DecRet;
  60. /* decoder output picture format */
  61. typedef enum
  62. {
  63. MPEG2DEC_SEMIPLANAR_YUV420 = 0x020001,
  64. MPEG2DEC_TILED_YUV420 = 0x020002
  65. } Mpeg2DecOutFormat;
  66. /* DAR (Display aspect ratio) */
  67. typedef enum
  68. {
  69. MPEG2DEC_1_1 = 0x01,
  70. MPEG2DEC_4_3 = 0x02,
  71. MPEG2DEC_16_9 = 0x03,
  72. MPEG2DEC_2_21_1 = 0x04
  73. } Mpeg2DecDARFormat;
  74. /* SAR (Sample aspect ratio) */
  75. /* TODO! */
  76. typedef struct
  77. {
  78. u32 *pVirtualAddress;
  79. u32 busAddress;
  80. } Mpeg2DecLinearMem;
  81. /* Decoder instance */
  82. typedef void *Mpeg2DecInst;
  83. /* Input structure */
  84. typedef struct
  85. {
  86. u8 *pStream; /* Pointer to stream to be decoded */
  87. u32 streamBusAddress; /* DMA bus address of the input stream */
  88. u32 dataLen; /* Number of bytes to be decoded */
  89. u32 picId;
  90. } Mpeg2DecInput;
  91. /* Time code */
  92. typedef struct
  93. {
  94. u32 hours;
  95. u32 minutes;
  96. u32 seconds;
  97. u32 pictures;
  98. } Mpeg2DecTime;
  99. typedef struct
  100. {
  101. u8 *pStrmCurrPos;
  102. u32 strmCurrBusAddress; /* DMA bus address location where the decoding
  103. * ended */
  104. u32 dataLeft;
  105. } Mpeg2DecOutput;
  106. /* stream info filled by Mpeg2DecGetInfo */
  107. typedef struct
  108. {
  109. u32 frameWidth;
  110. u32 frameHeight;
  111. u32 codedWidth;
  112. u32 codedHeight;
  113. u32 profileAndLevelIndication;
  114. u32 sampleAspectRatio;
  115. u32 DisplayAspectRatio;
  116. u32 streamFormat;
  117. u32 videoFormat;
  118. u32 videoRange; /* ??? only [0-255] */
  119. u32 interlacedSequence;
  120. u32 multiBuffPpSize;
  121. Mpeg2DecOutFormat outputFormat;
  122. } Mpeg2DecInfo;
  123. typedef struct
  124. {
  125. u8 *pOutputPicture;
  126. u32 outputPictureBusAddress;
  127. u32 frameWidth;
  128. u32 frameHeight;
  129. u32 codedWidth;
  130. u32 codedHeight;
  131. u32 keyPicture;
  132. u32 picId;
  133. u32 interlaced;
  134. u32 fieldPicture;
  135. u32 topField;
  136. u32 firstField;
  137. u32 repeatFirstField;
  138. u32 repeatFrameCount;
  139. u32 numberOfErrMBs;
  140. Mpeg2DecTime timeCode;
  141. } Mpeg2DecPicture;
  142. /* Version information */
  143. typedef struct
  144. {
  145. u32 major; /* API major version */
  146. u32 minor; /* API minor version */
  147. } Mpeg2DecApiVersion;
  148. typedef struct
  149. {
  150. u32 swBuild; /* Software build ID */
  151. u32 hwBuild; /* Hardware build ID */
  152. DecHwConfig hwConfig; /* hardware supported configuration */
  153. } Mpeg2DecBuild;
  154. /*------------------------------------------------------------------------------
  155. Prototypes of Decoder API functions
  156. ------------------------------------------------------------------------------*/
  157. Mpeg2DecApiVersion Mpeg2DecGetAPIVersion(void);
  158. Mpeg2DecBuild Mpeg2DecGetBuild(void);
  159. Mpeg2DecRet Mpeg2DecInit(Mpeg2DecInst * pDecInst,
  160. u32 useVideoFreezeConcealment,
  161. u32 numFrameBuffers );
  162. Mpeg2DecRet Mpeg2DecDecode(Mpeg2DecInst decInst,
  163. Mpeg2DecInput * pInput,
  164. Mpeg2DecOutput * pOutput);
  165. Mpeg2DecRet Mpeg2DecGetInfo(Mpeg2DecInst decInst, Mpeg2DecInfo * pDecInfo);
  166. Mpeg2DecRet Mpeg2DecNextPicture(Mpeg2DecInst decInst,
  167. Mpeg2DecPicture * pPicture,
  168. u32 endOfStream);
  169. void Mpeg2DecRelease(Mpeg2DecInst decInst);
  170. Mpeg2DecRet Mpeg2DecPeek(Mpeg2DecInst decInst, Mpeg2DecPicture * pPicture);
  171. /*------------------------------------------------------------------------------
  172. Prototype of the API trace funtion. Traces all API entries and returns.
  173. This must be implemented by the application using the decoder API!
  174. Argument:
  175. string - trace message, a null terminated string
  176. ------------------------------------------------------------------------------*/
  177. void Mpeg2DecTrace(const char *string);
  178. #ifdef __cplusplus
  179. }
  180. #endif
  181. #endif /* __MPEG2DECAPI_H__ */