#include <omxcore.h>
#include <omx_base_video_port.h>
#include <omx_videoenc_component.h>
#include <OMX_Video.h>
Go to the source code of this file.
Copyright (C) 2007-2008 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
Definition in file omx_videoenc_component.c.
#define MAX_COMPONENT_VIDEOENC 4 |
Maximum Number of Video Component Instance
Definition at line 36 of file omx_videoenc_component.c.
Referenced by omx_videoenc_component_Constructor().
#define OUTPUT_ENCODED_COLOR_FMT OMX_COLOR_FormatYUV420Planar |
The output encoded color format
Definition at line 42 of file omx_videoenc_component.c.
void omx_videoenc_component_BufferMgmtCallback | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
OMX_BUFFERHEADERTYPE * | pInputBuffer, | |||
OMX_BUFFERHEADERTYPE * | pOutputBuffer | |||
) |
This function is used to process the input buffer and provide one output buffer
Fill up the current input buffer when a new buffer has arrived
Definition at line 343 of file omx_videoenc_component.c.
References DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEBUG, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_BUFFERHEADERTYPE::nAllocLen, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameWidth, OMX_BUFFERHEADERTYPE::nOffset, OMX_BASE_FILTER_INPUTPORT_INDEX, OMX_BUFFERHEADERTYPE::pBuffer, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_video_PortType::sPortParam, tsem_down(), and OMX_PARAM_PORTDEFINITIONTYPE::video.
Referenced by omx_videoenc_component_Constructor().
OMX_ERRORTYPE omx_videoenc_component_ComponentRoleEnum | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_OUT OMX_U8 * | cRole, | |||
OMX_IN OMX_U32 | nIndex | |||
) |
Definition at line 621 of file omx_videoenc_component.c.
References OMX_ErrorNone, OMX_ErrorUnsupportedIndex, and VIDEO_ENC_MPEG4_ROLE.
Referenced by omx_videoenc_component_Constructor().
OMX_ERRORTYPE omx_videoenc_component_Constructor | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
OMX_STRING | cComponentName | |||
) |
The Constructor of the video encoder component
openmaxStandComp | the component handle to be constructed | |
cComponentName | is the name of the constructed component |
we could create our own port structures here fixme maybe the base class could use a "port factory" function pointer?
Allocate Ports and call port constructor.
Domain specific section for the ports. first we set the parameter common to both formats
now it's time to know the video coding type of the component
general configuration irrespective of any video formats setting other parameters of omx_videoenc_component_private
initializing the coenc context etc that was done earlier by ffmpeglibinit function
Definition at line 48 of file omx_videoenc_component.c.
References base_video_port_Constructor(), OMX_COMPONENTTYPE::ComponentRoleEnum, DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, OMX_VIDEO_PARAM_PORTFORMATTYPE::eColorFormat, OMX_VIDEO_PORTDEFINITIONTYPE::eColorFormat, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_COMPONENTTYPE::GetParameter, MAX_COMPONENT_VIDEOENC, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameWidth, omx_base_filter_Constructor(), OMX_BASE_FILTER_INPUTPORT_INDEX, OMX_BASE_FILTER_OUTPUTPORT_INDEX, OMX_COLOR_FormatYUV420Planar, OMX_ErrorInsufficientResources, OMX_ErrorInvalidComponentName, OMX_ErrorNone, OMX_FALSE, OMX_PortDomainVideo, OMX_TRUE, OMX_VIDEO_CodingMPEG4, OMX_VIDEO_CodingUnused, omx_videoenc_component_BufferMgmtCallback(), omx_videoenc_component_ComponentRoleEnum(), omx_videoenc_component_Destructor(), omx_videoenc_component_GetParameter(), omx_videoenc_component_MessageHandler(), omx_videoenc_component_SetParameter(), OMX_COMPONENTTYPE::pComponentPrivate, SetInternalVideoEncParameters(), OMX_COMPONENTTYPE::SetParameter, omx_base_video_PortType::sPortParam, omx_base_video_PortType::sVideoParam, tsem_init(), OMX_PARAM_PORTDEFINITIONTYPE::video, VIDEO_ENC_BASE_NAME, VIDEO_ENC_MPEG4_NAME, and OMX_VIDEO_PORTDEFINITIONTYPE::xFramerate.
Referenced by omx_component_library_Setup().
OMX_ERRORTYPE omx_videoenc_component_Deinit | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The Deinitialization function of the video encoder
Definition at line 313 of file omx_videoenc_component.c.
References OMX_ErrorNone, OMX_FALSE, omx_videoenc_component_ffmpegLibDeInit(), and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_videoenc_component_MessageHandler().
OMX_ERRORTYPE omx_videoenc_component_Destructor | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The destructor of the video encoder component
Definition at line 166 of file omx_videoenc_component.c.
References DEB_LEV_FUNCTION_NAME, DEBUG, omx_base_filter_Destructor(), OMX_ErrorNone, OMX_PortDomainVideo, and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_videoenc_component_Constructor().
void omx_videoenc_component_ffmpegLibDeInit | ( | omx_videoenc_component_PrivateType * | omx_videoenc_component_Private | ) |
It Deinitializates the ffmpeg framework, and close the ffmpeg video encoder of selected coding type
Definition at line 248 of file omx_videoenc_component.c.
Referenced by omx_videoenc_component_Deinit().
OMX_ERRORTYPE omx_videoenc_component_ffmpegLibInit | ( | omx_videoenc_component_PrivateType * | omx_videoenc_component_Private | ) |
It initializates the FFmpeg framework, and opens an FFmpeg videoencoder of type specified by IL client
Find the encoder corresponding to the video type specified by IL client
Definition at line 196 of file omx_videoenc_component.c.
References DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameWidth, OMX_BASE_FILTER_INPUTPORT_INDEX, OMX_ErrorComponentNotFound, OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_VIDEO_CodingMPEG4, omx_base_video_PortType::sPortParam, tsem_up(), OMX_PARAM_PORTDEFINITIONTYPE::video, and OMX_VIDEO_PORTDEFINITIONTYPE::xFramerate.
Referenced by omx_videoenc_component_MessageHandler().
OMX_ERRORTYPE omx_videoenc_component_GetParameter | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_IN OMX_INDEXTYPE | nParamIndex, | |||
OMX_INOUT OMX_PTR | ComponentParameterStructure | |||
) |
Definition at line 518 of file omx_videoenc_component.c.
References checkHeader(), OMX_PARAM_COMPONENTROLETYPE::cRole, DEB_LEV_SIMPLE_SEQ, DEBUG, OMX_VIDEO_PARAM_MPEG4TYPE::nPortIndex, OMX_VIDEO_PARAM_PORTFORMATTYPE::nPortIndex, omx_base_component_GetParameter(), OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorNone, OMX_IndexParamStandardComponentRole, OMX_IndexParamVideoInit, OMX_IndexParamVideoMpeg4, OMX_IndexParamVideoPortFormat, OMX_PortDomainVideo, OMX_VIDEO_CodingMPEG4, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_video_PortType::sVideoParam, and VIDEO_ENC_MPEG4_ROLE.
Referenced by omx_videoenc_component_Constructor().
OMX_ERRORTYPE omx_videoenc_component_Init | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The Initialization function of the video encoder
Temporary First Output buffer size
Definition at line 299 of file omx_videoenc_component.c.
References OMX_ErrorNone, and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_videoenc_component_MessageHandler().
OMX_ERRORTYPE omx_videoenc_component_MessageHandler | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
internalRequestMessageType * | message | |||
) |
Definition at line 588 of file omx_videoenc_component.c.
References DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, internalRequestMessageType::messageParam, internalRequestMessageType::messageType, omx_base_component_MessageHandler(), OMX_CommandStateSet, OMX_ErrorNone, OMX_ErrorNotReady, OMX_StateIdle, OMX_StateLoaded, OMX_TRUE, omx_videoenc_component_Deinit(), omx_videoenc_component_ffmpegLibInit(), omx_videoenc_component_Init(), and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_videoenc_component_Constructor().
OMX_ERRORTYPE omx_videoenc_component_SetParameter | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_IN OMX_INDEXTYPE | nParamIndex, | |||
OMX_IN OMX_PTR | ComponentParameterStructure | |||
) |
Definition at line 400 of file omx_videoenc_component.c.
References OMX_PARAM_COMPONENTROLETYPE::cRole, DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, OMX_VIDEO_PORTDEFINITIONTYPE::eColorFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE::eColorFormat, OMX_VIDEO_PORTDEFINITIONTYPE::eCompressionFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE::eCompressionFormat, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_VIDEO_PARAM_MPEG4TYPE::nPortIndex, OMX_VIDEO_PARAM_PORTFORMATTYPE::nPortIndex, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, omx_base_component_ParameterSanityCheck(), omx_base_component_SetParameter(), OMX_COLOR_Format16bitARGB1555, OMX_COLOR_Format16bitBGR565, OMX_COLOR_Format16bitRGB565, OMX_COLOR_Format24bitBGR888, OMX_COLOR_Format24bitRGB888, OMX_COLOR_Format32bitARGB8888, OMX_COLOR_Format32bitBGRA8888, OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorNone, OMX_IndexParamPortDefinition, OMX_IndexParamStandardComponentRole, OMX_IndexParamVideoMpeg4, OMX_IndexParamVideoPortFormat, OMX_VIDEO_CodingMPEG4, OMX_COMPONENTTYPE::pComponentPrivate, SetInternalVideoEncParameters(), omx_base_video_PortType::sPortParam, omx_base_video_PortType::sVideoParam, OMX_PARAM_PORTDEFINITIONTYPE::video, and VIDEO_ENC_MPEG4_ROLE.
Referenced by omx_videoenc_component_Constructor().
void SetInternalVideoEncParameters | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
internal function to set coenc related parameters in the private type structure
Definition at line 266 of file omx_videoenc_component.c.
References OMX_VIDEO_PORTDEFINITIONTYPE::cMIMEType, OMX_VIDEO_PARAM_PORTFORMATTYPE::eCompressionFormat, OMX_VIDEO_PORTDEFINITIONTYPE::eCompressionFormat, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_BASE_FILTER_OUTPUTPORT_INDEX, OMX_FALSE, OMX_VIDEO_CodingMPEG4, OMX_VIDEO_MPEG4Level0, OMX_VIDEO_MPEG4ProfileSimple, OMX_COMPONENTTYPE::pComponentPrivate, setHeader(), omx_base_video_PortType::sPortParam, omx_base_video_PortType::sVideoParam, and OMX_PARAM_PORTDEFINITIONTYPE::video.
Referenced by omx_videoenc_component_Constructor(), and omx_videoenc_component_SetParameter().