/****************************************************************************** Copyright (C), 2001-2016, Allwinner Tech. Co., Ltd. ****************************************************************************** File Name : mm_component.h Version : Initial Draft Author : Allwinner BU3-PD2 Team Created : 2016/03/15 Last Modified : Description : The common defination for multimedia component. Function List : History : ******************************************************************************/ #ifndef __IPCLINUX_MM_COMPONENT_H__ #define __IPCLINUX_MM_COMPONENT_H__ //ref platform headers #include "plat_type.h" #include "plat_errno.h" //media api headers to app #include "mm_common.h" #include "mm_comm_video.h" #ifdef __cplusplus extern "C" { #endif /* End of #ifdef __cplusplus */ typedef void* COMP_HANDLETYPE; typedef enum COMP_STATETYPE { COMP_StateInvalid, /**< component has detected that it's internal data structures are corrupted to the point that it cannot determine it's state properly */ COMP_StateLoaded, /**< component has been loaded but has not completed initialization. The OMX_SetParameter macro and the OMX_GetParameter macro are the only valid macros allowed to be sent to the component in this state. */ COMP_StateIdle, /**< component initialization has been completed successfully and the component is ready to to start. */ COMP_StateExecuting, /**< component has accepted the start command and is processing data (if data is available) */ COMP_StatePause, /**< component has received pause command */ COMP_StateWaitForResources, /**< component is waiting for resources, either after preemption or before it gets the resources requested. See specification for complete details. */ COMP_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ COMP_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ COMP_StateMax = 0X7FFFFFFF } COMP_STATETYPE; /** The COMP_COMMANDTYPE enumeration is used to specify the action in the * OMX_SendCommand macro. * @ingroup core */ typedef enum COMP_COMMANDTYPE { COMP_CommandStateSet, /**< Change the component state */ COMP_CommandFlush, /**< Flush the data queue(s) of a component */ COMP_CommandPortDisable, /**< Disable a port on a component. */ COMP_CommandPortEnable, /**< Enable a port on a component. */ COMP_CommandMarkBuffer, /**< Mark a component/buffer for observation */ COMP_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ COMP_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ //COMP_CommandVendorAddChn, /**< add a mux channel of recRender, MUX_CHN_ATTR_S */ //COMP_CommandVendorRemoveChn, /**< remove a mux channel of recRender, chnId */ //COMP_CommandSwitchFile, //impact switch file, when cache exist: immediately; when cache not exist: smooth. //COMP_CommandSwitchFileNormal, //normal switch file. cache not exist: smooth. COMP_CommandVendorFillBuffer, //fill audio buffer from audioSink. COMP_CommandVendorReturnAllBuffer, //return all buffers which come from other component. COMP_CommandVendorChangeANativeWindow, COMP_CommandMax = 0X7FFFFFFF } COMP_COMMANDTYPE; /** The COMP_INDEXTYPE enumeration is used to select a structure when either * getting or setting parameters and/or configuration data. Each entry in * this enumeration maps to an OMX specified structure. When the * OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods * are used, the second parameter will always be an entry from this enumeration * and the third entry will be the structure shown in the comments for the entry. * For example, if the application is initializing a cropping function, the * OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter * and would send a pointer to an initialized OMX_RECTTYPE structure as the * third parameter. * * The enumeration entries named with the OMX_Config prefix are sent using * the OMX_SetConfig command and the enumeration entries named with the * OMX_PARAM_ prefix are sent using the OMX_SetParameter command. */ typedef enum COMP_INDEXTYPE { COMP_IndexComponentStartUnused = 0x01000000, COMP_IndexParamPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */ COMP_IndexParamAudioInit, /**< reference: OMX_PORT_PARAM_TYPE */ COMP_IndexParamImageInit, /**< reference: OMX_PORT_PARAM_TYPE */ COMP_IndexParamVideoInit, /**< reference: OMX_PORT_PARAM_TYPE */ COMP_IndexParamOtherInit, /**< reference: OMX_PORT_PARAM_TYPE */ COMP_IndexParamNumAvailableStreams, /**< reference: OMX_PARAM_U32TYPE */ COMP_IndexParamActiveStream, /**< reference: OMX_PARAM_U32TYPE */ COMP_IndexParamSuspensionPolicy, /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */ COMP_IndexParamComponentSuspended, /**< reference: OMX_PARAM_SUSPENSIONTYPE */ COMP_IndexConfigCapturing, /**< reference: OMX_CONFIG_BOOLEANTYPE */ COMP_IndexConfigCaptureMode, /**< reference: OMX_CONFIG_CAPTUREMODETYPE */ COMP_IndexAutoPauseAfterCapture, /**< reference: OMX_CONFIG_BOOLEANTYPE */ COMP_IndexParamContentURI, /**< reference: OMX_PARAM_CONTENTURITYPE */ COMP_IndexParamCustomContentPipe, /**< reference: OMX_PARAM_CONTENTPIPETYPE */ COMP_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */ COMP_IndexConfigMetadataItemCount, /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */ COMP_IndexConfigContainerNodeCount, /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */ COMP_IndexConfigMetadataItem, /**< reference: OMX_CONFIG_METADATAITEMTYPE */ COMP_IndexConfigCounterNodeID, /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */ COMP_IndexParamMetadataFilterType, /**< reference: OMX_PARAM_METADATAFILTERTYPE */ COMP_IndexParamMetadataKeyFilter, /**< reference: OMX_PARAM_METADATAFILTERTYPE */ COMP_IndexConfigPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */ COMP_IndexParamStandardComponentRole, /**< reference: OMX_PARAM_COMPONENTROLETYPE */ COMP_IndexPortStartUnused = 0x02000000, COMP_IndexParamPortDefinition, /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */ COMP_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */ COMP_IndexReservedStartUnused = 0x03000000, /* Audio parameters and configurations */ COMP_IndexAudioStartUnused = 0x04000000, COMP_IndexParamAudioPortFormat, /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */ COMP_IndexParamAudioPcm, /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */ COMP_IndexParamAudioAac, /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */ COMP_IndexParamAudioRa, /**< reference: OMX_AUDIO_PARAM_RATYPE */ COMP_IndexParamAudioMp3, /**< reference: OMX_AUDIO_PARAM_MP3TYPE */ COMP_IndexParamAudioAdpcm, /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */ COMP_IndexParamAudioG723, /**< reference: OMX_AUDIO_PARAM_G723TYPE */ COMP_IndexParamAudioG729, /**< reference: OMX_AUDIO_PARAM_G729TYPE */ COMP_IndexParamAudioAmr, /**< reference: OMX_AUDIO_PARAM_AMRTYPE */ COMP_IndexParamAudioWma, /**< reference: OMX_AUDIO_PARAM_WMATYPE */ COMP_IndexParamAudioSbc, /**< reference: OMX_AUDIO_PARAM_SBCTYPE */ COMP_IndexParamAudioMidi, /**< reference: OMX_AUDIO_PARAM_MIDITYPE */ COMP_IndexParamAudioGsm_FR, /**< reference: OMX_AUDIO_PARAM_GSMFRTYPE */ COMP_IndexParamAudioMidiLoadUserSound, /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */ COMP_IndexParamAudioG726, /**< reference: OMX_AUDIO_PARAM_G726TYPE */ COMP_IndexParamAudioGsm_EFR, /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */ COMP_IndexParamAudioGsm_HR, /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */ COMP_IndexParamAudioPdc_FR, /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */ COMP_IndexParamAudioPdc_EFR, /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */ COMP_IndexParamAudioPdc_HR, /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */ COMP_IndexParamAudioTdma_FR, /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */ COMP_IndexParamAudioTdma_EFR, /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */ COMP_IndexParamAudioQcelp8, /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */ COMP_IndexParamAudioQcelp13, /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */ COMP_IndexParamAudioEvrc, /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */ COMP_IndexParamAudioSmv, /**< reference: OMX_AUDIO_PARAM_SMVTYPE */ COMP_IndexParamAudioVorbis, /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */ COMP_IndexParamAudioFlac, /**< reference: OMX_AUDIO_PARAM_FLACTYPE */ COMP_IndexConfigAudioMidiImmediateEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */ COMP_IndexConfigAudioMidiControl, /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */ COMP_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */ COMP_IndexConfigAudioMidiStatus, /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */ COMP_IndexConfigAudioMidiMetaEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */ COMP_IndexConfigAudioMidiMetaEventData, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */ COMP_IndexConfigAudioVolume, /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */ COMP_IndexConfigAudioBalance, /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */ COMP_IndexConfigAudioChannelMute, /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */ COMP_IndexConfigAudioMute, /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */ COMP_IndexConfigAudioLoudness, /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */ COMP_IndexConfigAudioEchoCancelation, /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */ COMP_IndexConfigAudioNoiseReduction, /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */ COMP_IndexConfigAudioBass, /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */ COMP_IndexConfigAudioTreble, /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */ COMP_IndexConfigAudioStereoWidening, /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */ COMP_IndexConfigAudioChorus, /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */ COMP_IndexConfigAudioEqualizer, /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */ COMP_IndexConfigAudioReverberation, /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */ COMP_IndexConfigAudioChannelVolume, /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */ /* Image specific parameters and configurations */ COMP_IndexImageStartUnused = 0x05000000, COMP_IndexParamImagePortFormat, /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */ COMP_IndexParamFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */ COMP_IndexConfigFocusControl, /**< reference: OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */ COMP_IndexParamQFactor, /**< reference: OMX_IMAGE_PARAM_QFACTORTYPE */ COMP_IndexParamQuantizationTable, /**< reference: OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */ COMP_IndexParamHuffmanTable, /**< reference: OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */ COMP_IndexConfigFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */ /* Video specific parameters and configurations */ COMP_IndexVideoStartUnused = 0x06000000, COMP_IndexParamVideoPortFormat, /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */ COMP_IndexParamVideoQuantization, /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONTYPE */ COMP_IndexParamVideoFastUpdate, /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */ COMP_IndexParamVideoBitrate, /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */ COMP_IndexParamVideoMotionVector, /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */ COMP_IndexParamVideoIntraRefresh, /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */ COMP_IndexParamVideoErrorCorrection, /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */ COMP_IndexParamVideoVBSMC, /**< reference: OMX_VIDEO_PARAM_VBSMCTYPE */ COMP_IndexParamVideoMpeg2, /**< reference: OMX_VIDEO_PARAM_MPEG2TYPE */ COMP_IndexParamVideoMpeg4, /**< reference: OMX_VIDEO_PARAM_MPEG4TYPE */ COMP_IndexParamVideoWmv, /**< reference: OMX_VIDEO_PARAM_WMVTYPE */ COMP_IndexParamVideoRv, /**< reference: OMX_VIDEO_PARAM_RVTYPE */ COMP_IndexParamVideoAvc, /**< reference: OMX_VIDEO_PARAM_AVCTYPE */ COMP_IndexParamVideoH263, /**< reference: OMX_VIDEO_PARAM_H263TYPE */ COMP_IndexParamVideoProfileLevelQuerySupported, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */ COMP_IndexParamVideoProfileLevelCurrent, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */ COMP_IndexConfigVideoBitrate, /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */ COMP_IndexConfigVideoFramerate, /**< reference: OMX_CONFIG_FRAMERATETYPE */ COMP_IndexConfigVideoIntraVOPRefresh, /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */ COMP_IndexConfigVideoIntraMBRefresh, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */ COMP_IndexConfigVideoMBErrorReporting, /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */ COMP_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */ COMP_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */ COMP_IndexParamVideoSliceFMO, /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */ COMP_IndexConfigVideoAVCIntraPeriod, /**< reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */ COMP_IndexConfigVideoNalSize, /**< reference: OMX_VIDEO_CONFIG_NALSIZE */ /* Image & Video common Configurations */ COMP_IndexCommonStartUnused = 0x07000000, COMP_IndexParamCommonDeblocking, /**< reference: OMX_PARAM_DEBLOCKINGTYPE */ COMP_IndexParamCommonSensorMode, /**< reference: OMX_PARAM_SENSORMODETYPE */ COMP_IndexParamCommonInterleave, /**< reference: OMX_PARAM_INTERLEAVETYPE */ COMP_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */ COMP_IndexConfigCommonScale, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */ COMP_IndexConfigCommonImageFilter, /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */ COMP_IndexConfigCommonColorEnhancement, /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */ COMP_IndexConfigCommonColorKey, /**< reference: OMX_CONFIG_COLORKEYTYPE */ COMP_IndexConfigCommonColorBlend, /**< reference: OMX_CONFIG_COLORBLENDTYPE */ COMP_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */ COMP_IndexConfigCommonRotate, /**< reference: OMX_CONFIG_ROTATIONTYPE */ COMP_IndexConfigCommonMirror, /**< reference: OMX_CONFIG_MIRRORTYPE */ COMP_IndexConfigCommonOutputPosition, /**< reference: OMX_CONFIG_POINTTYPE */ COMP_IndexConfigCommonInputCrop, /**< reference: OMX_CONFIG_RECTTYPE */ COMP_IndexConfigCommonOutputCrop, /**< reference: OMX_CONFIG_RECTTYPE */ COMP_IndexConfigCommonDigitalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */ COMP_IndexConfigCommonOpticalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/ COMP_IndexConfigCommonWhiteBalance, /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */ COMP_IndexConfigCommonExposure, /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */ COMP_IndexConfigCommonContrast, /**< reference: OMX_CONFIG_CONTRASTTYPE */ COMP_IndexConfigCommonBrightness, /**< reference: OMX_CONFIG_BRIGHTNESSTYPE */ COMP_IndexConfigCommonBacklight, /**< reference: OMX_CONFIG_BACKLIGHTTYPE */ COMP_IndexConfigCommonGamma, /**< reference: OMX_CONFIG_GAMMATYPE */ COMP_IndexConfigCommonSaturation, /**< reference: OMX_CONFIG_SATURATIONTYPE */ COMP_IndexConfigCommonLightness, /**< reference: OMX_CONFIG_LIGHTNESSTYPE */ COMP_IndexConfigCommonExclusionRect, /**< reference: OMX_CONFIG_RECTTYPE */ COMP_IndexConfigCommonDithering, /**< reference: OMX_CONFIG_DITHERTYPE */ COMP_IndexConfigCommonPlaneBlend, /**< reference: OMX_CONFIG_PLANEBLENDTYPE */ COMP_IndexConfigCommonExposureValue, /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */ COMP_IndexConfigCommonOutputSize, /**< reference: OMX_FRAMESIZETYPE */ COMP_IndexParamCommonExtraQuantData, /**< reference: OMX_OTHER_EXTRADATATYPE */ COMP_IndexConfigCommonFocusRegion, /**< reference: OMX_CONFIG_FOCUSREGIONTYPE */ COMP_IndexConfigCommonFocusStatus, /**< reference: OMX_PARAM_FOCUSSTATUSTYPE */ COMP_IndexConfigCommonTransitionEffect, /**< reference: OMX_CONFIG_TRANSITIONEFFECTTYPE */ /* Reserved Configuration range */ COMP_IndexOtherStartUnused = 0x08000000, COMP_IndexParamOtherPortFormat, /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */ COMP_IndexConfigOtherPower, /**< reference: OMX_OTHER_CONFIG_POWERTYPE */ COMP_IndexConfigOtherStats, /**< reference: OMX_OTHER_CONFIG_STATSTYPE */ /* Reserved Time range */ COMP_IndexTimeStartUnused = 0x09000000, COMP_IndexConfigTimeScale, /**< reference: OMX_TIME_CONFIG_SCALETYPE */ COMP_IndexConfigTimeClockState, /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */ COMP_IndexConfigTimeActiveRefClock, /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */ COMP_IndexConfigTimeCurrentMediaTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */ COMP_IndexConfigTimeCurrentWallTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */ COMP_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */ COMP_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */ COMP_IndexConfigTimeMediaTimeRequest, /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */ COMP_IndexConfigTimeClientStartTime, /**SendCommand( \ hComponent, \ Cmd, \ nParam, \ pCmdData) /* Macro End */ /** The OMX_GetParameter macro will get one of the current parameter settings from the component. This macro cannot only be invoked when the component is in the OMX_StateInvalid state. The nParamIndex parameter is used to indicate which structure is being requested from the component. The application shall allocate the correct structure and shall fill in the structure size and version information before invoking this macro. When the parameter applies to a port, the caller shall fill in the appropriate nPortIndex value indicating the port on which the parameter applies. If the component has not had any settings changed, then the component should return a set of valid DEFAULT parameters for the component. This is a blocking call. The component should return from this call within 20 msec. @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [in] nParamIndex Index of the structure to be filled. This value is from the OMX_INDEXTYPE enumeration. @param [in,out] pComponentParameterStructure Pointer to application allocated structure to be filled by the component. @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup comp */ //#define COMP_GetParameter( \ // hComponent, \ // nParamIndex, \ // pComponentParameterStructure) \ // ((MM_COMPONENTTYPE*)hComponent)->GetParameter( \ // hComponent, \ // nParamIndex, \ // pComponentParameterStructure) /* Macro End */ /** The OMX_SetParameter macro will send an initialization parameter structure to a component. Each structure shall be sent one at a time, in a separate invocation of the macro. This macro can only be invoked when the component is in the OMX_StateLoaded state, or the port is disabled (when the parameter applies to a port). The nParamIndex parameter is used to indicate which structure is being passed to the component. The application shall allocate the correct structure and shall fill in the structure size and version information (as well as the actual data) before invoking this macro. The application is free to dispose of this structure after the call as the component is required to copy any data it shall retain. This is a blocking call. The component should return from this call within 20 msec. @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [in] nIndex Index of the structure to be sent. This value is from the OMX_INDEXTYPE enumeration. @param [in] pComponentParameterStructure pointer to application allocated structure to be used for initialization by the component. @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup comp */ //#define COMP_SetParameter( \ // hComponent, \ // nParamIndex, \ // pComponentParameterStructure) \ // ((MM_COMPONENTTYPE*)hComponent)->SetParameter( \ // hComponent, \ // nParamIndex, \ // pComponentParameterStructure) /* Macro End */ /** The OMX_GetConfig macro will get one of the configuration structures from a component. This macro can be invoked anytime after the component has been loaded. The nParamIndex call parameter is used to indicate which structure is being requested from the component. The application shall allocate the correct structure and shall fill in the structure size and version information before invoking this macro. If the component has not had this configuration parameter sent before, then the component should return a set of valid DEFAULT values for the component. This is a blocking call. The component should return from this call within 5 msec. @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [in] nIndex Index of the structure to be filled. This value is from the OMX_INDEXTYPE enumeration. @param [in,out] pComponentConfigStructure pointer to application allocated structure to be filled by the component. @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup comp */ #define COMP_GetConfig( \ hComponent, \ nConfigIndex, \ pComponentConfigStructure) \ ((MM_COMPONENTTYPE*)hComponent)->GetConfig( \ hComponent, \ nConfigIndex, \ pComponentConfigStructure) /* Macro End */ /** The OMX_SetConfig macro will send one of the configuration structures to a component. Each structure shall be sent one at a time, each in a separate invocation of the macro. This macro can be invoked anytime after the component has been loaded. The application shall allocate the correct structure and shall fill in the structure size and version information (as well as the actual data) before invoking this macro. The application is free to dispose of this structure after the call as the component is required to copy any data it shall retain. This is a blocking call. The component should return from this call within 5 msec. @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [in] nConfigIndex Index of the structure to be sent. This value is from the OMX_INDEXTYPE enumeration above. @param [in] pComponentConfigStructure pointer to application allocated structure to be used for initialization by the component. @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup comp */ #define COMP_SetConfig( \ hComponent, \ nConfigIndex, \ pComponentConfigStructure) \ ((MM_COMPONENTTYPE*)hComponent)->SetConfig( \ hComponent, \ nConfigIndex, \ pComponentConfigStructure) /* Macro End */ /** The OMX_GetState macro will invoke the component to get the current state of the component and place the state value into the location pointed to by pState. The component should return from this call within 5 msec. @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [out] pState pointer to the location to receive the state. The value returned is one of the OMX_STATETYPE members @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup comp */ #define COMP_GetState( \ hComponent, \ pState) \ ((MM_COMPONENTTYPE*)hComponent)->GetState( \ hComponent, \ pState) /* Macro End */ /** The OMX_EmptyThisBuffer macro will send a buffer full of data to an input port of a component. The buffer will be emptied by the component and returned to the application via the EmptyBufferDone call back. This is a non-blocking call in that the component will record the buffer and return immediately and then empty the buffer, later, at the proper time. As expected, this macro may be invoked only while the component is in the OMX_StateExecuting. If nPortIndex does not specify an input port, the component shall return an error. The component should return from this call within 5 msec. @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [in] pBuffer pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer or AllocateBuffer. @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup comp buf */ #define COMP_EmptyThisBuffer( \ hComponent, \ pBuffer) \ ((MM_COMPONENTTYPE*)hComponent)->EmptyThisBuffer( \ hComponent, \ pBuffer) /* Macro End */ /** The OMX_FillThisBuffer macro will send an empty buffer to an output port of a component. The buffer will be filled by the component and returned to the application via the FillBufferDone call back. This is a non-blocking call in that the component will record the buffer and return immediately and then fill the buffer, later, at the proper time. As expected, this macro may be invoked only while the component is in the OMX_ExecutingState. If nPortIndex does not specify an output port, the component shall return an error. The component should return from this call within 5 msec. @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [in] pBuffer pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer or AllocateBuffer. @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup comp buf */ #define COMP_FillThisBuffer( \ hComponent, \ pBuffer) \ ((MM_COMPONENTTYPE*)hComponent)->FillThisBuffer( \ hComponent, \ pBuffer) /* Macro End */ /** Structure representing a time stamp used with the following configs * on the Clock Component (CC): * * OMX_IndexConfigTimeCurrentWallTime: query of the CC's current wall * time * OMX_IndexConfigTimeCurrentMediaTime: query of the CC's current media * time * OMX_IndexConfigTimeCurrentAudioReference and * OMX_IndexConfigTimeCurrentVideoReference: audio/video reference * clock sending SC its reference time * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends * this structure to the Clock Component via a SetConfig on its * client port when it receives a buffer with * OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp * specified by that buffer for nStartTimestamp. * * It's also used with the following config on components in general: * * OMX_IndexConfigTimePosition: IL client querying component position * (GetConfig) or commanding a component to seek to the given location * (SetConfig) */ typedef struct COMP_TIME_CONFIG_TIMESTAMPTYPE { int nPortIndex; /**< port that this structure applies to */ int64_t nTimestamp; /**< timestamp .*/ } COMP_TIME_CONFIG_TIMESTAMPTYPE; #define CDX_ComponentNameDemux "OMX.CedarX.demux" #define CDX_ComponentNameVideoDecoder "OMX.CedarX.videoDecoder" #define CDX_ComponentNameAudioDecoder "OMX.CedarX.audioDecoder" #define CDX_ComponentNameSubtitleDecoder "OMX.CedarX.subtitleDecoder" #define CDX_ComponentNameVideoRender "OMX.CedarX.videoRender" #define CDX_ComponentNameAudioRender "OMX.CedarX.audioRender" #define CDX_ComponentNameSubtitleRender "OMX.CedarX.subtitleRender" #define CDX_ComponentNameClock "OMX.CedarX.clock" #define CDX_ComponentNameVideoSource "OMX.CedarX.videoSource" #define CDX_ComponentNameAudioSource "OMX.CedarX.audioSource" #define CDX_ComponentNameTextSource "OMX.CedarX.textSource" #define CDX_ComponentNameVideoEncoder "OMX.CedarX.videoEncoder" #define CDX_ComponentNameAudioEncoder "OMX.CedarX.audioEncoder" #define CDX_ComponentNameTextEncoder "OMX.CedarX.textEncoder" #define CDX_ComponentNameMuxer "OMX.CedarX.muxer" #define CDX_ComponentNameStreamDemux "OMX.CedarX.streamDemux" #define CDX_ComponentNameAIChannel "OMX.CedarX.AIChannel" #define CDX_ComponentNameAOChannel "OMX.CedarX.AOChannel" #define CDX_ComponentNameViScale "OMX.CedarX.ViScale" #define CDX_ComponentNameVda "OMX.CedarX.Vda" #define CDX_ComponentNameISE "OMX.CedarX.ISE" #define CDX_ComponentNameEIS "OMX.CedarX.EIS" #define CDX_ComponentNameUVCInput "OMX.CedarX.UVCInput" typedef ERRORTYPE (*ComponentInit)(PARAM_IN COMP_HANDLETYPE hComponent); typedef struct CDX_COMPONENTREGISTRY { char* name; // Component name ComponentInit comp_init_fn; // create instance fn ptr }CDX_COMPONENTREGISTRY; typedef enum COMP_TUNNEL_TYPE{ TUNNEL_TYPE_COMMON = 0x100, TUNNEL_TYPE_CLOCK , }COMP_TUNNEL_TYPE; typedef struct COMP_INTERNAL_TUNNELINFOTYPE{ unsigned int nPortIndex; COMP_HANDLETYPE hTunnel; unsigned int nTunnelPortIndex; COMP_TUNNEL_TYPE eTunnelType; }COMP_INTERNAL_TUNNELINFOTYPE; typedef struct CDX_TUNNELINFOTYPE{ COMP_HANDLETYPE hTunnelMaster; COMP_HANDLETYPE hTunnelSlave; unsigned int nMasterPortIndex; unsigned int nSlavePortIndex; COMP_TUNNEL_TYPE eTunnelType; struct CDX_TUNNELINFOTYPE *hNext; }CDX_TUNNELINFOTYPE; typedef struct CDX_TUNNELLINKTYPE{ CDX_TUNNELINFOTYPE *head; CDX_TUNNELINFOTYPE *tail; }CDX_TUNNELLINKTYPE; /** The OMX_GetHandle method will locate the component specified by the component name given, load that component into memory and then invoke the component's methods to create an instance of the component. The core should return from this call within 20 msec. @param [out] pHandle pointer to an COMP_HANDLETYPE pointer to be filled in by this method. @param [in] cComponentName pointer to a null terminated string with the component name. The names of the components are strings less than 127 bytes in length plus the trailing null for a maximum size of 128 bytes. An example of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are assigned by the vendor, but shall start with "OMX." and then have the Vendor designation next. @param [in] pAppData pointer to an application defined value that will be returned during callbacks so that the application can identify the source of the callback. @param [in] pCallBacks pointer to a COMP_CALLBACKTYPE structure that will be passed to the component to initialize it with. @return ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup core */ ERRORTYPE COMP_GetHandle( PARAM_OUT COMP_HANDLETYPE* pHandle, PARAM_IN char* cComponentName, PARAM_IN void* pAppData, PARAM_IN COMP_CALLBACKTYPE* pCallBacks); /** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle method. If the component reference count goes to zero, the component will be unloaded from memory. The core should return from this call within 20 msec when the component is in the OMX_StateLoaded state. @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the GetHandle function. @return ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup core */ ERRORTYPE COMP_FreeHandle( PARAM_IN COMP_HANDLETYPE hComponent); /** The OMX_SetupTunnel method will handle the necessary calls to the components to setup the specified tunnel the two components. NOTE: This is an actual method (not a #define macro). This method will make calls into the component ComponentTunnelRequest method to do the actual tunnel connection. The ComponentTunnelRequest method on both components will be called. This method shall not be called unless the component is in the OMX_StateLoaded state except when the ports used for the tunnel are disabled. In this case, the component may be in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle states. The core should return from this call within 20 msec. @param [in] hOutput Handle of the component to be accessed. Also this is the handle of the component whose port, specified in the nPortOutput parameter will be used the source for the tunnel. This is the component handle returned by the call to the OMX_GetHandle function. There is a requirement that hOutput be the source for the data when tunelling (i.e. nPortOutput is an output port). If 0x0, the component specified in hInput will have it's port specified in nPortInput setup for communication with the application / IL client. @param [in] nPortOutput nPortOutput is used to select the source port on component to be used in the tunnel. @param [in] hInput This is the component to setup the tunnel with. This is the handle of the component whose port, specified in the nPortInput parameter will be used the destination for the tunnel. This is the component handle returned by the call to the OMX_GetHandle function. There is a requirement that hInput be the destination for the data when tunelling (i.e. nPortInut is an input port). If 0x0, the component specified in hOutput will have it's port specified in nPortPOutput setup for communication with the application / IL client. @param [in] nPortInput nPortInput is used to select the destination port on component to be used in the tunnel. @return ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. When OMX_ErrorNotImplemented is returned, one or both components is a non-interop component and does not support tunneling. On failure, the ports of both components are setup for communication with the application / IL Client. @ingroup core tun */ ERRORTYPE COMP_SetupTunnel( PARAM_IN COMP_HANDLETYPE hOutput, PARAM_IN unsigned int nPortOutput, PARAM_IN COMP_HANDLETYPE hInput, PARAM_IN unsigned int nPortInput); ERRORTYPE COMP_ResetTunnel( PARAM_IN COMP_HANDLETYPE hOutput, PARAM_IN unsigned int nPortOutput, PARAM_IN COMP_HANDLETYPE hInput, PARAM_IN unsigned int nPortInput); ERRORTYPE COMP_AddTunnelInfoChain(CDX_TUNNELLINKTYPE *cdx_tunnel_link,PARAM_IN COMP_HANDLETYPE hOutput,PARAM_IN unsigned int nPortOutput,PARAM_IN COMP_HANDLETYPE hInput,PARAM_IN unsigned int nPortInput); ERRORTYPE COMP_DeleteTunnelInfoChain(CDX_TUNNELLINKTYPE *cdx_tunnel_link); ERRORTYPE COMP_QueryTunnelInfoChain(PARAM_IN CDX_TUNNELLINKTYPE *cdx_tunnel_link, PARAM_IN COMP_HANDLETYPE master, PARAM_IN COMP_HANDLETYPE slave, PARAM_OUT CDX_TUNNELINFOTYPE *cdx_tunnel_info); ERRORTYPE COMP_UpdateTunnelSlavePortDefine(PARAM_IN COMP_HANDLETYPE hOutput,PARAM_IN unsigned int nPortOutput,PARAM_IN COMP_HANDLETYPE hInput,PARAM_IN unsigned int nPortInput); #define ERR_COMPCORE_NOMEM DEF_ERR(MOD_ID_COMPCORE, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM) #define ERR_COMPCORE_UNEXIST DEF_ERR(MOD_ID_COMPCORE, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST) #define ERR_COMPCORE_NOT_SUPPORT DEF_ERR(MOD_ID_COMPCORE, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT) #define CompSendEvent(pComp, event, data1, data2) \ pComp->pCallbacks->EventHandler(pComp->hSelf, pComp->pAppData, event, data1, data2, NULL) #ifdef __cplusplus } #endif /* End of #ifdef __cplusplus */ #endif /* __IPCLINUX_MM_COMPONENT_H__ */