1 /* 2 * Copyright (c) 2010, Texas Instruments Incorporated 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * * Neither the name of Texas Instruments Incorporated nor the names of 17 * its contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 /** 34 * @file omx_ti_common.h 35 * 36 * 37 * @path \OMAPSW_SysDev\multimedia\omx\khronos1_1\omx_core\inc 38 * 39 * @rev 1.0 40 */ 41 42 /*============================================================== 43 *! Revision History 44 *! ============================ 45 *! 20-Dec-2008 x0052661@ti.com, initial version 46 *================================================================*/ 47 48 #ifndef _OMX_TI_COMMON_H_ 49 #define _OMX_TI_COMMON_H_ 50 51 #ifdef __cplusplus 52 extern "C" { 53 #endif /* __cplusplus */ 54 55 /****************************************************************** 56 * INCLUDE FILES 57 ******************************************************************/ 58 #include <OMX_Core.h> 59 60 /******************************************************************* 61 * EXTERNAL REFERENCE NOTE: only use if not found in header file 62 *******************************************************************/ 63 /*---------- function prototypes ------------------- */ 64 /*---------- data declarations ------------------- */ 65 /******************************************************************* 66 * PUBLIC DECLARATIONS: defined here, used elsewhere 67 *******************************************************************/ 68 /*---------- function prototypes ------------------- */ 69 /*---------- data declarations ------------------- */ 70 #define OMX_BUFFERHEADERFLAG_MODIFIED 0x00000100 71 72 #define OMX_TI_BUFFERFLAG_READONLY 0x00000200 73 74 /* TI extra data will be passed in the platform private structure rather than 75 * appended at the end of the buffer. Adding a new custom flag to indicate 76 * this.*/ 77 #define OMX_TI_BUFFERFLAG_DETACHEDEXTRADATA 0x00000400 78 79 typedef struct OMX_CONFIG_CHANNELNAME { 80 81 OMX_U32 nSize; /**< Size of the structure in bytes */ 82 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 83 OMX_U32 nPortIndex; /**< Index of the port */ 84 OMX_STRING cChannelName; /**< Channel name */ 85 86 } OMX_CONFIG_CHANNELNAME; 87 88 typedef struct OMX_TI_PLATFORMPRIVATE 89 { 90 OMX_U32 nSize; 91 OMX_PTR pExtendedPlatformPrivate; 92 OMX_BOOL bReadViaCPU; 93 OMX_BOOL bWriteViaCPU; 94 OMX_PTR pMetaDataBuffer; 95 OMX_U32 nMetaDataSize; 96 OMX_PTR pAuxBuf1; 97 OMX_U32 pAuxBufSize1; 98 }OMX_TI_PLATFORMPRIVATE; 99 100 /*===============================================================*/ 101 /** OMX_TI_PARAM_BUFFERPREANNOUNCE : This parameter is used to enable/disable 102 * buffer pre announcement. Buffer pre 103 * announcement is enabled by default i.e. 104 * if buffer is being allocated by client 105 * then the buffer ptrs will be made known 106 * to the component at the time of 107 * UseBuffer and these will not change in 108 * lifetime of the component. If pre 109 * announcement is disabled then new 110 * buffers can be allocated by the client 111 * at runtime and passed in ETB/FTB. This 112 * parameter is valid only in cases where 113 * client allocates the buffer 114 * (i.e. UseBuffer cases). 115 * 116 * @ param nSize : Size of the structure. 117 * @ param nVersion : Version. 118 * @ param nPortIndex : Port index on which the parameter will 119 * be applied. 120 * @ param bEnabled : Whether buffer pre announcement is 121 * enabled or not. Set to TRUE (enabled) 122 * by default. 123 */ 124 /*===============================================================*/ 125 typedef struct OMX_TI_PARAM_BUFFERPREANNOUNCE 126 { 127 OMX_U32 nSize; 128 OMX_VERSIONTYPE nVersion; 129 OMX_U32 nPortIndex; 130 OMX_BOOL bEnabled; 131 }OMX_TI_PARAM_BUFFERPREANNOUNCE; 132 133 134 135 /*===============================================================*/ 136 /** OMX_TI_CONFIG_BUFFERREFCOUNTNOTIFYTYPE : This config is used to 137 * enable/disable notification when 138 * reference count of a buffer changes 139 * This happens usually when buffers 140 * are locked/unlocked by codecs. By 141 * DEFAULT all notifications are 142 * DISABLED. 143 * 144 * @ param nSize : Size of the structure. 145 * @ param nVersion : Version. 146 * @ param nPortIndex : Port index on which the config will 147 * be applied. 148 * @param bNotifyOnIncrease : Enable notification when reference 149 * count is increased. 150 * @ param bNotifyOnDecrease : Enable notification when reference 151 * count is decreased. 152 * @ param nCountForNotification : Count at which to trigger 153 * notification. Count indicates no. 154 * of copies of the buffer in 155 * circulation e.g. 156 * 1 - Only the original buffer is in 157 * circulation i.e. no buffers are 158 * currently locked. 159 * 2 - There are two copies of the 160 * buffer i.e. one original and 161 * one copy which has been locked 162 * by the codec. 163 * And so on 164 * SPECIAL CASE 165 * 0 - Indicates notify always 166 * irrespective of count value. 167 */ 168 /*===============================================================*/ 169 typedef struct OMX_TI_CONFIG_BUFFERREFCOUNTNOTIFYTYPE 170 { 171 OMX_U32 nSize; 172 OMX_VERSIONTYPE nVersion; 173 OMX_U32 nPortIndex; 174 OMX_BOOL bNotifyOnIncrease; 175 OMX_BOOL bNotifyOnDecrease; 176 OMX_U32 nCountForNotification; 177 }OMX_TI_CONFIG_BUFFERREFCOUNTNOTIFYTYPE; 178 179 180 181 182 183 /* OMX_TI_SEVERITYTYPE enumeration is used to indicate severity level of errors returned by TI OpenMax components. 184 Critcal Requires reboot/reset DSP 185 Severe Have to unload components and free memory and try again 186 Major Can be handled without unloading the component 187 Minor Essentially informational 188 */ 189 typedef enum OMX_TI_SEVERITYTYPE { 190 OMX_TI_ErrorCritical=1, 191 OMX_TI_ErrorSevere, 192 OMX_TI_ErrorMajor, 193 OMX_TI_ErrorMinor 194 } OMX_TI_SEVERITYTYPE; 195 196 /* ============================================================================= */ 197 /* 198 @brief OMX_TI_PARAM_METADATABUFFERINFO : Structure to access metadata buffer info needed 199 by proxy to allocate metadat buffers. 200 201 */ 202 /* ============================================================================= */ 203 typedef struct OMX_TI_PARAM_METADATABUFFERINFO { 204 OMX_U32 nSize; 205 OMX_VERSIONTYPE nVersion; 206 OMX_U32 nPortIndex; 207 OMX_BOOL bIsMetaDataEnabledOnPort; 208 OMX_U32 nMetaDataSize; 209 } OMX_TI_PARAM_METADATABUFFERINFO; 210 211 /*===============================================================*/ 212 /** OMX_TI_BUFFERTYPE : This enumberation defines the type of 213 * buffer that is exchanged with the OMX 214 * component port 215 * 216 * OMX_TI_BufferTypeDefault : Default buffer type accessed via a 217 * single virtual address 218 * OMX_TI_BufferTypeVirtual2D : Multiple virtual buffers describing a 219 * 2D buffer 220 * OMX_TI_BufferTypePlatform1D : Platform specific 1D buffer handle 221 * OMX_TI_BufferTypePlatform2D : Platform specific buffer handles 222 * describing a 2D buffer 223 * OMX_TI_BufferTypePhysicalPageList : List of a given number of physical pages 224 * OMX_TI_BufferTypeHardwareReserved1D:Harware reserve space only that can 225 * accomodate a 1D buffer by mapping memory 226 * to it 227 */ 228 /*===============================================================*/ 229 typedef enum OMX_TI_BUFFERTYPE { 230 OMX_TI_BufferTypeDefault = 0, 231 OMX_TI_BufferTypeVirtual2D, 232 OMX_TI_BufferTypePlatform1D, 233 OMX_TI_BufferTypePlatform2D, 234 OMX_TI_BufferTypePhysicalPageList, 235 OMX_TI_BufferTypeHardwareReserved1D, 236 OMX_TI_BufferTypeMax = 0x7FFFFFFF 237 } OMX_TI_BUFFERTYPE; 238 239 /*===============================================================*/ 240 /** OMX_TI_BUFFERDESCRIPTOR_TYPE : This buffer descriptor structure is used 241 * to convey additional buffer information 242 * when OMX_TI_IndexUseBufferDescriptor is 243 * enabled and it is passed via pBuffer 244 * in OMX_BUFFERHEADERTYPE 245 * 246 * @ param nSize : Size of the structure. 247 * @ param eBufType : Specifies type of buffer 248 * @ param nNumOfBuf : Number of component buffers of eBufType 249 * @ param pBuf : Array of buffers of type eBufType 250 */ 251 /*===============================================================*/ 252 typedef struct OMX_TI_BUFFERDESCRIPTOR_TYPE { 253 OMX_U32 nSize; 254 OMX_TI_BUFFERTYPE eBufType; 255 OMX_U32 nNumOfBuf; 256 OMX_PTR pBuf[3]; 257 } OMX_TI_BUFFERDESCRIPTOR_TYPE; 258 259 /*===============================================================*/ 260 /** OMX_TI_PARAM_USEBUFFERDESCRIPTOR : This parameter is used to enable/disable 261 * buffer descriptor mode. When enabled, 262 * the pBuffer in OMX buffer header points 263 * to a buffer descriptor structure 264 * OMX_TI_BUFFERDESCRIPTOR_TYPE instead of 265 * the buffer directly. 266 * 267 * @ param nSize : Size of the structure. 268 * @ param nVersion : Version. 269 * @ param nPortIndex : Port index on which the parameter will 270 * be applied. 271 * @ param bEnabled : Whether buffer descriptor mode is 272 * enabled or not. Set to FALSE (disabled) 273 * by default. 274 */ 275 /*===============================================================*/ 276 typedef struct OMX_TI_PARAM_USEBUFFERDESCRIPTOR { 277 OMX_U32 nSize; 278 OMX_VERSIONTYPE nVersion; 279 OMX_U32 nPortIndex; 280 OMX_BOOL bEnabled; 281 OMX_TI_BUFFERTYPE eBufferType; 282 } OMX_TI_PARAM_USEBUFFERDESCRIPTOR; 283 284 285 /*===============================================================*/ 286 /** OMX_TI_PARAM_COMPONENTBUFALLOCTYPE :This parameter is used to query/set 287 * internal buffers used by OMX component 288 * after allocation by the user of OMX 289 * component during regular OMX buffer 290 * allocation/free life cycle 291 * 292 * @ param nSize : Size of the structure. 293 * @ param nVersion : Version. 294 * @ param nPortIndex : Port index on which the parameter will 295 * be applied. 296 * @ param nIndex : Present buffer number whose requirement 297 * is queried and then set 298 * @ param eBufType : Present nIndex'ed buffer type 299 * @ param pBuf : Buffer communication 300 * @ param nAllocWidth : Size of buffer (Width in case of 2D) 301 * @ param nAllocLines : Size of buffer (1 in case of 1D) 302 * @ param nOffset : Offset from which buffer communicated is 303 * valid 304 */ 305 /*===============================================================*/ 306 typedef struct OMX_TI_PARAM_COMPONENTBUFALLOCTYPE { 307 OMX_U32 nSize; 308 OMX_VERSIONTYPE nVersion; 309 OMX_U32 nPortIndex; 310 OMX_U32 nIndex; 311 OMX_TI_BUFFERTYPE eBufType; 312 OMX_PTR pBuf[3]; 313 OMX_U32 nAllocWidth; 314 OMX_U32 nAllocLines; 315 OMX_U32 nOffset; 316 } OMX_TI_PARAM_COMPONENTBUFALLOCTYPE; 317 318 /*===============================================================*/ 319 /** OMX_TI_COMPONENT_HANDLE : This parameter is used to retrieve 320 * the component handle by the client. 321 * 322 * @ param nSize : Size of the structure. 323 * @ param nVersion : Version. 324 * @ param pHandle : Component Handle 325 */ 326 /*===============================================================*/ 327 typedef struct OMX_TI_COMPONENT_HANDLE { 328 OMX_U32 nSize; 329 OMX_VERSIONTYPE nVersion; 330 OMX_HANDLETYPE pHandle; 331 } OMX_TI_COMPONENT_HANDLE; 332 333 /******************************************************************* 334 * PRIVATE DECLARATIONS: defined here, used only here 335 *******************************************************************/ 336 /*---------- data declarations ------------------- */ 337 /*---------- function prototypes ------------------- */ 338 339 #ifdef __cplusplus 340 } 341 #endif /* __cplusplus */ 342 343 #endif /* _OMX_TI_COMMON_H_ */ 344