00001
00030 #ifndef _OMX_FFMPEG_COLORCONV_COMPONENT_H_
00031 #define _OMX_FFMPEG_COLORCONV_COMPONENT_H_
00032
00033 #include <OMX_Types.h>
00034 #include <OMX_Component.h>
00035 #include <OMX_Core.h>
00036 #include <pthread.h>
00037 #include <stdlib.h>
00038 #include <string.h>
00039 #include <omx_base_filter.h>
00040 #include <omx_base_video_port.h>
00041
00042 #include <ffmpeg/avcodec.h>
00043 #include <ffmpeg/avformat.h>
00044 #include <ffmpeg/avutil.h>
00045 #include <ffmpeg/swscale.h>
00046
00047 #define COLOR_CONV_BASE_NAME "OMX.st.video_colorconv.ffmpeg"
00048 #define COLOR_CONV_FFMPEG_NAME "OMX.st.video_colorconv.ffmpeg"
00049 #define COLOR_CONV_FFMPEG_ROLE "video_colorconv.ffmpeg"
00050
00051 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
00052 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
00053
00056 DERIVEDCLASS(omx_ffmpeg_colorconv_component_PortType, omx_base_video_PortType)
00057 #define omx_ffmpeg_colorconv_component_PortType_FIELDS omx_base_video_PortType_FIELDS \
00058 \
00059 OMX_CONFIG_RECTTYPE omxConfigCrop; \
00060 \
00061 OMX_CONFIG_ROTATIONTYPE omxConfigRotate; \
00062 \
00063 OMX_CONFIG_MIRRORTYPE omxConfigMirror; \
00064 \
00065 OMX_CONFIG_SCALEFACTORTYPE omxConfigScale; \
00066 \
00067 OMX_CONFIG_POINTTYPE omxConfigOutputPosition; \
00068 \
00069 enum PixelFormat ffmpeg_pxlfmt;
00070 ENDCLASS(omx_ffmpeg_colorconv_component_PortType)
00071
00072
00074 DERIVEDCLASS(omx_ffmpeg_colorconv_component_PrivateType, omx_base_filter_PrivateType)
00075 #define omx_ffmpeg_colorconv_component_PrivateType_FIELDS omx_base_filter_PrivateType_FIELDS \
00076 \
00077 unsigned char *in_buffer; \
00078 \
00079 unsigned char *conv_buffer; \
00080 \
00081 AVFrame *in_frame; \
00082 \
00083 AVFrame *conv_frame; \
00084 \
00085 unsigned int in_alloc_size; \
00086 \
00087 unsigned int conv_alloc_size;
00088 ENDCLASS(omx_ffmpeg_colorconv_component_PrivateType)
00089
00090
00091 OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName);
00092 OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp);
00093 OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Init(OMX_COMPONENTTYPE *openmaxStandComp);
00094 OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Deinit(OMX_COMPONENTTYPE *openmaxStandComp);
00095 OMX_ERRORTYPE omx_video_colorconv_MessageHandler(OMX_COMPONENTTYPE* openmaxStandComp,internalRequestMessageType *message);
00096
00097 void omx_ffmpeg_colorconv_component_BufferMgmtCallback(
00098 OMX_COMPONENTTYPE *openmaxStandComp,
00099 OMX_BUFFERHEADERTYPE* inputbuffer,
00100 OMX_BUFFERHEADERTYPE* outputbuffer);
00101
00102 OMX_ERRORTYPE omx_ffmpeg_colorconv_component_SetConfig(
00103 OMX_IN OMX_HANDLETYPE hComponent,
00104 OMX_IN OMX_INDEXTYPE nIndex,
00105 OMX_IN OMX_PTR pComponentConfigStructure);
00106
00107 OMX_ERRORTYPE omx_ffmpeg_colorconv_component_GetParameter(
00108 OMX_IN OMX_HANDLETYPE hComponent,
00109 OMX_IN OMX_INDEXTYPE nParamIndex,
00110 OMX_INOUT OMX_PTR ComponentParameterStructure);
00111
00112 OMX_ERRORTYPE omx_ffmpeg_colorconv_component_SetParameter(
00113 OMX_IN OMX_HANDLETYPE hComponent,
00114 OMX_IN OMX_INDEXTYPE nParamIndex,
00115 OMX_IN OMX_PTR ComponentParameterStructure);
00116
00117 OMX_ERRORTYPE omx_ffmpeg_colorconv_component_GetConfig(
00118 OMX_IN OMX_HANDLETYPE hComponent,
00119 OMX_IN OMX_INDEXTYPE nIndex,
00120 OMX_INOUT OMX_PTR pComponentConfigStructure);
00121
00123 enum PixelFormat find_ffmpeg_pxlfmt(OMX_COLOR_FORMATTYPE omx_pxlfmt);
00124
00126 OMX_S32 calcStride(OMX_U32 width, OMX_COLOR_FORMATTYPE omx_pxlfmt);
00127
00129 void omx_img_copy(OMX_U8* src_ptr, OMX_S32 src_stride, OMX_U32 src_width, OMX_U32 src_height,
00130 OMX_S32 src_offset_x, OMX_S32 src_offset_y,
00131 OMX_U8* dest_ptr, OMX_S32 dest_stride, OMX_U32 dest_width, OMX_U32 dest_height,
00132 OMX_S32 dest_offset_x, OMX_S32 dest_offset_y,
00133 OMX_S32 cpy_width, OMX_U32 cpy_height, OMX_COLOR_FORMATTYPE colorformat );
00134
00135
00136 OMX_ERRORTYPE omx_video_colorconv_UseEGLImage (
00137 OMX_HANDLETYPE hComponent,
00138 OMX_BUFFERHEADERTYPE** ppBufferHdr,
00139 OMX_U32 nPortIndex,
00140 OMX_PTR pAppPrivate,
00141 void* eglImage);
00142
00143 #endif