00001
00030 #ifndef _OMX_FBDEV_SINK_COMPONENT_H_
00031 #define _OMX_FBDEV_SINK_COMPONENT_H_
00032
00033 #include <OMX_Types.h>
00034 #include <OMX_Component.h>
00035 #include <OMX_Core.h>
00036 #include <OMX_Video.h>
00037 #include <OMX_IVCommon.h>
00038 #include <pthread.h>
00039 #include <sys/ioctl.h>
00040 #include <sys/mman.h>
00041 #include <fcntl.h>
00042 #include <unistd.h>
00043 #include <string.h>
00044 #include <sys/time.h>
00045
00046 #include <omx_base_video_port.h>
00047 #include <omx_base_clock_port.h>
00048 #include <omx_base_sink.h>
00049 #include <linux/fb.h>
00050
00054 #define FBDEV_FILENAME "/dev/fb0"
00055
00058 DERIVEDCLASS(omx_fbdev_sink_component_PortType, omx_base_video_PortType)
00059 #define omx_fbdev_sink_component_PortType_FIELDS omx_base_video_PortType_FIELDS \
00060 \
00061 OMX_CONFIG_RECTTYPE omxConfigCrop; \
00062 \
00063 OMX_CONFIG_ROTATIONTYPE omxConfigRotate; \
00064 \
00065 OMX_CONFIG_MIRRORTYPE omxConfigMirror; \
00066 \
00067 OMX_CONFIG_SCALEFACTORTYPE omxConfigScale; \
00068 \
00069 OMX_CONFIG_POINTTYPE omxConfigOutputPosition;
00070 ENDCLASS(omx_fbdev_sink_component_PortType)
00071
00072
00089 DERIVEDCLASS(omx_fbdev_sink_component_PrivateType, omx_base_sink_PrivateType)
00090 #define omx_fbdev_sink_component_PrivateType_FIELDS omx_base_sink_PrivateType_FIELDS \
00091 int fd; \
00092 struct fb_var_screeninfo vscr_info; \
00093 struct fb_fix_screeninfo fscr_info; \
00094 unsigned char *scr_ptr; \
00095 OMX_COLOR_FORMATTYPE fbpxlfmt; \
00096 OMX_U32 fbwidth; \
00097 OMX_U32 fbheight; \
00098 OMX_U32 fbbpp; \
00099 OMX_S32 fbstride; \
00100 OMX_S32 xScale; \
00101 OMX_TIME_CLOCKSTATE eState; \
00102 OMX_U32 product;\
00103 OMX_BOOL frameDropFlag;\
00104 int dropFrameCount;
00105 ENDCLASS(omx_fbdev_sink_component_PrivateType)
00106
00107
00108 OMX_ERRORTYPE omx_fbdev_sink_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName);
00109 OMX_ERRORTYPE omx_fbdev_sink_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp);
00110 OMX_ERRORTYPE omx_fbdev_sink_component_Init(OMX_COMPONENTTYPE *openmaxStandComp);
00111 OMX_ERRORTYPE omx_fbdev_sink_component_Deinit(OMX_COMPONENTTYPE *openmaxStandComp);
00112 OMX_ERRORTYPE omx_fbdev_sink_component_MessageHandler(OMX_COMPONENTTYPE* , internalRequestMessageType*);
00113
00114 void omx_fbdev_sink_component_BufferMgmtCallback(
00115 OMX_COMPONENTTYPE *openmaxStandComp,
00116 OMX_BUFFERHEADERTYPE* pInputBuffer);
00117
00118 OMX_ERRORTYPE omx_fbdev_sink_component_port_SendBufferFunction(
00119 omx_base_PortType *openmaxStandPort,
00120 OMX_BUFFERHEADERTYPE* pBuffer);
00121
00122
00123 OMX_BOOL omx_fbdev_sink_component_ClockPortHandleFunction(
00124 omx_fbdev_sink_component_PrivateType* omx_fbdev_sink_component_Private,
00125 OMX_BUFFERHEADERTYPE* inputbuffer);
00126
00127 OMX_ERRORTYPE omx_fbdev_sink_component_SetConfig(
00128 OMX_IN OMX_HANDLETYPE hComponent,
00129 OMX_IN OMX_INDEXTYPE nIndex,
00130 OMX_IN OMX_PTR pComponentConfigStructure);
00131
00132 OMX_ERRORTYPE omx_fbdev_sink_component_GetParameter(
00133 OMX_IN OMX_HANDLETYPE hComponent,
00134 OMX_IN OMX_INDEXTYPE nParamIndex,
00135 OMX_INOUT OMX_PTR ComponentParameterStructure);
00136
00137 OMX_ERRORTYPE omx_fbdev_sink_component_SetParameter(
00138 OMX_IN OMX_HANDLETYPE hComponent,
00139 OMX_IN OMX_INDEXTYPE nParamIndex,
00140 OMX_IN OMX_PTR ComponentParameterStructure);
00141
00142 OMX_ERRORTYPE omx_fbdev_sink_component_GetConfig(
00143 OMX_IN OMX_HANDLETYPE hComponent,
00144 OMX_IN OMX_INDEXTYPE nIndex,
00145 OMX_INOUT OMX_PTR pComponentConfigStructure);
00146
00150 OMX_COLOR_FORMATTYPE find_omx_pxlfmt(struct fb_var_screeninfo *vscr_info);
00151
00153 enum PixelFormat find_ffmpeg_pxlfmt(OMX_COLOR_FORMATTYPE omx_pxlfmt);
00154
00156 OMX_S32 calcStride(OMX_U32 width, OMX_COLOR_FORMATTYPE omx_pxlfmt);
00157
00159 void omx_img_copy(OMX_U8* src_ptr, OMX_S32 src_stride, OMX_U32 src_width, OMX_U32 src_height,
00160 OMX_S32 src_offset_x, OMX_S32 src_offset_y,
00161 OMX_U8* dest_ptr, OMX_S32 dest_stride, OMX_U32 dest_width, OMX_U32 dest_height,
00162 OMX_S32 dest_offset_x, OMX_S32 dest_offset_y,
00163 OMX_S32 cpy_width, OMX_U32 cpy_height, OMX_COLOR_FORMATTYPE colorformat,OMX_COLOR_FORMATTYPE fbpxlfmt);
00164
00170 long GetTime();
00171
00172 #endif