/H264Dec/inc/H264SwDecApi.h

http://github.com/mbebenita/Broadway · C Header · 192 lines · 86 code · 45 blank · 61 comment · 0 complexity · 7cb648afb67bda9eb385ad00d0dbfa8a MD5 · raw file

  1. /*
  2. * Copyright (C) 2009 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*------------------------------------------------------------------------------
  17. Table of contents
  18. 1. Include Headers
  19. 2. Enumerations used as a return value or a parameter.
  20. 2.1. API's return value enumerations.
  21. 3. User Structures
  22. 3.1. Structures for H264SwDecDecode() parameters.
  23. 3.2. Structures for information interchange with
  24. DEC API and user application.
  25. 4. Prototypes of Decoder API functions
  26. ------------------------------------------------------------------------------*/
  27. #ifndef H264SWDECAPI_H
  28. #define H264SWDECAPI_H
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif
  33. /*------------------------------------------------------------------------------
  34. 1. Include Headers
  35. ------------------------------------------------------------------------------*/
  36. #include "basetype.h"
  37. /*------------------------------------------------------------------------------
  38. 2.1. API's return value enumerations.
  39. ------------------------------------------------------------------------------*/
  40. typedef enum
  41. {
  42. H264SWDEC_OK = 0,
  43. H264SWDEC_STRM_PROCESSED = 1,
  44. H264SWDEC_PIC_RDY,
  45. H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY,
  46. H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY,
  47. H264SWDEC_PARAM_ERR = -1,
  48. H264SWDEC_STRM_ERR = -2,
  49. H264SWDEC_NOT_INITIALIZED = -3,
  50. H264SWDEC_MEMFAIL = -4,
  51. H264SWDEC_INITFAIL = -5,
  52. H264SWDEC_HDRS_NOT_RDY = -6,
  53. H264SWDEC_EVALUATION_LIMIT_EXCEEDED = -7
  54. } H264SwDecRet;
  55. /*------------------------------------------------------------------------------
  56. 3.1. Structures for H264SwDecDecode() parameters.
  57. ------------------------------------------------------------------------------*/
  58. /* typedef of the Decoder instance */
  59. typedef void *H264SwDecInst;
  60. /* Input structure */
  61. typedef struct
  62. {
  63. u8 *pStream; /* Pointer to stream to be decoded */
  64. u32 dataLen; /* Number of bytes to be decoded */
  65. u32 picId; /* Identifier for the picture to be decoded */
  66. u32 intraConcealmentMethod; /* 0 = Gray concealment for intra
  67. 1 = Reference concealment for intra */
  68. } H264SwDecInput;
  69. /* Output structure */
  70. typedef struct
  71. {
  72. u8 *pStrmCurrPos; /* Pointer to stream position where decoder
  73. ended up */
  74. } H264SwDecOutput;
  75. /* Output structure for H264SwDecNextPicture */
  76. typedef struct
  77. {
  78. u32 *pOutputPicture; /* Pointer to the picture, YUV format */
  79. u32 picId; /* Identifier of the picture to be displayed*/
  80. u32 isIdrPicture; /* Flag to indicate if the picture is an
  81. IDR picture */
  82. u32 nbrOfErrMBs; /* Number of concealed MB's in the picture */
  83. } H264SwDecPicture;
  84. /*------------------------------------------------------------------------------
  85. 3.2. Structures for information interchange with DEC API
  86. and user application.
  87. ------------------------------------------------------------------------------*/
  88. typedef struct
  89. {
  90. u32 cropLeftOffset;
  91. u32 cropOutWidth;
  92. u32 cropTopOffset;
  93. u32 cropOutHeight;
  94. } CropParams;
  95. typedef struct
  96. {
  97. u32 profile;
  98. u32 picWidth;
  99. u32 picHeight;
  100. u32 videoRange;
  101. u32 matrixCoefficients;
  102. u32 parWidth;
  103. u32 parHeight;
  104. u32 croppingFlag;
  105. CropParams cropParams;
  106. } H264SwDecInfo;
  107. /* Version information */
  108. typedef struct
  109. {
  110. u32 major; /* Decoder API major version */
  111. u32 minor; /* Dncoder API minor version */
  112. } H264SwDecApiVersion;
  113. /*------------------------------------------------------------------------------
  114. 4. Prototypes of Decoder API functions
  115. ------------------------------------------------------------------------------*/
  116. H264SwDecRet H264SwDecDecode(H264SwDecInst decInst,
  117. H264SwDecInput *pInput,
  118. H264SwDecOutput *pOutput);
  119. H264SwDecRet H264SwDecInit(H264SwDecInst *decInst,
  120. u32 noOutputReordering);
  121. H264SwDecRet H264SwDecNextPicture(H264SwDecInst decInst,
  122. H264SwDecPicture *pOutput,
  123. u32 endOfStream);
  124. H264SwDecRet H264SwDecGetInfo(H264SwDecInst decInst,
  125. H264SwDecInfo *pDecInfo);
  126. void H264SwDecRelease(H264SwDecInst decInst);
  127. H264SwDecApiVersion H264SwDecGetAPIVersion(void);
  128. /* function prototype for API trace */
  129. void H264SwDecTrace(char *);
  130. /* function prototype for memory allocation */
  131. void* H264SwDecMalloc(u32 size);
  132. /* function prototype for memory free */
  133. void H264SwDecFree(void *ptr);
  134. /* function prototype for memory copy */
  135. void H264SwDecMemcpy(void *dest, void *src, u32 count);
  136. /* function prototype for memset */
  137. void H264SwDecMemset(void *ptr, i32 value, u32 count);
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141. #endif /* H264SWDECAPI_H */