00001
00030 #ifndef _OMX_VIDEOENC_COMPONENT_H_
00031 #define _OMX_VIDEOENC_COMPONENT_H_
00032
00033
00034 #include <OMX_Types.h>
00035 #include <OMX_Component.h>
00036 #include <OMX_Core.h>
00037 #include <pthread.h>
00038 #include <stdlib.h>
00039 #include <string.h>
00040 #include <omx_base_filter.h>
00041 #include <string.h>
00042
00043 #include <ffmpeg/avcodec.h>
00044 #include <ffmpeg/avformat.h>
00045 #include <ffmpeg/swscale.h>
00046 #include <ffmpeg/avutil.h>
00047
00048
00049 #define VIDEO_ENC_BASE_NAME "OMX.st.video_encoder"
00050 #define VIDEO_ENC_MPEG4_NAME "OMX.st.video_encoder.mpeg4"
00051 #define VIDEO_ENC_MPEG4_ROLE "video_encoder.mpeg4"
00052
00055 DERIVEDCLASS(omx_videoenc_component_PrivateType, omx_base_filter_PrivateType)
00056 #define omx_videoenc_component_PrivateType_FIELDS omx_base_filter_PrivateType_FIELDS \
00057 \
00058 AVCodec *avCodec; \
00059 \
00060 AVCodecContext *avCodecContext; \
00061 \
00062 AVFrame *picture; \
00063 \
00064 tsem_t* avCodecSyncSem; \
00065 \
00066 OMX_VIDEO_PARAM_MPEG4TYPE pVideoMpeg4; \
00067 OMX_BOOL avcodecReady; \
00068 \
00069 OMX_U16 minBufferLength; \
00070 \
00071 OMX_S32 isFirstBuffer;\
00072 \
00073 OMX_S32 isNewBuffer; \
00074 \
00075 OMX_U32 video_encoding_type; \
00076 \
00077 enum PixelFormat eOutFramePixFmt;
00078 ENDCLASS(omx_videoenc_component_PrivateType)
00079
00080
00081 OMX_ERRORTYPE omx_videoenc_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName);
00082 OMX_ERRORTYPE omx_videoenc_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp);
00083 OMX_ERRORTYPE omx_videoenc_component_Init(OMX_COMPONENTTYPE *openmaxStandComp);
00084 OMX_ERRORTYPE omx_videoenc_component_Deinit(OMX_COMPONENTTYPE *openmaxStandComp);
00085 OMX_ERRORTYPE omx_videoenc_component_MessageHandler(OMX_COMPONENTTYPE*,internalRequestMessageType*);
00086
00087 void omx_videoenc_component_BufferMgmtCallback(
00088 OMX_COMPONENTTYPE *openmaxStandComp,
00089 OMX_BUFFERHEADERTYPE* inputbuffer,
00090 OMX_BUFFERHEADERTYPE* outputbuffer);
00091
00092 OMX_ERRORTYPE omx_videoenc_component_GetParameter(
00093 OMX_IN OMX_HANDLETYPE hComponent,
00094 OMX_IN OMX_INDEXTYPE nParamIndex,
00095 OMX_INOUT OMX_PTR ComponentParameterStructure);
00096
00097 OMX_ERRORTYPE omx_videoenc_component_SetParameter(
00098 OMX_IN OMX_HANDLETYPE hComponent,
00099 OMX_IN OMX_INDEXTYPE nParamIndex,
00100 OMX_IN OMX_PTR ComponentParameterStructure);
00101
00102 OMX_ERRORTYPE omx_videoenc_component_ComponentRoleEnum(
00103 OMX_IN OMX_HANDLETYPE hComponent,
00104 OMX_OUT OMX_U8 *cRole,
00105 OMX_IN OMX_U32 nIndex);
00106
00107 void SetInternalVideoEncParameters(OMX_COMPONENTTYPE *openmaxStandComp);
00108
00109
00110 #endif