#include <OMX_Types.h>
#include <OMX_Component.h>
#include <OMX_Core.h>
#include <OMX_Video.h>
#include <pthread.h>
#include <omx_base_source.h>
#include <string.h>
#include <linux/videodev.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
Go to the source code of this file.
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_videosrc_component.h.
#define MAX_NUM_OF_videosrc_component_INSTANCES 1 |
Maximum number of base_component component instances
Definition at line 52 of file omx_videosrc_component.h.
#define omx_videosrc_component_PrivateType_FIELDS |
Value:
omx_base_source_PrivateType_FIELDS \\ tsem_t* videoSyncSem; \ \ OMX_BOOL videoReady; \ \ OMX_BOOL bIsEOSSent; \ \ OMX_S32 deviceHandle; \ \ struct video_capability capability; \ \ struct video_window captureWindow; \ \ struct video_picture imageProperties; \ \ struct video_mbuf memoryBuffer; \ \ char* memoryMap; \ \ struct video_mmap* mmaps; \ \ OMX_U32 iFrameIndex; \ \ OMX_U32 iFrameSize; \ \ OMX_BOOL bOutBufferMemoryMapped;
Definition at line 60 of file omx_videosrc_component.h.
#define VIDEO_DEV_NAME "/dev/video" |
Definition at line 54 of file omx_videosrc_component.h.
Referenced by omx_videosrc_component_Constructor().
void omx_videosrc_component_BufferMgmtCallback | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
OMX_BUFFERHEADERTYPE * | pOutputBuffer | |||
) |
This function processes the input file and returns packet by packet as an output data this packet is used in video decoder component for decoding
return the current output buffer
Definition at line 442 of file omx_videosrc_component.c.
References DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEBUG, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_BUFFERHEADERTYPE::nOffset, OMX_FALSE, OMX_StateExecuting, OMX_BUFFERHEADERTYPE::pBuffer, OMX_COMPONENTTYPE::pComponentPrivate, and tsem_down().
Referenced by omx_videosrc_component_Constructor().
OMX_ERRORTYPE omx_videosrc_component_Constructor | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
OMX_STRING | cComponentName | |||
) |
The Constructor
Allocate Ports and call port constructor.
for the moment, the file reader works with video component so the domain is set to video in future it may be assigned after checking the input file format or there can be seperate file reader of video component
Definition at line 44 of file omx_videosrc_component.c.
References base_video_port_Constructor(), DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, OMX_VIDEO_PARAM_PORTFORMATTYPE::eColorFormat, OMX_VIDEO_PORTDEFINITIONTYPE::eColorFormat, err, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_COMPONENTTYPE::GetParameter, MAX_COMPONENT_VIDEOSRC, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameWidth, omx_base_source_Constructor(), OMX_BASE_SOURCE_OUTPUTPORT_INDEX, OMX_COLOR_FormatYUV420Planar, OMX_ErrorHardware, OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_FALSE, omx_videosrc_component_BufferMgmtCallback(), omx_videosrc_component_Destructor(), omx_videosrc_component_GetParameter(), omx_videosrc_component_MessageHandler(), omx_videosrc_component_SetParameter(), OMX_COMPONENTTYPE::pComponentPrivate, OMX_COMPONENTTYPE::SetParameter, omx_base_video_PortType::sPortParam, omx_base_video_PortType::sVideoParam, tsem_init(), OMX_PARAM_PORTDEFINITIONTYPE::video, VIDEO_DEV_NAME, videosrc_port_AllocateBuffer(), videosrc_port_AllocateTunnelBuffer(), videosrc_port_FreeBuffer(), and videosrc_port_FreeTunnelBuffer().
Referenced by omx_component_library_Setup().
OMX_ERRORTYPE omx_videosrc_component_Deinit | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The DeInitialization function
closing input file
Definition at line 426 of file omx_videosrc_component.c.
References DEB_LEV_FUNCTION_NAME, DEBUG, OMX_ErrorNone, OMX_FALSE, OMX_COMPONENTTYPE::pComponentPrivate, and tsem_reset().
Referenced by omx_videosrc_component_MessageHandler().
OMX_ERRORTYPE omx_videosrc_component_Destructor | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The Destructor
Definition at line 168 of file omx_videosrc_component.c.
References DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEBUG, omx_base_source_Destructor(), OMX_COMPONENTTYPE::pComponentPrivate, and tsem_deinit().
Referenced by omx_videosrc_component_Constructor().
OMX_ERRORTYPE omx_videosrc_component_GetParameter | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_IN OMX_INDEXTYPE | nParamIndex, | |||
OMX_INOUT OMX_PTR | ComponentParameterStructure | |||
) |
Definition at line 544 of file omx_videosrc_component.c.
References checkHeader(), DEB_LEV_SIMPLE_SEQ, DEBUG, err, OMX_VIDEO_PARAM_PORTFORMATTYPE::nPortIndex, omx_base_component_GetParameter(), OMX_BASE_SOURCE_OUTPUTPORT_INDEX, OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorNone, OMX_IndexParamVideoInit, OMX_IndexParamVideoPortFormat, OMX_IndexVendorFileReadInputFilename, OMX_COMPONENTTYPE::pComponentPrivate, and omx_base_video_PortType::sVideoParam.
Referenced by omx_videosrc_component_Constructor().
OMX_ERRORTYPE omx_videosrc_component_Init | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The Initialization function
Video Capability Query
The pointer memoryMap and the offsets within memoryBuffer.offsets combine to give us the address of each buffered frame. For example: Buffered Frame 0 is located at: memoryMap + memoryBuffer.offsets[0] Buffered Frame 1 is located at: memoryMap + memoryBuffer.offsets[1] Buffered Frame 2 is located at: memoryMap + memoryBuffer.offsets[2] etc... The number of buffered frames is stored in memoryBuffer.frames.
initialization for buff mgmt callback function
Definition at line 216 of file omx_videosrc_component.c.
References DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEB_LEV_PARAMS, DEBUG, OMX_VIDEO_PORTDEFINITIONTYPE::eColorFormat, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameWidth, OMX_BASE_SOURCE_OUTPUTPORT_INDEX, OMX_COLOR_Format16bitRGB565, OMX_COLOR_Format24bitRGB888, OMX_COLOR_Format32bitARGB8888, OMX_COLOR_FormatYUV411Planar, OMX_COLOR_FormatYUV420Planar, OMX_COLOR_FormatYUV422Planar, OMX_ErrorNone, OMX_FALSE, OMX_TRUE, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_video_PortType::sPortParam, tsem_up(), and OMX_PARAM_PORTDEFINITIONTYPE::video.
Referenced by omx_videosrc_component_MessageHandler().
OMX_ERRORTYPE omx_videosrc_component_MessageHandler | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
internalRequestMessageType * | message | |||
) |
This function initializes and deinitializes the library related initialization needed for file parsing
Definition at line 591 of file omx_videosrc_component.c.
References DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, err, internalRequestMessageType::messageParam, internalRequestMessageType::messageType, omx_base_component_MessageHandler(), OMX_CommandStateSet, OMX_ErrorNone, OMX_StateExecuting, OMX_StateIdle, omx_videosrc_component_Deinit(), omx_videosrc_component_Init(), and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_videosrc_component_Constructor().
OMX_ERRORTYPE omx_videosrc_component_SetParameter | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_IN OMX_INDEXTYPE | nParamIndex, | |||
OMX_IN OMX_PTR | ComponentParameterStructure | |||
) |
Definition at line 488 of file omx_videosrc_component.c.
References DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, err, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameWidth, OMX_VIDEO_PARAM_PORTFORMATTYPE::nPortIndex, omx_base_component_ParameterSanityCheck(), omx_base_component_SetParameter(), OMX_BASE_SOURCE_OUTPUTPORT_INDEX, OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorNone, OMX_IndexParamPortDefinition, OMX_IndexParamVideoPortFormat, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_video_PortType::sPortParam, omx_base_video_PortType::sVideoParam, and OMX_PARAM_PORTDEFINITIONTYPE::video.
Referenced by omx_videosrc_component_Constructor().
OMX_ERRORTYPE videosrc_port_AllocateBuffer | ( | omx_base_PortType * | openmaxStandPort, | |
OMX_BUFFERHEADERTYPE ** | pBuffer, | |||
OMX_U32 | nPortIndex, | |||
OMX_PTR | pAppPrivate, | |||
OMX_U32 | nSizeBytes | |||
) |
Definition at line 617 of file omx_videosrc_component.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 omx_videosrc_component_Constructor().
OMX_ERRORTYPE videosrc_port_AllocateTunnelBuffer | ( | omx_base_PortType * | openmaxStandPort, | |
OMX_IN OMX_U32 | nPortIndex, | |||
OMX_IN OMX_U32 | nSizeBytes | |||
) |
Definition at line 756 of file omx_videosrc_component.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_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEB_LEV_PARAMS, DEB_LEV_SIMPLE_SEQ, DEBUG, omx_base_PortType::hTunneledComponent, omx_base_component_PrivateType::name, OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountActual, omx_base_PortType::nNumAssignedBuffers, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, omx_base_PortType::nTunneledPort, omx_base_PortType::nTunnelFlags, OMX_ErrorBadPortIndex, OMX_ErrorIncorrectStateTransition, OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_TransStateLoadedToIdle, OMX_TRUE, OMX_UseBuffer, omx_base_PortType::pBufferQueue, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_PortType::pInternalBufferStorage, PORT_IS_TUNNELED_N_BUFFER_SUPPLIER, queue(), omx_base_PortType::sPortParam, omx_base_PortType::standCompContainer, omx_base_component_PrivateType::transientState, TUNNEL_USE_BUFFER_RETRY, and TUNNEL_USE_BUFFER_RETRY_USLEEP_TIME.
Referenced by omx_videosrc_component_Constructor().
OMX_ERRORTYPE videosrc_port_FreeBuffer | ( | omx_base_PortType * | openmaxStandPort, | |
OMX_U32 | nPortIndex, | |||
OMX_BUFFERHEADERTYPE * | pBuffer | |||
) |
Definition at line 689 of file omx_videosrc_component.c.
References omx_base_PortType::bBufferStateAllocated, omx_base_PortType::bIsEmptyOfBuffers, omx_base_PortType::bIsFullOfBuffers, omx_base_PortType::bIsTransientToDisabled, OMX_PARAM_PORTDEFINITIONTYPE::bPopulated, BUFFER_ALLOCATED, BUFFER_ASSIGNED, BUFFER_FREE, omx_base_component_PrivateType::callbackData, omx_base_component_PrivateType::callbacks, DEB_LEV_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEB_LEV_PARAMS, DEBUG, OMX_CALLBACKTYPE::EventHandler, HEADER_ALLOCATED, OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountActual, omx_base_PortType::nNumAssignedBuffers, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, OMX_ErrorBadPortIndex, OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_ErrorPortUnpopulated, OMX_EventError, OMX_FALSE, OMX_TransStateIdleToLoaded, OMX_TRUE, omx_base_PortType::pAllocSem, OMX_BUFFERHEADERTYPE::pBuffer, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_PortType::pInternalBufferStorage, PORT_IS_TUNNELED_N_BUFFER_SUPPLIER, omx_base_PortType::sPortParam, omx_base_PortType::standCompContainer, omx_base_component_PrivateType::transientState, and tsem_up().
Referenced by omx_videosrc_component_Constructor().
OMX_ERRORTYPE videosrc_port_FreeTunnelBuffer | ( | omx_base_PortType * | openmaxStandPort, | |
OMX_U32 | nPortIndex | |||
) |
Definition at line 829 of file omx_videosrc_component.c.
References omx_base_PortType::bBufferStateAllocated, omx_base_PortType::bIsEmptyOfBuffers, omx_base_PortType::bIsFullOfBuffers, omx_base_PortType::bIsTransientToDisabled, OMX_PARAM_PORTDEFINITIONTYPE::bPopulated, BUFFER_ALLOCATED, BUFFER_ASSIGNED, BUFFER_FREE, omx_base_component_PrivateType::callbackData, omx_base_component_PrivateType::callbacks, DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEB_LEV_PARAMS, DEBUG, OMX_CALLBACKTYPE::EventHandler, omx_base_PortType::hTunneledComponent, OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountActual, queue_t::nelem, omx_base_PortType::nNumAssignedBuffers, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, omx_base_PortType::nTunneledPort, OMX_ErrorBadPortIndex, OMX_ErrorIncorrectStateTransition, OMX_ErrorNone, OMX_ErrorPortUnpopulated, OMX_EventError, OMX_FALSE, OMX_FreeBuffer, OMX_TransStateIdleToLoaded, OMX_TRUE, OMX_BUFFERHEADERTYPE::pBuffer, omx_base_PortType::pBufferQueue, omx_base_PortType::pBufferSem, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_PortType::pInternalBufferStorage, PORT_IS_TUNNELED_N_BUFFER_SUPPLIER, tsem_t::semval, omx_base_PortType::sPortParam, omx_base_PortType::standCompContainer, omx_base_component_PrivateType::transientState, TUNNEL_USE_BUFFER_RETRY, and TUNNEL_USE_BUFFER_RETRY_USLEEP_TIME.
Referenced by omx_videosrc_component_Constructor().