omx_videoenc_component.h File Reference

#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.

Defines

#define VIDEO_ENC_BASE_NAME   "OMX.st.video_encoder"
#define VIDEO_ENC_MPEG4_NAME   "OMX.st.video_encoder.mpeg4"
#define VIDEO_ENC_MPEG4_ROLE   "video_encoder.mpeg4"
#define omx_videoenc_component_PrivateType_FIELDS

Functions

OMX_ERRORTYPE omx_videoenc_component_Constructor (OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
OMX_ERRORTYPE omx_videoenc_component_Destructor (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_videoenc_component_Init (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_videoenc_component_Deinit (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_videoenc_component_MessageHandler (OMX_COMPONENTTYPE *, internalRequestMessageType *)
void omx_videoenc_component_BufferMgmtCallback (OMX_COMPONENTTYPE *openmaxStandComp, OMX_BUFFERHEADERTYPE *inputbuffer, OMX_BUFFERHEADERTYPE *outputbuffer)
OMX_ERRORTYPE omx_videoenc_component_GetParameter (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_videoenc_component_SetParameter (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_IN OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_videoenc_component_ComponentRoleEnum (OMX_IN OMX_HANDLETYPE hComponent, OMX_OUT OMX_U8 *cRole, OMX_IN OMX_U32 nIndex)
void SetInternalVideoEncParameters (OMX_COMPONENTTYPE *openmaxStandComp)


Detailed Description

This component implements an MPEG-4 video encoder. The MPEG-4 Video encoder is based on the FFmpeg software library.

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_videoenc_component.h.


Define Documentation

#define omx_videoenc_component_PrivateType_FIELDS

Value:

omx_base_filter_PrivateType_FIELDS \ \
  AVCodec *avCodec;  \ \
  AVCodecContext *avCodecContext;  \ \
  AVFrame *picture; \\
  tsem_t* avCodecSyncSem; \  \
  OMX_VIDEO_PARAM_MPEG4TYPE pVideoMpeg4;  \
  OMX_BOOL avcodecReady;  \ \
  OMX_U16 minBufferLength; \ \
  OMX_S32 isFirstBuffer;\ \
  OMX_S32 isNewBuffer;  \ \
  OMX_U32 video_encoding_type;   \ \
  enum PixelFormat eOutFramePixFmt;
Video Encoder component private structure.

Definition at line 56 of file omx_videoenc_component.h.

#define VIDEO_ENC_BASE_NAME   "OMX.st.video_encoder"

Definition at line 49 of file omx_videoenc_component.h.

Referenced by omx_videoenc_component_Constructor().

#define VIDEO_ENC_MPEG4_NAME   "OMX.st.video_encoder.mpeg4"

Definition at line 50 of file omx_videoenc_component.h.

Referenced by omx_videoenc_component_Constructor().

#define VIDEO_ENC_MPEG4_ROLE   "video_encoder.mpeg4"


Function Documentation

void omx_videoenc_component_BufferMgmtCallback ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_BUFFERHEADERTYPE pInputBuffer,
OMX_BUFFERHEADERTYPE pOutputBuffer 
)

OMX_ERRORTYPE omx_videoenc_component_ComponentRoleEnum ( OMX_IN OMX_HANDLETYPE  hComponent,
OMX_OUT OMX_U8 cRole,
OMX_IN OMX_U32  nIndex 
)

OMX_ERRORTYPE omx_videoenc_component_Constructor ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_STRING  cComponentName 
)

The Constructor of the video encoder component

Parameters:
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 47 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_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 309 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 162 of file omx_videoenc_component.c.

References DEB_LEV_FUNCTION_NAME, DEBUG, omx_base_filter_Destructor(), OMX_ErrorNone, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_videoenc_component_Constructor().

OMX_ERRORTYPE omx_videoenc_component_GetParameter ( OMX_IN OMX_HANDLETYPE  hComponent,
OMX_IN OMX_INDEXTYPE  nParamIndex,
OMX_INOUT OMX_PTR  ComponentParameterStructure 
)

OMX_ERRORTYPE omx_videoenc_component_Init ( OMX_COMPONENTTYPE openmaxStandComp  ) 

The Initialization function of the video encoder

Temporary First Output buffer size

Definition at line 295 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 ,
internalRequestMessageType  
)

OMX_ERRORTYPE omx_videoenc_component_SetParameter ( OMX_IN OMX_HANDLETYPE  hComponent,
OMX_IN OMX_INDEXTYPE  nParamIndex,
OMX_IN OMX_PTR  ComponentParameterStructure 
)

void SetInternalVideoEncParameters ( OMX_COMPONENTTYPE openmaxStandComp  ) 


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