omx_base_port.c File Reference

#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <omxcore.h>
#include <OMX_Core.h>
#include <OMX_Component.h>
#include "omx_base_component.h"
#include "omx_base_port.h"

Go to the source code of this file.

Defines

#define DEFAULT_NUMBER_BUFFERS_PER_PORT   2
#define DEFAULT_MIN_NUMBER_BUFFERS_PER_PORT   2

Functions

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_Destructor (omx_base_PortType *openmaxStandPort)
 The base destructor for the generic OpenMAX ST port.
OMX_ERRORTYPE base_port_FlushProcessingBuffers (omx_base_PortType *openmaxStandPort)
 Releases buffers under processing. This function must be implemented in the derived classes, for the specific processing.
OMX_ERRORTYPE base_port_DisablePort (omx_base_PortType *openmaxStandPort)
 Disables the port.
OMX_ERRORTYPE base_port_EnablePort (omx_base_PortType *openmaxStandPort)
 Enables the port.
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_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_FreeBuffer (omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex, OMX_BUFFERHEADERTYPE *pBuffer)
 Called by the standard function.
OMX_ERRORTYPE base_port_AllocateTunnelBuffer (omx_base_PortType *openmaxStandPort, OMX_IN OMX_U32 nPortIndex, OMX_IN OMX_U32 nSizeBytes)
 Allocate Buffers for tunneling use.
OMX_ERRORTYPE base_port_FreeTunnelBuffer (omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex)
 Free buffers used in tunnel.
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_ReturnBufferFunction (omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE *pBuffer)
 Returns buffers when processed.
OMX_ERRORTYPE base_port_ComponentTunnelRequest (omx_base_PortType *openmaxStandPort, OMX_IN OMX_HANDLETYPE hTunneledComp, OMX_IN OMX_U32 nTunneledPort, OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup)
 Setup Tunnel with the port.


Detailed Description

Base class for OpenMAX ports to be used in derived components.

Copyright (C) 2007 STMicroelectronics Copyright (C) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

$Date$ Revision $Rev$ Author $Author$

Definition in file omx_base_port.c.


Define Documentation

#define DEFAULT_MIN_NUMBER_BUFFERS_PER_PORT   2

The default value for the minimum number of needed buffers for each port.

Definition at line 42 of file omx_base_port.c.

Referenced by base_port_Constructor().

#define DEFAULT_NUMBER_BUFFERS_PER_PORT   2

The default value for the number of needed buffers for each port.

Definition at line 40 of file omx_base_port.c.

Referenced by base_port_Constructor().


Function Documentation

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.

This function can be overriden if the allocation of the buffer is not a simply malloc call. The parameters are the same as the standard function, except for the handle of the port instead of the handler of the component When the buffers needed by this port are all assigned or allocated, the variable bIsFullOfBuffers becomes equal to OMX_TRUE

Definition at line 358 of file omx_base_port.c.

References omx_base_PortType::bBufferStateAllocated, omx_base_PortType::bIsFullOfBuffers, omx_base_PortType::bIsTransientToEnabled, OMX_PARAM_PORTDEFINITIONTYPE::bPopulated, BUFFER_ALLOCATED, BUFFER_FREE, DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEB_LEV_PARAMS, DEB_LEV_SIMPLE_SEQ, DEBUG, OMX_PARAM_PORTDEFINITIONTYPE::eDir, HEADER_ALLOCATED, OMX_BUFFERHEADERTYPE::nAllocLen, OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountActual, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_BUFFERHEADERTYPE::nInputPortIndex, omx_base_PortType::nNumAssignedBuffers, OMX_BUFFERHEADERTYPE::nOutputPortIndex, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, OMX_DirInput, OMX_ErrorBadPortIndex, OMX_ErrorIncorrectStateTransition, OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_TransStateLoadedToIdle, OMX_TRUE, omx_base_PortType::pAllocSem, OMX_BUFFERHEADERTYPE::pAppPrivate, OMX_BUFFERHEADERTYPE::pBuffer, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_PortType::pInternalBufferStorage, PORT_IS_TUNNELED_N_BUFFER_SUPPLIER, OMX_BUFFERHEADERTYPE::pPlatformPrivate, setHeader(), omx_base_PortType::sPortParam, omx_base_PortType::standCompContainer, omx_base_component_PrivateType::transientState, and tsem_up().

Referenced by base_port_Constructor().

OMX_ERRORTYPE base_port_AllocateTunnelBuffer ( omx_base_PortType openmaxStandPort,
OMX_IN OMX_U32  nPortIndex,
OMX_IN OMX_U32  nSizeBytes 
)

OMX_ERRORTYPE base_port_ComponentTunnelRequest ( omx_base_PortType openmaxStandPort,
OMX_IN OMX_HANDLETYPE  hTunneledComp,
OMX_IN OMX_U32  nTunneledPort,
OMX_INOUT OMX_TUNNELSETUPTYPE pTunnelSetup 
)

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.

This function is executed by the component that uses a port. The parameter contains the info about the component. It takes care of constructing the instance of the port and every object needed by the base port.

Parameters:
openmaxStandPort the ST port to be initialized
isInput specifices if the port is an input or an output
Returns:
OMX_ErrorInsufficientResources if a memory allocation fails

Allocate and initialize buffer queue

Definition at line 57 of file omx_base_port.c.

References base_port_AllocateBuffer(), base_port_AllocateTunnelBuffer(), base_port_ComponentTunnelRequest(), base_port_Destructor(), base_port_DisablePort(), base_port_EnablePort(), base_port_FlushProcessingBuffers(), base_port_FreeBuffer(), base_port_FreeTunnelBuffer(), base_port_ReturnBufferFunction(), base_port_SendBufferFunction(), base_port_UseBuffer(), DEB_LEV_FUNCTION_NAME, DEBUG, DEFAULT_MIN_NUMBER_BUFFERS_PER_PORT, DEFAULT_NUMBER_BUFFERS_PER_PORT, OMX_BufferSupplyUnspecified, OMX_DirInput, OMX_DirOutput, OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_FALSE, OMX_TRUE, queue_init(), setHeader(), and tsem_init().

Referenced by base_audio_port_Constructor(), base_video_port_Constructor(), and omx_symbianoutputstreamsink_component_Constructor().

OMX_ERRORTYPE base_port_Destructor ( omx_base_PortType openmaxStandPort  ) 

The base destructor for the generic OpenMAX ST port.

This function is executed by the component that uses a port. The parameter contains the info about the component. It takes care of destructing the instance of the port and every object used by the base port.

Parameters:
openmaxStandPort the ST port to be disposed

Allocate and initialize buffer queue

Definition at line 132 of file omx_base_port.c.

References OMX_ErrorNone, omx_base_PortType::pAllocSem, omx_base_PortType::pBufferQueue, omx_base_PortType::pBufferSem, queue_deinit(), and tsem_deinit().

Referenced by base_audio_port_Destructor(), base_port_Constructor(), base_video_port_Destructor(), and omx_camera_source_component_Destructor().

OMX_ERRORTYPE base_port_DisablePort ( omx_base_PortType openmaxStandPort  ) 

OMX_ERRORTYPE base_port_EnablePort ( omx_base_PortType openmaxStandPort  ) 

OMX_ERRORTYPE base_port_FlushProcessingBuffers ( omx_base_PortType openmaxStandPort  ) 

OMX_ERRORTYPE base_port_FreeBuffer ( omx_base_PortType openmaxStandPort,
OMX_U32  nPortIndex,
OMX_BUFFERHEADERTYPE pBuffer 
)

OMX_ERRORTYPE base_port_FreeTunnelBuffer ( omx_base_PortType openmaxStandPort,
OMX_U32  nPortIndex 
)

OMX_ERRORTYPE base_port_ReturnBufferFunction ( omx_base_PortType openmaxStandPort,
OMX_BUFFERHEADERTYPE pBuffer 
)

OMX_ERRORTYPE base_port_SendBufferFunction ( omx_base_PortType openmaxStandPort,
OMX_BUFFERHEADERTYPE pBuffer 
)

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.

This function can be overriden if the use buffer implicate more complicated operations. The parameters are the same as the standard function, except for the handle of the port instead of the handler of the component. When the buffers needed by this port are all assigned or allocated, the variable bIsFullOfBuffers becomes equal to OMX_TRUE

Definition at line 436 of file omx_base_port.c.

References omx_base_PortType::bBufferStateAllocated, omx_base_PortType::bIsEmptyOfBuffers, omx_base_PortType::bIsFullOfBuffers, omx_base_PortType::bIsTransientToEnabled, OMX_PARAM_PORTDEFINITIONTYPE::bPopulated, BUFFER_ASSIGNED, BUFFER_FREE, DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEB_LEV_PARAMS, DEBUG, OMX_PARAM_PORTDEFINITIONTYPE::eDir, HEADER_ALLOCATED, OMX_BUFFERHEADERTYPE::nAllocLen, omx_base_component_PrivateType::name, OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountActual, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_BUFFERHEADERTYPE::nInputPortIndex, omx_base_PortType::nNumAssignedBuffers, OMX_BUFFERHEADERTYPE::nOutputPortIndex, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, OMX_DirInput, OMX_ErrorBadPortIndex, OMX_ErrorIncorrectStateTransition, OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_FALSE, OMX_TransStateLoadedToIdle, OMX_TRUE, omx_base_PortType::pAllocSem, OMX_BUFFERHEADERTYPE::pAppPrivate, OMX_BUFFERHEADERTYPE::pBuffer, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_PortType::pInternalBufferStorage, PORT_IS_TUNNELED_N_BUFFER_SUPPLIER, OMX_BUFFERHEADERTYPE::pPlatformPrivate, setHeader(), omx_base_PortType::sPortParam, omx_base_PortType::standCompContainer, omx_base_component_PrivateType::transientState, and tsem_up().

Referenced by base_port_Constructor().


Generated for OpenMAX Bellagio rel. 0.3.5-svn by  doxygen 1.5.1
SourceForge.net Logo