36 #define DEFAULT_NUMBER_BUFFERS_PER_PORT 2
38 #define DEFAULT_MIN_NUMBER_BUFFERS_PER_PORT 2
60 if (!(*openmaxStandPort)) {
64 if (!(*openmaxStandPort)) {
65 DEBUG(
DEB_LEV_ERR,
"Out of %s for component %p for a lack of resources\n", __func__, openmaxStandComp);
69 (*openmaxStandPort)->hTunneledComponent = NULL;
70 (*openmaxStandPort)->nTunnelFlags=0;
71 (*openmaxStandPort)->nTunneledPort=0;
73 (*openmaxStandPort)->nNumTunnelBuffer=0;
75 if((*openmaxStandPort)->pAllocSem==NULL) {
76 (*openmaxStandPort)->pAllocSem = calloc(1,
sizeof(
tsem_t));
77 if((*openmaxStandPort)->pAllocSem==NULL) {
80 tsem_init((*openmaxStandPort)->pAllocSem, 0);
82 (*openmaxStandPort)->nNumBufferFlushed=0;
83 (*openmaxStandPort)->bIsPortFlushed=
OMX_FALSE;
85 if(!(*openmaxStandPort)->pBufferQueue) {
86 (*openmaxStandPort)->pBufferQueue = calloc(1,
sizeof(
queue_t));
91 if(!(*openmaxStandPort)->pBufferSem) {
92 (*openmaxStandPort)->pBufferSem = calloc(1,
sizeof(
tsem_t));
94 tsem_init((*openmaxStandPort)->pBufferSem, 0);
97 (*openmaxStandPort)->nNumAssignedBuffers=0;
99 (*openmaxStandPort)->sPortParam.nPortIndex = nPortIndex;
102 (*openmaxStandPort)->sPortParam.bEnabled =
OMX_TRUE;
103 (*openmaxStandPort)->sPortParam.bPopulated =
OMX_FALSE;
106 (*openmaxStandPort)->standCompContainer=openmaxStandComp;
107 (*openmaxStandPort)->bIsTransientToEnabled=
OMX_FALSE;
108 (*openmaxStandPort)->bIsTransientToDisabled=
OMX_FALSE;
109 (*openmaxStandPort)->bIsFullOfBuffers=
OMX_FALSE;
110 (*openmaxStandPort)->bIsEmptyOfBuffers=
OMX_FALSE;
111 (*openmaxStandPort)->bBufferStateAllocated = NULL;
112 (*openmaxStandPort)->pInternalBufferStorage = NULL;
126 (*openmaxStandPort)->bIsDestroying =
OMX_FALSE;
127 pthread_mutex_init(&((*openmaxStandPort)->exitMutex), NULL);
138 pthread_mutex_lock(&openmaxStandPort->
exitMutex);
140 pthread_mutex_unlock(&openmaxStandPort->
exitMutex);
164 pthread_mutex_destroy(&openmaxStandPort->
exitMutex);
166 free(openmaxStandPort);
167 openmaxStandPort = NULL;
185 pthread_mutex_lock(&omx_base_component_Private->
flush_mutex);
198 pthread_mutex_unlock(&omx_base_component_Private->
flush_mutex);
246 pthread_mutex_lock(&omx_base_component_Private->
flush_mutex);
248 pthread_mutex_unlock(&omx_base_component_Private->
flush_mutex);
255 DEBUG(
DEB_LEV_PARAMS,
"In %s TFlag=%x Qelem=%d BSem=%d bMgmtsem=%d component=%s\n", __func__,
260 omx_base_component_Private->
name);
306 DEBUG(
DEB_LEV_PARAMS,
"In %s TFlag=%x Qelem=%d BSem=%d bMgmtsem=%d component=%s\n", __func__,
311 omx_base_component_Private->
name);
344 (
int)omx_base_component_Private->
state);
356 DEBUG(
DEB_LEV_ERR,
"In %s Allocating Tunnel Buffer Error=%x\n",__func__,err);
404 DEBUG(
DEB_LEV_ERR,
"In %s: The port is not allowed to receive buffers\n", __func__);
409 if(nSizeBytes < openmaxStandPort->sPortParam.nBufferSize) {
450 DEBUG(
DEB_LEV_ERR,
"Out of %s for port %p. Error: no available buffers\n",__func__, openmaxStandPort);
484 DEBUG(
DEB_LEV_ERR,
"In %s: The port of Comp %s is not allowed to receive buffers\n", __func__,omx_base_component_Private->
name);
489 if(nSizeBytes < openmaxStandPort->sPortParam.nBufferSize) {
490 DEBUG(
DEB_LEV_ERR,
"In %s: Port %d Given Buffer Size %u is less than Minimum Buffer Size %u\n", __func__, (
int)nPortIndex, (
int)nSizeBytes, (
int)openmaxStandPort->
sPortParam.
nBufferSize);
510 if (!returnBufferHeader) {
514 returnBufferHeader->
pBuffer = pBuffer;
515 returnBufferHeader->
nAllocLen = nSizeBytes;
525 *ppBufferHdr = returnBufferHeader;
538 DEBUG(
DEB_LEV_ERR,
"In %s Error: no available buffers CompName=%s\n",__func__,omx_base_component_Private->
name);
609 DEBUG(
DEB_LEV_ERR,
"Out of %s for port %p with OMX_ErrorInsufficientResources\n", __func__, openmaxStandPort);
623 OMX_U32 numRetry=0,nBufferSize;
625 OMX_U32 nLocalBufferCountActual;
640 DEBUG(
DEB_LEV_ERR,
"In %s: The port is not allowed to receive buffers\n", __func__);
659 if (nLocalBufferCountActual < sPortDef.nBufferCountActual) {
660 nLocalBufferCountActual = sPortDef.nBufferCountActual;
662 }
else if (sPortDef.nBufferCountActual < nLocalBufferCountActual){
663 sPortDef.nBufferCountActual = nLocalBufferCountActual;
679 pBuffer = calloc(1,nBufferSize);
689 i,omx_base_component_Private->
name,(
int)numRetry);
715 DEBUG(
DEB_LEV_ERR,
"In %s Tunneled Component Couldn't Use Buffer err = %x \n",__func__,(
int)eError);
847 DEBUG(
DEB_LEV_ERR,
"In %s: we are not in executing/paused/idle state, but in %d\n", __func__, omx_base_component_Private->
state);
854 DEBUG(
DEB_LEV_ERR,
"In %s: Port %d is disabled comp = %s \n", __func__, (
int)portIndex,omx_base_component_Private->
name);
862 if(pBuffer!=NULL && pBuffer->
pBuffer!=NULL) {
877 DEBUG(
DEB_LEV_ERR,
"In %s: received wrong buffer header on input port\n", __func__);
892 DEBUG(
DEB_LEV_PARAMS,
"In %s Signalling bMgmtSem Port Index=%d\n",__func__, (
int)portIndex);
933 DEBUG(
DEB_LEV_ERR,
"In %s eError %08x in FillThis Buffer from Component %s Non-Supplier\n",
934 __func__, eError,omx_base_component_Private->
name);
941 DEBUG(
DEB_LEV_ERR,
"In %s eError %08x in EmptyThis Buffer from Component %s Non-Supplier\n",
942 __func__, eError,omx_base_component_Private->
name);
951 __func__, eError,omx_base_component_Private->
name);
953 errQue =
queue(pQueue, pBuffer);
967 __func__, eError,omx_base_component_Private->
name);
969 errQue =
queue(pQueue, pBuffer);
986 errQue =
queue(pQueue, pBuffer);
1008 if (pTunnelSetup == NULL || hTunneledComp == 0) {
1024 DEBUG(
DEB_LEV_ERR,
"In %s Tunneled Port Definition error=0x%08x Line=%d\n",__func__,err,__LINE__);
1052 DEBUG(
DEB_LEV_ERR,
"In %s Tunneled Buffer Supplier error=0x%08x Line=%d\n",__func__,err,__LINE__);
1071 DEBUG(
DEB_LEV_ERR,
"In %s Proprietary Tunneled Buffer Supplier nTunneledPort=%d error=0x%08x Line=%d \n",
1072 __func__,(
int)pPropTunnelSetup.
nPortIndex,err,__LINE__);
1105 DEBUG(
DEB_LEV_ERR,
"In %s Tunneled Buffer Supplier error=0x%08x Line=%d\n",__func__,err,__LINE__);
1118 DEBUG(
DEB_LEV_ERR,
"In %s Tunneled Port Definition error=0x%08x Line=%d\n",__func__,err,__LINE__);
1148 DEBUG(
DEB_LEV_ERR,
"In %s Proprietary Tunneled Buffer Supplier nTunneledPort=%d error=0x%08x Line=%d \n",
1149 __func__,(
int)pPropTunnelSetup.
nPortIndex,err,__LINE__);
OMX_BOOL bIsFullOfBuffers
OMX_ERRORTYPE base_port_ReturnBufferFunction(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE *pBuffer)
Returns buffers when processed.
#define PORT_IS_BEING_DISABLED(pPort)
OMX_HANDLETYPE hTunneledComponent
OMX_BOOL bIsTransientToDisabled
OMX_ERRORTYPE(* BufferProcessedCallback)(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_OTHER_FORMATTYPE eFormat
OMX_BOOL bIsTransientToEnabled
#define PORT_IS_DEEP_TUNNELED(pPort)
OMX_U32 nNumAssignedBuffers
OMX_ERRORTYPE base_port_EnablePort(omx_base_PortType *openmaxStandPort)
Enables the port.
OMX_TRANS_STATETYPE transientState
OMX_ERRORTYPE checkHeader(OMX_PTR header, OMX_U32 size)
Checks the header of a structure for consistency with size and spec version.
#define DEB_LEV_SIMPLE_SEQ
OMX_BOOL bIsEmptyOfBuffers
#define PORT_IS_BEING_FLUSHED(pPort)
OMX_ERRORTYPE base_port_DisablePort(omx_base_PortType *openmaxStandPort)
Disables the port.
void tsem_signal(tsem_t *tsem)
OMX_ERRORTYPE base_port_FlushProcessingBuffers(omx_base_PortType *openmaxStandPort)
Releases buffers under processing. This function must be implemented in the derived classes...
OMX_ERRORTYPE(* Port_FreeTunnelBuffer)(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex)
#define OMX_PORTTUNNELFLAG_READONLY
#define DEBUG(n, fmt, args...)
OMX_ERRORTYPE base_port_Destructor(omx_base_PortType *openmaxStandPort)
The base destructor for the generic OpenMAX ST port.
BUFFER_STATUS_FLAG * bBufferStateAllocated
union OMX_PARAM_PORTDEFINITIONTYPE::@0 format
void queue_deinit(queue_t *queue)
#define TUNNEL_USE_BUFFER_RETRY_USLEEP_TIME
#define TUNNEL_USE_BUFFER_RETRY
tsem_t * flush_all_condition
OMX_CALLBACKTYPE * callbacks
OMX_VIDEO_PORTDEFINITIONTYPE video
void tsem_up(tsem_t *tsem)
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.
int queue_init(queue_t *queue)
void setHeader(OMX_PTR header, OMX_U32 size)
Simply fills the first two fields in any OMX structure with the size and the version.
#define OMX_UseBuffer(hComponent,ppBufferHdr,nPortIndex,pAppPrivate,nSizeBytes,pBuffer)
OMX_OTHER_PORTDEFINITIONTYPE other
void tsem_down(tsem_t *tsem)
#define OMX_GetParameter(hComponent,nParamIndex,pComponentParameterStructure)
#define PORT_IS_BUFFER_SUPPLIER(pPort)
OMX_VIDEO_CODINGTYPE eCompressionFormat
#define OMX_SetParameter(hComponent,nParamIndex,pComponentParameterStructure)
#define DEFAULT_MIN_NUMBER_BUFFERS_PER_PORT
#define PORT_IS_ENABLED(pPort)
int queue(queue_t *queue, void *data)
#define DEFAULT_NUMBER_BUFFERS_PER_PORT
OMX_U32 nNumBufferFlushed
void tsem_reset(tsem_t *tsem)
OMX_AUDIO_CODINGTYPE eEncoding
#define OMX_FreeBuffer(hComponent,nPortIndex,pBuffer)
OMX_BUFFERSUPPLIERTYPE eBufferSupplier
OMX_PORTDOMAINTYPE eDomain
OMX_BUFFERHEADERTYPE ** pInternalBufferStorage
void tsem_deinit(tsem_t *tsem)
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_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput)
The base contructor for the generic OpenMAX ST port.
OMX_U32 nBufferCountActual
pthread_mutex_t flush_mutex
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_PTR pComponentPrivate
#define DEB_LEV_FUNCTION_NAME
OMX_ERRORTYPE base_port_AllocateTunnelBuffer(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex)
Allocate Buffers for tunneling use.
int tsem_init(tsem_t *tsem, unsigned int val)
OMX_COMPONENTTYPE * standCompContainer
OMX_ERRORTYPE base_port_ComponentTunnelRequest(omx_base_PortType *openmaxStandPort, OMX_HANDLETYPE hTunneledComp, OMX_U32 nTunneledPort, OMX_TUNNELSETUPTYPE *pTunnelSetup)
Setup Tunnel with the port.
OMX_AUDIO_PORTDEFINITIONTYPE audio
OMX_BUFFERSUPPLIERTYPE eSupplier
OMX_ERRORTYPE(* Port_AllocateTunnelBuffer)(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex)
#define PORT_IS_TUNNELED_N_BUFFER_SUPPLIER(pPort)
void * dequeue(queue_t *queue)
OMX_ERRORTYPE base_port_FreeBuffer(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex, OMX_BUFFERHEADERTYPE *pBuffer)
Called by the standard function.
OMX_BUFFERSUPPLIERTYPE eBufferSupplier
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
#define PORT_IS_TUNNELED(pPort)
OMX_ERRORTYPE(* EventHandler)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_PTR pAppData, OMX_IN OMX_EVENTTYPE eEvent, OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2, OMX_IN OMX_PTR pEventData)
OMX_ERRORTYPE base_port_FreeTunnelBuffer(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex)
Free buffers used in tunnel.
pthread_mutex_t exitMutex