30 #ifndef __OMX_BASE_PORT_H__
31 #define __OMX_BASE_PORT_H__
33 #define TUNNEL_USE_BUFFER_RETRY 20
34 #define TUNNEL_USE_BUFFER_RETRY_USLEEP_TIME 50000
39 #define PORT_IS_BEING_FLUSHED(pPort) (pPort->bIsPortFlushed == OMX_TRUE)
40 #define PORT_IS_BEING_DISABLED(pPort) (pPort->bIsTransientToDisabled == OMX_TRUE)
41 #define PORT_IS_ENABLED(pPort) (pPort->sPortParam.bEnabled == OMX_TRUE)
42 #define PORT_IS_POPULATED(pPort) (pPort->sPortParam.bPopulated == OMX_TRUE)
43 #define PORT_IS_TUNNELED(pPort) (pPort->nTunnelFlags & TUNNEL_ESTABLISHED)
44 #define PORT_IS_DEEP_TUNNELED(pPort) (pPort->nTunnelFlags & PROPRIETARY_COMMUNICATION_ESTABLISHED)
45 #define PORT_IS_BUFFER_SUPPLIER(pPort) (pPort->nTunnelFlags & TUNNEL_IS_SUPPLIER)
46 #define PORT_IS_TUNNELED_N_BUFFER_SUPPLIER(pPort) ((pPort->nTunnelFlags & TUNNEL_ESTABLISHED) && (pPort->nTunnelFlags & TUNNEL_IS_SUPPLIER))
106 #define omx_base_PortType_FIELDS \
107 OMX_HANDLETYPE hTunneledComponent; \
108 OMX_U32 nTunnelFlags; \
109 OMX_U32 nTunneledPort; \
110 OMX_BUFFERSUPPLIERTYPE eBufferSupplier; \
111 OMX_U32 nNumTunnelBuffer; \
113 pthread_mutex_t exitMutex; \
114 OMX_BOOL bIsDestroying; \
115 OMX_U32 nNumBufferFlushed; \
116 OMX_BOOL bIsPortFlushed; \
117 queue_t* pBufferQueue; \
118 tsem_t* pBufferSem; \
119 OMX_U32 nNumAssignedBuffers; \
120 OMX_PARAM_PORTDEFINITIONTYPE sPortParam; \
121 OMX_BUFFERHEADERTYPE **pInternalBufferStorage; \
122 BUFFER_STATUS_FLAG *bBufferStateAllocated; \
123 OMX_COMPONENTTYPE *standCompContainer;\
124 OMX_BOOL bIsTransientToEnabled; \
125 OMX_BOOL bIsTransientToDisabled; \
126 OMX_BOOL bIsFullOfBuffers; \
127 OMX_BOOL bIsEmptyOfBuffers; \
128 OMX_ERRORTYPE (*PortConstructor)(OMX_COMPONENTTYPE *openmaxStandComp,omx_base_PortType **openmaxStandPort,OMX_U32 nPortIndex, OMX_BOOL isInput); \
129 OMX_ERRORTYPE (*PortDestructor)(omx_base_PortType *openmaxStandPort); \
130 OMX_ERRORTYPE (*Port_DisablePort)(omx_base_PortType *openmaxStandPort); \
131 OMX_ERRORTYPE (*Port_EnablePort)(omx_base_PortType *openmaxStandPort); \
132 OMX_ERRORTYPE (*Port_SendBufferFunction)(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE* pBuffer); \
133 OMX_ERRORTYPE (*Port_AllocateBuffer)(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE** pBuffer, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, OMX_U32 nSizeBytes); \
134 OMX_ERRORTYPE (*Port_UseBuffer)(omx_base_PortType *openmaxStandPort,OMX_BUFFERHEADERTYPE** ppBufferHdr,OMX_U32 nPortIndex,OMX_PTR pAppPrivate,OMX_U32 nSizeBytes,OMX_U8* pBuffer); \
135 OMX_ERRORTYPE (*Port_FreeBuffer)(omx_base_PortType *openmaxStandPort,OMX_U32 nPortIndex,OMX_BUFFERHEADERTYPE* pBuffer); \
136 OMX_ERRORTYPE (*Port_AllocateTunnelBuffer)(omx_base_PortType *openmaxStandPort,OMX_U32 nPortIndex); \
137 OMX_ERRORTYPE (*Port_FreeTunnelBuffer)(omx_base_PortType *openmaxStandPort,OMX_U32 nPortIndex); \
138 OMX_ERRORTYPE (*BufferProcessedCallback)(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer); \
139 OMX_ERRORTYPE (*FlushProcessingBuffers)(omx_base_PortType *openmaxStandPort); \
140 OMX_ERRORTYPE (*ReturnBufferFunction)(omx_base_PortType* openmaxStandPort,OMX_BUFFERHEADERTYPE* pBuffer); \
141 OMX_ERRORTYPE (*ComponentTunnelRequest)(omx_base_PortType* openmaxStandPort, OMX_HANDLETYPE hTunneledComp, OMX_U32 nTunneledPort, OMX_TUNNELSETUPTYPE* pTunnelSetup);
142 ENDCLASS(omx_base_PortType)
OMX_ERRORTYPE base_port_SendBufferFunction(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE *pBuffer)
The entry point for sending buffers to the port.
OMX_ERRORTYPE base_port_EnablePort(omx_base_PortType *openmaxStandPort)
Enables the port.
OMX_ERRORTYPE base_port_FreeTunnelBuffer(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex)
Free buffers used in tunnel.
OMX_ERRORTYPE base_port_AllocateBuffer(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE **pBuffer, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, OMX_U32 nSizeBytes)
Called by the standard allocate buffer, it implements a base functionality.
OMX_ERRORTYPE base_port_AllocateTunnelBuffer(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex)
Allocate Buffers for tunneling use.
OMX_ERRORTYPE base_port_UseBuffer(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE **ppBufferHdr, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, OMX_U32 nSizeBytes, OMX_U8 *pBuffer)
Called by the standard use buffer, it implements a base functionality.
OMX_ERRORTYPE base_port_ComponentTunnelRequest(omx_base_PortType *openmaxStandPort, OMX_HANDLETYPE hTunneledComp, OMX_U32 nTunneledPort, OMX_TUNNELSETUPTYPE *pTunnelSetup)
Setup Tunnel with the port.
OMX_ERRORTYPE base_port_ReturnBufferFunction(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE *pBuffer)
Returns buffers when processed.
OMX_ERRORTYPE base_port_FlushProcessingBuffers(omx_base_PortType *openmaxStandPort)
Releases buffers under processing.
OMX_ERRORTYPE base_port_Destructor(omx_base_PortType *openmaxStandPort)
The base destructor for the generic OpenMAX ST port.
TUNNEL_STATUS_FLAG
the status of a port related to the tunneling with another component
OMX_ERRORTYPE base_port_DisablePort(omx_base_PortType *openmaxStandPort)
Disables the port.
OMX_ERRORTYPE base_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput)
The base contructor for the generic OpenMAX ST port.
OMX_ERRORTYPE base_port_FreeBuffer(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex, OMX_BUFFERHEADERTYPE *pBuffer)
Called by the standard function.