|
OpenMAXBellagio 0.9.3
|
00001 /* 00002 * Copyright (c) 2008 The Khronos Group Inc. 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining 00005 * a copy of this software and associated documentation files (the 00006 * "Software"), to deal in the Software without restriction, including 00007 * without limitation the rights to use, copy, modify, merge, publish, 00008 * distribute, sublicense, and/or sell copies of the Software, and to 00009 * permit persons to whom the Software is furnished to do so, subject 00010 * to the following conditions: 00011 * The above copyright notice and this permission notice shall be included 00012 * in all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00017 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00018 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00019 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00020 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00021 * 00022 */ 00023 00029 #ifndef OMX_Core_h 00030 #define OMX_Core_h 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif /* __cplusplus */ 00035 00036 00037 /* Each OMX header shall include all required header files to allow the 00038 * header to compile without errors. The includes below are required 00039 * for this header file to compile successfully 00040 */ 00041 00042 #include <OMX_Index.h> 00043 00044 00049 typedef enum OMX_COMMANDTYPE 00050 { 00051 OMX_CommandStateSet, 00052 OMX_CommandFlush, 00053 OMX_CommandPortDisable, 00054 OMX_CommandPortEnable, 00055 OMX_CommandMarkBuffer, 00056 OMX_CommandKhronosExtensions = 0x6F000000, 00057 OMX_CommandVendorStartUnused = 0x7F000000, 00058 OMX_CommandMax = 0X7FFFFFFF 00059 } OMX_COMMANDTYPE; 00060 00061 00062 00092 typedef enum OMX_STATETYPE 00093 { 00094 OMX_StateInvalid, 00097 OMX_StateLoaded, 00102 OMX_StateIdle, 00105 OMX_StateExecuting, 00107 OMX_StatePause, 00108 OMX_StateWaitForResources, 00111 OMX_StateKhronosExtensions = 0x6F000000, 00112 OMX_StateVendorStartUnused = 0x7F000000, 00113 OMX_StateMax = 0X7FFFFFFF 00114 } OMX_STATETYPE; 00115 00126 typedef enum OMX_ERRORTYPE 00127 { 00128 OMX_ErrorNone = 0, 00129 00131 OMX_ErrorInsufficientResources = (OMX_S32) 0x80001000, 00132 00134 OMX_ErrorUndefined = (OMX_S32) 0x80001001, 00135 00137 OMX_ErrorInvalidComponentName = (OMX_S32) 0x80001002, 00138 00140 OMX_ErrorComponentNotFound = (OMX_S32) 0x80001003, 00141 00144 OMX_ErrorInvalidComponent = (OMX_S32) 0x80001004, 00145 00147 OMX_ErrorBadParameter = (OMX_S32) 0x80001005, 00148 00150 OMX_ErrorNotImplemented = (OMX_S32) 0x80001006, 00151 00153 OMX_ErrorUnderflow = (OMX_S32) 0x80001007, 00154 00156 OMX_ErrorOverflow = (OMX_S32) 0x80001008, 00157 00159 OMX_ErrorHardware = (OMX_S32) 0x80001009, 00160 00162 OMX_ErrorInvalidState = (OMX_S32) 0x8000100A, 00163 00165 OMX_ErrorStreamCorrupt = (OMX_S32) 0x8000100B, 00166 00168 OMX_ErrorPortsNotCompatible = (OMX_S32) 0x8000100C, 00169 00172 OMX_ErrorResourcesLost = (OMX_S32) 0x8000100D, 00173 00175 OMX_ErrorNoMore = (OMX_S32) 0x8000100E, 00176 00178 OMX_ErrorVersionMismatch = (OMX_S32) 0x8000100F, 00179 00181 OMX_ErrorNotReady = (OMX_S32) 0x80001010, 00182 00184 OMX_ErrorTimeout = (OMX_S32) 0x80001011, 00185 00187 OMX_ErrorSameState = (OMX_S32) 0x80001012, 00188 00191 OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013, 00192 00197 OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014, 00198 00203 OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015, 00204 00209 OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016, 00210 00212 OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017, 00213 00214 /* Attempting a command that is not allowed during the present state. */ 00215 OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018, 00216 00218 OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019, 00219 00221 OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A, 00222 00224 OMX_ErrorBadPortIndex = (OMX_S32) 0x8000101B, 00225 00227 OMX_ErrorPortUnpopulated = (OMX_S32) 0x8000101C, 00228 00230 OMX_ErrorComponentSuspended = (OMX_S32) 0x8000101D, 00231 00233 OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E, 00234 00237 OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F, 00238 00240 OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020, 00241 00243 OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021, 00244 00246 OMX_ErrorContentPipeCreationFailed = (OMX_S32) 0x80001022, 00247 00249 OMX_ErrorSeperateTablesUsed = (OMX_S32) 0x80001023, 00250 00252 OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024, 00253 00254 OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, 00255 OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, 00256 OMX_ErrorMax = 0x7FFFFFFF 00257 } OMX_ERRORTYPE; 00258 00260 typedef OMX_ERRORTYPE (* OMX_COMPONENTINITTYPE)(OMX_IN OMX_HANDLETYPE hComponent); 00261 00263 typedef struct OMX_COMPONENTREGISTERTYPE 00264 { 00265 const char * pName; /* Component name, 128 byte limit (including '\0') applies */ 00266 OMX_COMPONENTINITTYPE pInitialize; /* Component instance initialization function */ 00267 } OMX_COMPONENTREGISTERTYPE; 00268 00270 extern OMX_COMPONENTREGISTERTYPE OMX_ComponentRegistered[]; 00271 00273 typedef struct OMX_PRIORITYMGMTTYPE { 00274 OMX_U32 nSize; 00275 OMX_VERSIONTYPE nVersion; 00276 OMX_U32 nGroupPriority; 00277 OMX_U32 nGroupID; 00278 } OMX_PRIORITYMGMTTYPE; 00279 00280 /* Component name and Role names are limited to 128 characters including the terminating '\0'. */ 00281 #define OMX_MAX_STRINGNAME_SIZE 128 00282 00284 typedef struct OMX_PARAM_COMPONENTROLETYPE { 00285 OMX_U32 nSize; 00286 OMX_VERSIONTYPE nVersion; 00287 OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE]; 00288 } OMX_PARAM_COMPONENTROLETYPE; 00289 00299 #define OMX_BUFFERFLAG_EOS 0x00000001 00300 00326 #define OMX_BUFFERFLAG_STARTTIME 0x00000002 00327 00328 00329 00349 #define OMX_BUFFERFLAG_DECODEONLY 0x00000004 00350 00351 00352 /* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt 00353 * @ingroup buf 00354 */ 00355 00356 #define OMX_BUFFERFLAG_DATACORRUPT 0x00000008 00357 00358 /* End of Frame: The buffer contains exactly one end of frame and no data 00359 * occurs after the end of frame. This flag is an optional hint. The absence 00360 * of this flag does not imply the absence of an end of frame within the buffer. 00361 * @ingroup buf 00362 */ 00363 #define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010 00364 00365 /* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame ' 00366 * a frame that has no dependency on any other frame information 00367 * @ingroup buf 00368 */ 00369 #define OMX_BUFFERFLAG_SYNCFRAME 0x00000020 00370 00371 /* Extra data present flag: there is extra data appended to the data stream 00372 * residing in the buffer 00373 * @ingroup buf 00374 */ 00375 #define OMX_BUFFERFLAG_EXTRADATA 0x00000040 00376 00393 #define OMX_BUFFERFLAG_CODECCONFIG 0x00000080 00394 00395 00396 00398 typedef struct OMX_BUFFERHEADERTYPE 00399 { 00400 OMX_U32 nSize; 00401 OMX_VERSIONTYPE nVersion; 00402 OMX_U8* pBuffer; 00404 OMX_U32 nAllocLen; 00405 OMX_U32 nFilledLen; 00407 OMX_U32 nOffset; 00409 OMX_PTR pAppPrivate; 00411 OMX_PTR pPlatformPrivate; 00413 OMX_PTR pInputPortPrivate; 00415 OMX_PTR pOutputPortPrivate; 00417 OMX_HANDLETYPE hMarkTargetComponent; 00419 OMX_PTR pMarkData; 00422 OMX_U32 nTickCount; 00431 OMX_TICKS nTimeStamp; 00438 OMX_U32 nFlags; 00439 OMX_U32 nOutputPortIndex; 00441 OMX_U32 nInputPortIndex; 00443 } OMX_BUFFERHEADERTYPE; 00444 00451 typedef enum OMX_EXTRADATATYPE 00452 { 00453 OMX_ExtraDataNone = 0, 00454 OMX_ExtraDataQuantization, 00455 OMX_ExtraDataKhronosExtensions = 0x6F000000, 00456 OMX_ExtraDataVendorStartUnused = 0x7F000000, 00457 OMX_ExtraDataMax = 0x7FFFFFFF 00458 } OMX_EXTRADATATYPE; 00459 00460 00461 typedef struct OMX_OTHER_EXTRADATATYPE { 00462 OMX_U32 nSize; 00463 OMX_VERSIONTYPE nVersion; 00464 OMX_U32 nPortIndex; 00465 OMX_EXTRADATATYPE eType; /* Extra Data type */ 00466 OMX_U32 nDataSize; /* Size of the supporting data to follow */ 00467 OMX_U8 data[1]; /* Supporting data hint */ 00468 } OMX_OTHER_EXTRADATATYPE; 00469 00471 typedef struct OMX_PORT_PARAM_TYPE { 00472 OMX_U32 nSize; 00473 OMX_VERSIONTYPE nVersion; 00474 OMX_U32 nPorts; 00475 OMX_U32 nStartPortNumber; 00476 } OMX_PORT_PARAM_TYPE; 00477 00479 typedef enum OMX_EVENTTYPE 00480 { 00481 OMX_EventCmdComplete, 00482 OMX_EventError, 00483 OMX_EventMark, 00484 OMX_EventPortSettingsChanged, 00485 OMX_EventBufferFlag, 00486 OMX_EventResourcesAcquired, 00489 OMX_EventComponentResumed, 00490 OMX_EventDynamicResourcesAvailable, 00491 OMX_EventPortFormatDetected, 00492 OMX_EventKhronosExtensions = 0x6F000000, 00493 OMX_EventVendorStartUnused = 0x7F000000, 00494 OMX_EventMax = 0x7FFFFFFF 00495 } OMX_EVENTTYPE; 00496 00497 typedef struct OMX_CALLBACKTYPE 00498 { 00530 OMX_ERRORTYPE (*EventHandler)( 00531 OMX_IN OMX_HANDLETYPE hComponent, 00532 OMX_IN OMX_PTR pAppData, 00533 OMX_IN OMX_EVENTTYPE eEvent, 00534 OMX_IN OMX_U32 nData1, 00535 OMX_IN OMX_U32 nData2, 00536 OMX_IN OMX_PTR pEventData); 00537 00560 OMX_ERRORTYPE (*EmptyBufferDone)( 00561 OMX_IN OMX_HANDLETYPE hComponent, 00562 OMX_IN OMX_PTR pAppData, 00563 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); 00564 00589 OMX_ERRORTYPE (*FillBufferDone)( 00590 OMX_OUT OMX_HANDLETYPE hComponent, 00591 OMX_OUT OMX_PTR pAppData, 00592 OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer); 00593 00594 } OMX_CALLBACKTYPE; 00595 00600 typedef enum OMX_BUFFERSUPPLIERTYPE 00601 { 00602 OMX_BufferSupplyUnspecified = 0x0, 00604 OMX_BufferSupplyInput, 00605 OMX_BufferSupplyOutput, 00606 OMX_BufferSupplyKhronosExtensions = 0x6F000000, 00607 OMX_BufferSupplyVendorStartUnused = 0x7F000000, 00608 OMX_BufferSupplyMax = 0x7FFFFFFF 00609 } OMX_BUFFERSUPPLIERTYPE; 00610 00611 00615 typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE { 00616 OMX_U32 nSize; 00617 OMX_VERSIONTYPE nVersion; 00618 OMX_U32 nPortIndex; 00619 OMX_BUFFERSUPPLIERTYPE eBufferSupplier; 00620 } OMX_PARAM_BUFFERSUPPLIERTYPE; 00621 00622 00627 #define OMX_PORTTUNNELFLAG_READONLY 0x00000001 00628 00629 00635 typedef struct OMX_TUNNELSETUPTYPE 00636 { 00637 OMX_U32 nTunnelFlags; 00638 OMX_BUFFERSUPPLIERTYPE eSupplier; 00639 } OMX_TUNNELSETUPTYPE; 00640 00641 /* OMX Component headers is included to enable the core to use 00642 macros for functions into the component for OMX release 1.0. 00643 Developers should not access any structures or data from within 00644 the component header directly */ 00645 /* TO BE REMOVED - #include <OMX_Component.h> */ 00646 00684 #define OMX_GetComponentVersion( \ 00685 hComponent, \ 00686 pComponentName, \ 00687 pComponentVersion, \ 00688 pSpecVersion, \ 00689 pComponentUUID) \ 00690 ((OMX_COMPONENTTYPE*)hComponent)->GetComponentVersion( \ 00691 hComponent, \ 00692 pComponentName, \ 00693 pComponentVersion, \ 00694 pSpecVersion, \ 00695 pComponentUUID) /* Macro End */ 00696 00697 00745 #define OMX_SendCommand( \ 00746 hComponent, \ 00747 Cmd, \ 00748 nParam, \ 00749 pCmdData) \ 00750 ((OMX_COMPONENTTYPE*)hComponent)->SendCommand( \ 00751 hComponent, \ 00752 Cmd, \ 00753 nParam, \ 00754 pCmdData) /* Macro End */ 00755 00756 00786 #define OMX_GetParameter( \ 00787 hComponent, \ 00788 nParamIndex, \ 00789 pComponentParameterStructure) \ 00790 ((OMX_COMPONENTTYPE*)hComponent)->GetParameter( \ 00791 hComponent, \ 00792 nParamIndex, \ 00793 pComponentParameterStructure) /* Macro End */ 00794 00795 00825 #define OMX_SetParameter( \ 00826 hComponent, \ 00827 nParamIndex, \ 00828 pComponentParameterStructure) \ 00829 ((OMX_COMPONENTTYPE*)hComponent)->SetParameter( \ 00830 hComponent, \ 00831 nParamIndex, \ 00832 pComponentParameterStructure) /* Macro End */ 00833 00834 00861 #define OMX_GetConfig( \ 00862 hComponent, \ 00863 nConfigIndex, \ 00864 pComponentConfigStructure) \ 00865 ((OMX_COMPONENTTYPE*)hComponent)->GetConfig( \ 00866 hComponent, \ 00867 nConfigIndex, \ 00868 pComponentConfigStructure) /* Macro End */ 00869 00870 00897 #define OMX_SetConfig( \ 00898 hComponent, \ 00899 nConfigIndex, \ 00900 pComponentConfigStructure) \ 00901 ((OMX_COMPONENTTYPE*)hComponent)->SetConfig( \ 00902 hComponent, \ 00903 nConfigIndex, \ 00904 pComponentConfigStructure) /* Macro End */ 00905 00906 00931 #define OMX_GetExtensionIndex( \ 00932 hComponent, \ 00933 cParameterName, \ 00934 pIndexType) \ 00935 ((OMX_COMPONENTTYPE*)hComponent)->GetExtensionIndex( \ 00936 hComponent, \ 00937 cParameterName, \ 00938 pIndexType) /* Macro End */ 00939 00940 00958 #define OMX_GetState( \ 00959 hComponent, \ 00960 pState) \ 00961 ((OMX_COMPONENTTYPE*)hComponent)->GetState( \ 00962 hComponent, \ 00963 pState) /* Macro End */ 00964 00965 00985 #define OMX_UseBuffer( \ 00986 hComponent, \ 00987 ppBufferHdr, \ 00988 nPortIndex, \ 00989 pAppPrivate, \ 00990 nSizeBytes, \ 00991 pBuffer) \ 00992 ((OMX_COMPONENTTYPE*)hComponent)->UseBuffer( \ 00993 hComponent, \ 00994 ppBufferHdr, \ 00995 nPortIndex, \ 00996 pAppPrivate, \ 00997 nSizeBytes, \ 00998 pBuffer) 00999 01000 01028 #define OMX_AllocateBuffer( \ 01029 hComponent, \ 01030 ppBuffer, \ 01031 nPortIndex, \ 01032 pAppPrivate, \ 01033 nSizeBytes) \ 01034 ((OMX_COMPONENTTYPE*)hComponent)->AllocateBuffer( \ 01035 hComponent, \ 01036 ppBuffer, \ 01037 nPortIndex, \ 01038 pAppPrivate, \ 01039 nSizeBytes) /* Macro End */ 01040 01041 01064 #define OMX_FreeBuffer( \ 01065 hComponent, \ 01066 nPortIndex, \ 01067 pBuffer) \ 01068 ((OMX_COMPONENTTYPE*)hComponent)->FreeBuffer( \ 01069 hComponent, \ 01070 nPortIndex, \ 01071 pBuffer) /* Macro End */ 01072 01073 01096 #define OMX_EmptyThisBuffer( \ 01097 hComponent, \ 01098 pBuffer) \ 01099 ((OMX_COMPONENTTYPE*)hComponent)->EmptyThisBuffer( \ 01100 hComponent, \ 01101 pBuffer) /* Macro End */ 01102 01103 01126 #define OMX_FillThisBuffer( \ 01127 hComponent, \ 01128 pBuffer) \ 01129 ((OMX_COMPONENTTYPE*)hComponent)->FillThisBuffer( \ 01130 hComponent, \ 01131 pBuffer) /* Macro End */ 01132 01133 01134 01165 #define OMX_UseEGLImage( \ 01166 hComponent, \ 01167 ppBufferHdr, \ 01168 nPortIndex, \ 01169 pAppPrivate, \ 01170 eglImage) \ 01171 ((OMX_COMPONENTTYPE*)hComponent)->UseEGLImage( \ 01172 hComponent, \ 01173 ppBufferHdr, \ 01174 nPortIndex, \ 01175 pAppPrivate, \ 01176 eglImage) 01177 01189 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void); 01190 01191 01204 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void); 01205 01206 01244 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum( 01245 OMX_OUT OMX_STRING cComponentName, 01246 OMX_IN OMX_U32 nNameLength, 01247 OMX_IN OMX_U32 nIndex); 01248 01249 01277 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle( 01278 OMX_OUT OMX_HANDLETYPE* pHandle, 01279 OMX_IN OMX_STRING cComponentName, 01280 OMX_IN OMX_PTR pAppData, 01281 OMX_IN OMX_CALLBACKTYPE* pCallBacks); 01282 01283 01299 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle( 01300 OMX_IN OMX_HANDLETYPE hComponent); 01301 01302 01303 01352 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel( 01353 OMX_IN OMX_HANDLETYPE hOutput, 01354 OMX_IN OMX_U32 nPortOutput, 01355 OMX_IN OMX_HANDLETYPE hInput, 01356 OMX_IN OMX_U32 nPortInput); 01357 01359 OMX_API OMX_ERRORTYPE OMX_GetContentPipe( 01360 OMX_OUT OMX_HANDLETYPE *hPipe, 01361 OMX_IN OMX_STRING szURI); 01362 01390 OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole ( 01391 OMX_IN OMX_STRING role, 01392 OMX_INOUT OMX_U32 *pNumComps, 01393 OMX_INOUT OMX_U8 **compNames); 01394 01420 OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent ( 01421 OMX_IN OMX_STRING compName, 01422 OMX_INOUT OMX_U32 *pNumRoles, 01423 OMX_OUT OMX_U8 **roles); 01424 01425 #ifdef __cplusplus 01426 } 01427 #endif /* __cplusplus */ 01428 01429 #endif 01430 /* File EOF */ 01431