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