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