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 /*------------------------------------------------------------------------------ 18 19 Table of contents 20 21 1. Include Headers 22 23 2. Enumerations used as a return value or a parameter. 24 2.1. API's return value enumerations. 25 26 3. User Structures 27 3.1. Structures for H264SwDecDecode() parameters. 28 3.2. Structures for information interchange with 29 DEC API and user application. 30 31 4. Prototypes of Decoder API functions 32 33 ------------------------------------------------------------------------------*/ 34 35 #ifndef H264SWDECAPI_H 36 #define H264SWDECAPI_H 37 38 #ifdef __cplusplus 39 extern "C" 40 { 41 #endif 42 43 /*------------------------------------------------------------------------------ 44 1. Include Headers 45 ------------------------------------------------------------------------------*/ 46 47 #include "basetype.h" 48 49 /*------------------------------------------------------------------------------ 50 2.1. API's return value enumerations. 51 ------------------------------------------------------------------------------*/ 52 53 typedef enum 54 { 55 H264SWDEC_OK = 0, 56 H264SWDEC_STRM_PROCESSED = 1, 57 H264SWDEC_PIC_RDY, 58 H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY, 59 H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY, 60 H264SWDEC_PARAM_ERR = -1, 61 H264SWDEC_STRM_ERR = -2, 62 H264SWDEC_NOT_INITIALIZED = -3, 63 H264SWDEC_MEMFAIL = -4, 64 H264SWDEC_INITFAIL = -5, 65 H264SWDEC_HDRS_NOT_RDY = -6, 66 H264SWDEC_EVALUATION_LIMIT_EXCEEDED = -7 67 } H264SwDecRet; 68 69 /*------------------------------------------------------------------------------ 70 3.1. Structures for H264SwDecDecode() parameters. 71 ------------------------------------------------------------------------------*/ 72 73 /* typedef of the Decoder instance */ 74 typedef void *H264SwDecInst; 75 76 /* Input structure */ 77 typedef struct 78 { 79 u8 *pStream; /* Pointer to stream to be decoded */ 80 u32 dataLen; /* Number of bytes to be decoded */ 81 u32 picId; /* Identifier for the picture to be decoded */ 82 u32 intraConcealmentMethod; /* 0 = Gray concealment for intra 83 1 = Reference concealment for intra */ 84 85 } H264SwDecInput; 86 87 88 /* Output structure */ 89 typedef struct 90 { 91 u8 *pStrmCurrPos; /* Pointer to stream position where decoder 92 ended up */ 93 } H264SwDecOutput; 94 95 /* Output structure for H264SwDecNextPicture */ 96 typedef struct 97 { 98 u32 *pOutputPicture; /* Pointer to the picture, YUV format */ 99 u32 picId; /* Identifier of the picture to be displayed*/ 100 u32 isIdrPicture; /* Flag to indicate if the picture is an 101 IDR picture */ 102 u32 nbrOfErrMBs; /* Number of concealed MB's in the picture */ 103 } H264SwDecPicture; 104 105 /*------------------------------------------------------------------------------ 106 3.2. Structures for information interchange with DEC API 107 and user application. 108 ------------------------------------------------------------------------------*/ 109 110 typedef struct 111 { 112 u32 cropLeftOffset; 113 u32 cropOutWidth; 114 u32 cropTopOffset; 115 u32 cropOutHeight; 116 } CropParams; 117 118 typedef struct 119 { 120 u32 profile; 121 u32 picWidth; 122 u32 picHeight; 123 u32 videoRange; 124 u32 matrixCoefficients; 125 u32 parWidth; 126 u32 parHeight; 127 u32 croppingFlag; 128 CropParams cropParams; 129 } H264SwDecInfo; 130 131 /* Version information */ 132 typedef struct 133 { 134 u32 major; /* Decoder API major version */ 135 u32 minor; /* Dncoder API minor version */ 136 } H264SwDecApiVersion; 137 138 /*------------------------------------------------------------------------------ 139 4. Prototypes of Decoder API functions 140 ------------------------------------------------------------------------------*/ 141 142 H264SwDecRet H264SwDecDecode(H264SwDecInst decInst, 143 H264SwDecInput *pInput, 144 H264SwDecOutput *pOutput); 145 146 H264SwDecRet H264SwDecInit(H264SwDecInst *decInst, 147 u32 noOutputReordering); 148 149 H264SwDecRet H264SwDecNextPicture(H264SwDecInst decInst, 150 H264SwDecPicture *pOutput, 151 u32 endOfStream); 152 153 H264SwDecRet H264SwDecGetInfo(H264SwDecInst decInst, 154 H264SwDecInfo *pDecInfo); 155 156 void H264SwDecRelease(H264SwDecInst decInst); 157 158 H264SwDecApiVersion H264SwDecGetAPIVersion(void); 159 160 /* function prototype for API trace */ 161 void H264SwDecTrace(char *); 162 163 /* function prototype for memory allocation */ 164 void* H264SwDecMalloc(u32 size, u32 num); 165 166 /* function prototype for memory free */ 167 void H264SwDecFree(void *ptr); 168 169 /* function prototype for memory copy */ 170 void H264SwDecMemcpy(void *dest, void *src, u32 count); 171 172 /* function prototype for memset */ 173 void H264SwDecMemset(void *ptr, i32 value, u32 count); 174 175 176 #ifdef __cplusplus 177 } 178 #endif 179 180 #endif /* H264SWDECAPI_H */ 181 182 183 184 185 186 187 188 189 190 191 192 193