00001
00030 #ifndef _OMX_VIDEODEC_COMPONENT_H_
00031 #define _OMX_VIDEODEC_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_DEC_BASE_NAME "OMX.st.video_decoder"
00050 #define VIDEO_DEC_MPEG4_NAME "OMX.st.video_decoder.mpeg4"
00051 #define VIDEO_DEC_H264_NAME "OMX.st.video_decoder.avc"
00052 #define VIDEO_DEC_MPEG4_ROLE "video_decoder.mpeg4"
00053 #define VIDEO_DEC_H264_ROLE "video_decoder.avc"
00054
00057 DERIVEDCLASS(omx_videodec_component_PrivateType, omx_base_filter_PrivateType)
00058 #define omx_videodec_component_PrivateType_FIELDS omx_base_filter_PrivateType_FIELDS \
00059 \
00060 AVCodec *avCodec; \
00061 \
00062 AVCodecContext *avCodecContext; \
00063 \
00064 AVFrame *avFrame; \
00065 \
00066 tsem_t* avCodecSyncSem; \
00067 \
00068 OMX_VIDEO_PARAM_MPEG4TYPE pVideoMpeg4; \
00069 \
00070 OMX_VIDEO_PARAM_AVCTYPE pVideoAvc; \
00071 \
00072 OMX_BOOL avcodecReady; \
00073 \
00074 OMX_U16 minBufferLength; \
00075 \
00076 OMX_U8* inputCurrBuffer;\
00077 \
00078 OMX_U32 inputCurrLength;\
00079 \
00080 OMX_S32 isFirstBuffer;\
00081 \
00082 OMX_S32 isNewBuffer; \
00083 \
00084 OMX_U32 video_coding_type; \
00085 \
00086 enum PixelFormat eOutFramePixFmt; \
00087 \
00088 OMX_U8* extradata; \
00089 \
00090 OMX_U32 extradata_size;
00091 ENDCLASS(omx_videodec_component_PrivateType)
00092
00093
00094 OMX_ERRORTYPE omx_videodec_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName);
00095 OMX_ERRORTYPE omx_videodec_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp);
00096 OMX_ERRORTYPE omx_videodec_component_Init(OMX_COMPONENTTYPE *openmaxStandComp);
00097 OMX_ERRORTYPE omx_videodec_component_Deinit(OMX_COMPONENTTYPE *openmaxStandComp);
00098 OMX_ERRORTYPE omx_videodec_component_MessageHandler(OMX_COMPONENTTYPE*,internalRequestMessageType*);
00099
00100 void omx_videodec_component_BufferMgmtCallback(
00101 OMX_COMPONENTTYPE *openmaxStandComp,
00102 OMX_BUFFERHEADERTYPE* inputbuffer,
00103 OMX_BUFFERHEADERTYPE* outputbuffer);
00104
00105 OMX_ERRORTYPE omx_videodec_component_GetParameter(
00106 OMX_IN OMX_HANDLETYPE hComponent,
00107 OMX_IN OMX_INDEXTYPE nParamIndex,
00108 OMX_INOUT OMX_PTR ComponentParameterStructure);
00109
00110 OMX_ERRORTYPE omx_videodec_component_SetParameter(
00111 OMX_IN OMX_HANDLETYPE hComponent,
00112 OMX_IN OMX_INDEXTYPE nParamIndex,
00113 OMX_IN OMX_PTR ComponentParameterStructure);
00114
00115 OMX_ERRORTYPE omx_videodec_component_ComponentRoleEnum(
00116 OMX_IN OMX_HANDLETYPE hComponent,
00117 OMX_OUT OMX_U8 *cRole,
00118 OMX_IN OMX_U32 nIndex);
00119
00120 void SetInternalVideoParameters(OMX_COMPONENTTYPE *openmaxStandComp);
00121
00122 OMX_ERRORTYPE omx_videodec_component_SetConfig(
00123 OMX_HANDLETYPE hComponent,
00124 OMX_INDEXTYPE nIndex,
00125 OMX_PTR pComponentConfigStructure);
00126
00127 OMX_ERRORTYPE omx_videodec_component_GetExtensionIndex(
00128 OMX_IN OMX_HANDLETYPE hComponent,
00129 OMX_IN OMX_STRING cParameterName,
00130 OMX_OUT OMX_INDEXTYPE* pIndexType);
00131
00132 #endif