#include <OMX_Types.h>
#include <OMX_Component.h>
#include <OMX_Core.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <omx_base_filter.h>
#include <ffmpeg/avcodec.h>
#include <ffmpeg/avformat.h>
#include <ffmpeg/swscale.h>
#include <ffmpeg/avutil.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_videodec_component.h.
#define omx_videodec_component_PrivateType_FIELDS |
Video Decoder component private structure.
Definition at line 69 of file omx_videodec_component.h.
#define VIDEO_DEC_BASE_NAME "OMX.st.video_decoder" |
Definition at line 60 of file omx_videodec_component.h.
Referenced by omx_videodec_component_Constructor().
#define VIDEO_DEC_H264_NAME "OMX.st.video_decoder.avc" |
Definition at line 62 of file omx_videodec_component.h.
Referenced by omx_videodec_component_Constructor().
#define VIDEO_DEC_H264_ROLE "video_decoder.avc" |
Definition at line 64 of file omx_videodec_component.h.
Referenced by main(), omx_videodec_component_ComponentRoleEnum(), omx_videodec_component_GetParameter(), and omx_videodec_component_SetParameter().
#define VIDEO_DEC_MPEG4_NAME "OMX.st.video_decoder.mpeg4" |
Definition at line 61 of file omx_videodec_component.h.
Referenced by omx_videodec_component_Constructor().
#define VIDEO_DEC_MPEG4_ROLE "video_decoder.mpeg4" |
Definition at line 63 of file omx_videodec_component.h.
Referenced by main(), omx_videodec_component_ComponentRoleEnum(), omx_videodec_component_GetParameter(), and omx_videodec_component_SetParameter().
void omx_videodec_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
Send Port Settings changed call back
This condition becomes true when the input buffer has completely be consumed. In this case is immediately switched because there is no real buffer consumption
Few bytes may be left in the input buffer but can't generate one output frame. Request for new Input Buffer
Definition at line 409 of file omx_videodec_component.c.
References DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEB_LEV_SIMPLE_SEQ, 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_EventPortSettingsChanged, OMX_VIDEO_CodingAVC, OMX_VIDEO_CodingMPEG4, OMX_BUFFERHEADERTYPE::pBuffer, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_video_PortType::sPortParam, tsem_down(), and OMX_PARAM_PORTDEFINITIONTYPE::video.
Referenced by omx_videodec_component_Constructor().
OMX_ERRORTYPE omx_videodec_component_ComponentRoleEnum | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_OUT OMX_U8 * | cRole, | |||
OMX_IN OMX_U32 | nIndex | |||
) |
Definition at line 806 of file omx_videodec_component.c.
References OMX_ErrorNone, OMX_ErrorUnsupportedIndex, VIDEO_DEC_H264_ROLE, and VIDEO_DEC_MPEG4_ROLE.
Referenced by omx_videodec_component_Constructor().
OMX_ERRORTYPE omx_videodec_component_Constructor | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
OMX_STRING | cComponentName | |||
) |
The Constructor of the video decoder component
openmaxStandComp | the component handle to be constructed | |
cComponentName | is the name of the constructed component |
Allocate Ports and call port constructor.
here we can override whatever defaults the base_component constructor set e.g. we can override the function pointers in the private struct
Domain specific section for the ports. first we set the parameter common to both formats
settings of output port parameter definition
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_videodec_component_private
initializing the codec context etc that was done earlier by ffmpeglibinit function
Definition at line 53 of file omx_videodec_component.c.
References base_video_port_Constructor(), OMX_COMPONENTTYPE::ComponentRoleEnum, DEB_LEV_FUNCTION_NAME, DEBUG, DEFAULT_OUT_BUFFER_SIZE, DEFAULT_VIDEO_OUTPUT_BUF_SIZE, OMX_VIDEO_PARAM_PORTFORMATTYPE::eColorFormat, OMX_VIDEO_PORTDEFINITIONTYPE::eColorFormat, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_COMPONENTTYPE::GetExtensionIndex, OMX_COMPONENTTYPE::GetParameter, MAX_COMPONENT_VIDEODEC, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, omx_base_filter_Constructor(), OMX_BASE_FILTER_INPUTPORT_INDEX, OMX_BASE_FILTER_OUTPUTPORT_INDEX, OMX_ErrorInsufficientResources, OMX_ErrorInvalidComponentName, OMX_ErrorNone, OMX_FALSE, OMX_PortDomainVideo, OMX_TRUE, OMX_VIDEO_CodingAVC, OMX_VIDEO_CodingMPEG4, OMX_VIDEO_CodingUnused, omx_videodec_component_BufferMgmtCallback(), omx_videodec_component_ComponentRoleEnum(), omx_videodec_component_Destructor(), omx_videodec_component_GetExtensionIndex(), omx_videodec_component_GetParameter(), omx_videodec_component_MessageHandler(), omx_videodec_component_SetConfig(), omx_videodec_component_SetParameter(), OUTPUT_DECODED_COLOR_FMT, OMX_COMPONENTTYPE::pComponentPrivate, OMX_COMPONENTTYPE::SetConfig, SetInternalVideoParameters(), OMX_COMPONENTTYPE::SetParameter, omx_base_video_PortType::sPortParam, omx_base_video_PortType::sVideoParam, tsem_init(), OMX_PARAM_PORTDEFINITIONTYPE::video, VIDEO_DEC_BASE_NAME, VIDEO_DEC_H264_NAME, VIDEO_DEC_MPEG4_NAME, OMX_VIDEO_PARAM_PORTFORMATTYPE::xFramerate, and OMX_VIDEO_PORTDEFINITIONTYPE::xFramerate.
Referenced by omx_component_library_Setup().
OMX_ERRORTYPE omx_videodec_component_Deinit | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The Deinitialization function of the video decoder
Definition at line 372 of file omx_videodec_component.c.
References OMX_ErrorNone, OMX_FALSE, omx_videodec_component_ffmpegLibDeInit(), and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_videodec_component_MessageHandler().
OMX_ERRORTYPE omx_videodec_component_Destructor | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The destructor of the video decoder component
Definition at line 177 of file omx_videodec_component.c.
References DEB_LEV_FUNCTION_NAME, DEBUG, omx_base_filter_Destructor(), OMX_ErrorNone, OMX_PortDomainVideo, OMX_COMPONENTTYPE::pComponentPrivate, and tsem_deinit().
Referenced by omx_videodec_component_Constructor().
OMX_ERRORTYPE omx_videodec_component_GetExtensionIndex | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_IN OMX_STRING | cParameterName, | |||
OMX_OUT OMX_INDEXTYPE * | pIndexType | |||
) |
Definition at line 862 of file omx_videodec_component.c.
References DEB_LEV_FUNCTION_NAME, DEBUG, OMX_ErrorBadParameter, OMX_ErrorNone, and OMX_IndexVendorVideoExtraData.
Referenced by omx_videodec_component_Constructor().
OMX_ERRORTYPE omx_videodec_component_GetParameter | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_IN OMX_INDEXTYPE | nParamIndex, | |||
OMX_INOUT OMX_PTR | ComponentParameterStructure | |||
) |
Definition at line 677 of file omx_videodec_component.c.
References checkHeader(), OMX_PARAM_COMPONENTROLETYPE::cRole, DEB_LEV_SIMPLE_SEQ, DEBUG, OMX_VIDEO_PARAM_AVCTYPE::nPortIndex, OMX_VIDEO_PARAM_MPEG4TYPE::nPortIndex, OMX_VIDEO_PARAM_PORTFORMATTYPE::nPortIndex, omx_base_component_GetParameter(), OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorNone, OMX_IndexParamStandardComponentRole, OMX_IndexParamVideoAvc, OMX_IndexParamVideoInit, OMX_IndexParamVideoMpeg4, OMX_IndexParamVideoPortFormat, OMX_PortDomainVideo, OMX_VIDEO_CodingAVC, OMX_VIDEO_CodingMPEG4, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_video_PortType::sVideoParam, VIDEO_DEC_H264_ROLE, and VIDEO_DEC_MPEG4_ROLE.
Referenced by omx_videodec_component_Constructor().
OMX_ERRORTYPE omx_videodec_component_Init | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The Initialization function of the video decoder
Temporary First Output buffer size
Definition at line 356 of file omx_videodec_component.c.
References OMX_ErrorNone, and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_videodec_component_MessageHandler().
OMX_ERRORTYPE omx_videodec_component_MessageHandler | ( | OMX_COMPONENTTYPE * | , | |
internalRequestMessageType * | ||||
) |
Definition at line 762 of file omx_videodec_component.c.
References DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, err, internalRequestMessageType::messageParam, internalRequestMessageType::messageType, omx_base_component_MessageHandler(), OMX_CommandStateSet, OMX_ErrorNone, OMX_ErrorNotReady, OMX_FALSE, OMX_StateExecuting, OMX_StateIdle, OMX_StateLoaded, OMX_TRUE, omx_videodec_component_Deinit(), omx_videodec_component_ffmpegLibDeInit(), omx_videodec_component_ffmpegLibInit(), omx_videodec_component_Init(), and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_videodec_component_Constructor().
OMX_ERRORTYPE omx_videodec_component_SetConfig | ( | OMX_HANDLETYPE | hComponent, | |
OMX_INDEXTYPE | nIndex, | |||
OMX_PTR | pComponentConfigStructure | |||
) |
copy the extradata in the codec context private structure
Definition at line 821 of file omx_videodec_component.c.
References DEB_LEV_SIMPLE_SEQ, DEBUG, err, OMX_VENDOR_EXTRADATATYPE::nDataSize, OMX_VENDOR_EXTRADATATYPE::nPortIndex, omx_base_component_SetConfig(), OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorNone, OMX_IndexVendorVideoExtraData, OMX_COMPONENTTYPE::pComponentPrivate, and OMX_VENDOR_EXTRADATATYPE::pData.
Referenced by omx_videodec_component_Constructor().
OMX_ERRORTYPE omx_videodec_component_SetParameter | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_IN OMX_INDEXTYPE | nParamIndex, | |||
OMX_IN OMX_PTR | ComponentParameterStructure | |||
) |
Definition at line 547 of file omx_videodec_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_PARAM_PORTDEFINITIONTYPE::format, OMX_VIDEO_PARAM_MPEG4TYPE::nPortIndex, OMX_VIDEO_PARAM_AVCTYPE::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_IndexParamVideoAvc, OMX_IndexParamVideoMpeg4, OMX_IndexParamVideoPortFormat, OMX_VIDEO_CodingAVC, OMX_VIDEO_CodingMPEG4, OMX_COMPONENTTYPE::pComponentPrivate, SetInternalVideoParameters(), omx_base_video_PortType::sPortParam, omx_base_video_PortType::sVideoParam, OMX_PARAM_PORTDEFINITIONTYPE::video, VIDEO_DEC_H264_ROLE, and VIDEO_DEC_MPEG4_ROLE.
Referenced by omx_videodec_component_Constructor().
void SetInternalVideoParameters | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
internal function to set codec related parameters in the private type structure
Definition at line 283 of file omx_videodec_component.c.
References OMX_VIDEO_PARAM_PORTFORMATTYPE::eCompressionFormat, OMX_BASE_FILTER_INPUTPORT_INDEX, OMX_FALSE, OMX_VIDEO_AVCLevel1, OMX_VIDEO_AVCLoopFilterDisable, OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_CodingAVC, OMX_VIDEO_CodingMPEG4, OMX_VIDEO_MPEG4Level0, OMX_VIDEO_MPEG4ProfileSimple, OMX_COMPONENTTYPE::pComponentPrivate, setHeader(), and omx_base_video_PortType::sVideoParam.
Referenced by omx_videodec_component_Constructor(), and omx_videodec_component_SetParameter().