[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[457] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-11-26 17:02:36
|
Revision: 457 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=457&view=rev Author: nickols_k Date: 2012-11-26 17:02:22 +0000 (Mon, 26 Nov 2012) Log Message: ----------- SECURITY PATCH: use class VO_Interface instead of struct video_out Note about illegal patch: it seems that glxContext is substituted on my working PC simply because the same method in official examples creates window and paints images into it. Modified Paths: -------------- mplayerxp/libmpsub/spudec.cpp mplayerxp/libmpsub/spudec.h mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vo_fbdev.cpp mplayerxp/libvo/vo_null.cpp mplayerxp/libvo/vo_opengl.cpp mplayerxp/libvo/vo_sdl.cpp mplayerxp/libvo/vo_vesa.cpp mplayerxp/libvo/vo_x11.cpp mplayerxp/libvo/vo_xv.cpp mplayerxp/libvo/vosub_vidix.cpp mplayerxp/libvo/vosub_vidix.h Modified: mplayerxp/libmpsub/spudec.cpp =================================================================== --- mplayerxp/libmpsub/spudec.cpp 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libmpsub/spudec.cpp 2012-11-26 17:02:22 UTC (rev 457) @@ -89,7 +89,6 @@ unsigned char *scaled_aimage; int auto_palette; /* 1 if we lack a palette and must use an heuristic. */ int font_start_level; /* Darkest value used for the computed font */ - vo_functions_t *hw_spu; int spu_changed; unsigned int forced_subs_only; /* flag: 0=display all subtitle, !0 display only forced subtitles */ unsigned int is_forced_sub; /* true if current subtitle is a forced subtitle */ @@ -476,13 +475,6 @@ static void __FASTCALL__ spudec_decode(spudec_handle_t *self, unsigned int pts100) { - if(self->hw_spu) { - vo_mpegpes_t packet = { NULL, 0, 0x20, 0 }; - packet.data = self->packet; - packet.size = self->packet_size; - packet.timestamp = pts100; -// self->hw_spu->draw_frame((uint8_t**)&pkg); - } else spudec_process_control(self, pts100); } @@ -1099,8 +1091,6 @@ spudec_handle_t *spu = (spudec_handle_t *) self; if (spu && palette) { memcpy(spu->global_palette, palette, sizeof(spu->global_palette)); -// if(spu->hw_spu) -// spu->hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette); } } @@ -1166,12 +1156,3 @@ delete spu; } } - -void __FASTCALL__ spudec_set_hw_spu(any_t*self, vo_functions_t *hw_spu) -{ - spudec_handle_t *spu = (spudec_handle_t*)self; - if (!spu) - return; - spu->hw_spu = hw_spu; -// hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette); -} Modified: mplayerxp/libmpsub/spudec.h =================================================================== --- mplayerxp/libmpsub/spudec.h 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libmpsub/spudec.h 2012-11-26 17:02:22 UTC (rev 457) @@ -21,7 +21,6 @@ void __FASTCALL__ spudec_reset(any_t*__self); // called after seek int __FASTCALL__ spudec_visible(any_t*__self); // check if spu is visible void __FASTCALL__ spudec_set_font_factor(any_t*__self, double factor); // sets the equivalent to ffactor -void __FASTCALL__ spudec_set_hw_spu(any_t*__self, vo_functions_t *hw_spu); int __FASTCALL__ spudec_changed(any_t*__self); void __FASTCALL__ spudec_calc_bbox(any_t*me, unsigned int dxs, unsigned int dys, unsigned int* bbox); void __FASTCALL__ spudec_set_forced_subs_only(any_t* const __self, const unsigned int flag); Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libvo/video_out.cpp 2012-11-26 17:02:22 UTC (rev 457) @@ -32,6 +32,7 @@ #include <sys/mman.h> #include "video_out.h" +#include "video_out_internal.h" #include "osdep/shmem.h" #include "mp_conf_lavc.h" @@ -59,35 +60,35 @@ // // Externally visible list of all vo drivers // -extern const vo_functions_t video_out_x11; -extern const vo_functions_t video_out_xv; -extern const vo_functions_t video_out_sdl; -extern const vo_functions_t video_out_null; -extern const vo_functions_t video_out_fbdev; -extern const vo_functions_t video_out_opengl; -extern const vo_functions_t video_out_vesa; +extern const vo_info_t x11_info; +extern const vo_info_t xv_info; +extern const vo_info_t sdl_info; +extern const vo_info_t null_info; +extern const vo_info_t fbdev_info; +extern const vo_info_t opengl_info; +extern const vo_info_t vesa_info; -static const vo_functions_t* video_out_drivers[] = +static const vo_info_t* vo_infos[] = { #ifdef HAVE_XV - &video_out_xv, + &xv_info, #endif #ifdef HAVE_OPENGL - &video_out_opengl, + &opengl_info, #endif #ifdef HAVE_X11 - &video_out_x11, + &x11_info, #endif #ifdef HAVE_SDL - &video_out_sdl, + &sdl_info, #endif #ifdef HAVE_VESA - &video_out_vesa, + &vesa_info, #endif #ifdef HAVE_FBDEV - &video_out_fbdev, + &fbdev_info, #endif - &video_out_null, + &null_info, NULL }; @@ -126,7 +127,8 @@ pthread_mutex_t surfaces_mutex; vo_format_desc vod; dri_priv_t dri; - const vo_functions_t * video_out; + const vo_info_t* video_out; + class VO_Interface* vo_iface; draw_alpha_f draw_alpha; }; @@ -140,40 +142,42 @@ vo_priv_t::~vo_priv_t() { pthread_mutex_destroy(&surfaces_mutex); + delete vo_iface; } void vo_print_help(vo_data_t*vo) { + UNUSED(vo); unsigned i; MSG_INFO("Available video output drivers:\n"); i=0; - while (video_out_drivers[i]) { - const vo_info_t *info = video_out_drivers[i++]->get_info (vo); + while (vo_infos[i]) { + const vo_info_t *info = vo_infos[i++]; MSG_INFO("\t%s\t%s\n", info->short_name, info->name); } MSG_INFO("\n"); } -const vo_functions_t* vo_register(vo_data_t*vo,const char *driver_name) +MPXP_Rc vo_register(vo_data_t*vo,const char *driver_name) { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); unsigned i; - if(!driver_name) priv.video_out=video_out_drivers[0]; + if(!driver_name) priv.video_out=vo_infos[0]; else - for (i=0; video_out_drivers[i] != &video_out_null; i++){ - const vo_info_t *info = video_out_drivers[i]->get_info (vo); + for (i=0; vo_infos[i] != &null_info; i++){ + const vo_info_t *info = vo_infos[i]; if(strcmp(info->short_name,driver_name) == 0){ - priv.video_out = video_out_drivers[i]; + priv.video_out = vo_infos[i]; break; } } - return priv.video_out; + return priv.video_out?MPXP_Ok:MPXP_False; } const vo_info_t* vo_get_info(vo_data_t*vo) { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); - return priv.video_out->get_info(vo); + return priv.video_out; } vo_data_t* __FASTCALL__ vo_preinit_structs( void ) @@ -196,7 +200,8 @@ vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_init(%s)\n",subdevice); priv.frame_counter=0; - return priv.video_out->preinit(vo,subdevice); + priv.vo_iface=priv.video_out->query_interface(subdevice); + return priv.vo_iface?MPXP_Ok:MPXP_False; } int __FASTCALL__ vo_describe_fourcc(uint32_t fourcc,vo_format_desc *vd) @@ -273,12 +278,12 @@ if(!priv.dri.bpp) priv.dri.has_dri=0; /*unknown fourcc*/ if(priv.dri.has_dri) { - priv.video_out->control_vo(vo,VOCTRL_GET_NUM_FRAMES,&priv.dri.num_xp_frames); + priv.vo_iface->ctrl(VOCTRL_GET_NUM_FRAMES,&priv.dri.num_xp_frames); priv.dri.num_xp_frames=std::min(priv.dri.num_xp_frames,unsigned(MAX_DRI_BUFFERS)); for(i=0;i<priv.dri.num_xp_frames;i++) { priv.dri.surf[i].idx=i; - priv.video_out->control_vo(vo,DRI_GET_SURFACE,&priv.dri.surf[i]); + priv.vo_iface->ctrl(DRI_GET_SURFACE,&priv.dri.surf[i]); } } } @@ -375,7 +380,7 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); priv.dri.has_dri = 1; - priv.video_out->control_vo(vo,DRI_GET_SURFACE_CAPS,&priv.dri.cap); + priv.vo_iface->ctrl(DRI_GET_SURFACE_CAPS,&priv.dri.cap); dri_config(vo,priv.dri.cap.fourcc); /* ugly workaround of swapped BGR-fourccs. Should be removed in the future */ if(!priv.dri.has_dri) @@ -422,11 +427,11 @@ priv.dri.d_height = d_h; MSG_V("priv.video_out->config(%u,%u,%u,%u,0x%x,'%s',%s)\n" ,w,h,d_w,d_h,fullscreen,title,vo_format_name(dest_fourcc)); - retval = priv.video_out->config_vo(vo,w,h,d_w,d_h,title,dest_fourcc); + retval = priv.vo_iface->configure(w,h,d_w,d_h,fullscreen,title,dest_fourcc); priv.srcFourcc=format; if(retval == MPXP_Ok) { int dri_retv; - dri_retv = priv.video_out->control_vo(vo,DRI_GET_SURFACE_CAPS,&priv.dri.cap); + dri_retv = priv.vo_iface->ctrl(DRI_GET_SURFACE_CAPS,&priv.dri.cap); priv.image_format = format; priv.image_width = w; priv.image_height = h; @@ -460,13 +465,12 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); uint32_t dri_forced_fourcc; - MPXP_Rc retval; vo_query_fourcc_t qfourcc; MSG_DBG3("dri_vo_dbg: vo_query_format(%08lX)\n",*fourcc); qfourcc.fourcc = *fourcc; qfourcc.w = src_w; qfourcc.h = src_h; - if(priv.video_out->control_vo(vo,VOCTRL_QUERY_FORMAT,&qfourcc)==MPXP_False) + if(priv.vo_iface->ctrl(VOCTRL_QUERY_FORMAT,&qfourcc)==MPXP_False) qfourcc.flags=VOCAP_NA; MSG_V("dri_vo: request for %s fourcc: %i\n",vo_format_name(*fourcc),qfourcc.flags); dri_forced_fourcc = *fourcc; @@ -477,7 +481,7 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_reset\n"); - return priv.video_out->control_vo(vo,VOCTRL_RESET,NULL); + return priv.vo_iface->ctrl(VOCTRL_RESET,NULL); } MPXP_Rc vo_screenshot(vo_data_t*vo,unsigned idx ) @@ -493,14 +497,14 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_pause\n"); - return priv.video_out->control_vo(vo,VOCTRL_PAUSE,0); + return priv.vo_iface->ctrl(VOCTRL_PAUSE,0); } MPXP_Rc vo_resume(vo_data_t*vo) { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_resume\n"); - return priv.video_out->control_vo(vo,VOCTRL_RESUME,0); + return priv.vo_iface->ctrl(VOCTRL_RESUME,0); } void vo_lock_surfaces(vo_data_t*vo) { @@ -572,7 +576,7 @@ else return MPXP_False; } -static int __FASTCALL__ adjust_size(any_t*vo,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) +static int __FASTCALL__ adjust_size(const any_t*vo,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) { vo_priv_t& priv=*static_cast<vo_priv_t*>(((vo_data_t*)vo)->vo_priv); MSG_DBG3("dri_vo_dbg: adjust_size was called %u %u %u %u\n",cw,ch,*nw,*nh); @@ -606,8 +610,9 @@ vo_resize_t vrest; MSG_DBG3("dri_vo_dbg: vo_check_events\n"); vrest.event_type = 0; + vrest.vo = vo; vrest.adjust_size = adjust_size; - retval = priv.video_out->control_vo(vo,VOCTRL_CHECK_EVENTS,&vrest); + retval = priv.vo_iface->ctrl(VOCTRL_CHECK_EVENTS,&vrest); /* it's ok since accelerated drivers doesn't touch surfaces but there is only one driver (vo_x11) which changes surfaces on 'fullscreen' key */ @@ -627,7 +632,7 @@ MPXP_Rc retval; MSG_DBG3("dri_vo_dbg: vo_fullscreen\n"); etype = 0; - retval = priv.video_out->control_vo(vo,VOCTRL_FULLSCREEN,&etype); + retval = priv.vo_iface->ctrl(VOCTRL_FULLSCREEN,&etype); if(priv.dri.has_dri && retval == MPXP_True && (etype & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) dri_reconfig(vo,etype); if(retval == MPXP_True) priv.dri.flags ^= VOFLG_FS; @@ -678,7 +683,7 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG2("dri_vo_dbg: vo_select_frame(play_idx=%u)\n",play_idx); - priv.video_out->select_frame(vo,play_idx); + priv.vo_iface->select_frame(play_idx); } void vo_flush_page(vo_data_t*vo,unsigned decoder_idx) @@ -687,7 +692,7 @@ MSG_DBG3("dri_vo_dbg: vo_flush_pages [idx=%u]\n",decoder_idx); priv.frame_counter++; if((priv.dri.cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) - priv.video_out->control_vo(vo,VOCTRL_FLUSH_PAGES,&decoder_idx); + priv.vo_iface->ctrl(VOCTRL_FLUSH_PAGES,&decoder_idx); } /* DRAW OSD */ @@ -890,7 +895,6 @@ vo_priv_t* priv=static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_uninit\n"); vo_inited--; - priv->video_out->uninit(vo); delete priv; } @@ -898,7 +902,7 @@ { MPXP_Rc rval; vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); - rval=priv.video_out->control_vo(vo,request,data); + rval=priv.vo_iface->ctrl(request,data); MSG_DBG3("dri_vo_dbg: %u=vo_control( %u, %p )\n",rval,request,data); return rval; } Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libvo/video_out.h 2012-11-26 17:02:22 UTC (rev 457) @@ -59,13 +59,16 @@ }; /** Text description of VO-driver */ -typedef struct vo_info_s +class VO_Interface; +typedef VO_Interface* (*query_interface_t)(const char* args); +struct vo_info_t { - const char *name; /**< driver name ("Matrox Millennium G200/G400") */ - const char *short_name; /**< short name (for config strings) ("mga") */ - const char *author; /**< author ("Aaron Holtzman <aho...@es...>") */ - const char *comment; /**< any additional comments */ -} vo_info_t; + const char* name; /**< driver name ("Matrox Millennium G200/G400") */ + const char* short_name; /**< short name (for config strings) ("mga") */ + const char* author; /**< author ("Aaron Holtzman <aho...@es...>") */ + const char* comment;/**< any additional comments */ + query_interface_t query_interface; +}; enum { VOCAP_NA=0x00, @@ -81,22 +84,7 @@ unsigned flags; /**< Flags for this fourcc VOCAP_* */ }vo_query_fourcc_t; -/** Notification event when windowed output has been resized (as data of VOCTRL_CHECK_EVENT) */ -typedef int (*__FASTCALL__ vo_adjust_size_t)(any_t*,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh); -typedef struct vo_resize_s -{ - uint32_t event_type; /**< X11 event type */ - /** callback to adjust size of window keeping aspect ratio - * @param cw current window width - * @param ch current window height - * @param nw storage for new width to be stored current window width - * @param nh storage for new height to be stored current window width - * @return 0 if fail !0 if success - **/ - vo_adjust_size_t adjust_size; -}vo_resize_t; - /** Named video equalizer */ typedef struct vo_videq_s { @@ -174,7 +162,6 @@ video_private* vo_priv;/* private data of vo structure */ video_private* priv; /* private data of video driver */ - video_private* priv3; /* private data of vidix commons */ /* subtitle support */ char* osd_text; @@ -200,61 +187,30 @@ static inline void vo_FLIP_UNSET(vo_data_t*vo) { vo->flags&=~VOFLAG_FLIPPING; } static inline void vo_FLIP_REVERT(vo_data_t*vo){ vo->flags^=VOFLAG_FLIPPING; } -typedef MPXP_Rc (* __FASTCALL__ vo_control_t)(vo_data_t* vo,uint32_t request, any_t*data); -typedef void (* __FASTCALL__ vo_select_frame_t)(vo_data_t* vo,unsigned idx); -/** VO-driver interface */ -typedef struct vo_functions_s +/** Notification event when windowed output has been resized (as data of VOCTRL_CHECK_EVENT) */ +typedef int (*__FASTCALL__ vo_adjust_size_t)(const any_t*,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh); +typedef struct vo_resize_s { - /** Preinitializes driver (real INITIALIZATION) - * @param arg currently it's vo_subdevice - * @return MPXP_Ok on successful initialization. - **/ - MPXP_Rc (* __FASTCALL__ preinit)(vo_data_t* vo,const char *arg); + uint32_t event_type; /**< X11 event type */ - /** Initializes (means CONFIGURE) the display driver. - * @param width width of source image - * @param height height of source image - * @param d_width width of destinition image (may require prescaling) - * @param d_height height of destinition image (may require prescaling) - * @param fullscreen flags (see VOFLAG_XXX for detail) - * @param title window title, if available - * @param format fourcc of source image - * @return zero on successful initialization, non-zero on error. - **/ - MPXP_Rc (* __FASTCALL__ config_vo)(vo_data_t* vo, - uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height,const char *title, uint32_t format); + /** callback to adjust size of window keeping aspect ratio + * @param cw current window width + * @param ch current window height + * @param nw storage for new width to be stored current window width + * @param nh storage for new height to be stored current window width + * @return 0 if fail !0 if success + **/ + vo_data_t* vo; + vo_adjust_size_t adjust_size; +}vo_resize_t; - /** Control interface - * @param request command. See VOCTRL_** for detail - * @param data data associated with command - * @return MPXP_True if success MPXP_False VO_ERROR MPXP_NA otherwise - **/ - vo_control_t control_vo; - - /** Returns driver information. - * @return read-only pointer to a vo_info_t structure. - **/ - const vo_info_t* (* __FASTCALL__ get_info)(const vo_data_t* vo); - - /** Blit/Flip buffer to the screen. Must be called after each frame! - * @param idex index of frame to be selected as active frame - **/ - vo_select_frame_t select_frame; - - /** Closes driver. Should restore the original state of the system. - **/ - void (* __FASTCALL__ uninit)(vo_data_t* vo); - -} vo_functions_t; - /****************************************************** * High level VO functions to provide some abstraction * * level for video out library * \*****************************************************/ extern vo_data_t* __FASTCALL__ vo_preinit_structs( void ); extern void vo_print_help(vo_data_t*); -extern const vo_functions_t * vo_register(vo_data_t* vo,const char *driver_name); +extern MPXP_Rc vo_register(vo_data_t* vo,const char *driver_name); extern const vo_info_t* vo_get_info(vo_data_t* vo); extern MPXP_Rc __FASTCALL__ vo_init(vo_data_t* vo,const char *subdevice_name); extern MPXP_Rc __FASTCALL__ vo_config(vo_data_t* vo,uint32_t width, uint32_t height, uint32_t d_width, Modified: mplayerxp/libvo/video_out_internal.h =================================================================== --- mplayerxp/libvo/video_out_internal.h 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libvo/video_out_internal.h 2012-11-26 17:02:22 UTC (rev 457) @@ -22,23 +22,21 @@ */ #ifndef __VIDEO_OUT_INTERNAL_H #define __VIDEO_OUT_INTERNAL_H 1 -static MPXP_Rc __FASTCALL__ control_vo(vo_data_t*vo,uint32_t request, any_t*data); -static MPXP_Rc __FASTCALL__ config_vo(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height, const char *title, - uint32_t format); -static const vo_info_t* __FASTCALL__ get_info(const vo_data_t*vo); -static void __FASTCALL__ select_frame(vo_data_t*vo,unsigned idx); -static void __FASTCALL__ uninit(vo_data_t*vo); -static MPXP_Rc __FASTCALL__ preinit(vo_data_t*vo,const char *); -#define LIBVO_EXTERN(x) extern const vo_functions_t video_out_##x =\ -{\ - preinit,\ - config_vo,\ - control_vo,\ - get_info,\ - select_frame,\ - uninit\ +class VO_Interface : public Opaque { + public: + VO_Interface(const char *args) { UNUSED(args); }; + virtual ~VO_Interface() {}; + + virtual MPXP_Rc configure(uint32_t width, + uint32_t height, + uint32_t d_width, + uint32_t d_height, + unsigned flags, + const char *title, + uint32_t format) = 0; + virtual void select_frame(unsigned idx) = 0; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data) = 0; }; #include "osd.h" Modified: mplayerxp/libvo/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo/vo_fbdev.cpp 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libvo/vo_fbdev.cpp 2012-11-26 17:02:22 UTC (rev 457) @@ -39,19 +39,40 @@ #include "libmpstream/mrl.h" #include "vo_msg.h" -LIBVO_EXTERN(fbdev) +#define PRINT_LINENUM //MSG_DBG2(" at line %d\n", line_num) -static vo_info_t vo_info = { - "Framebuffer Device" -#ifdef CONFIG_VIDIX - " (with fbdev:vidix subdevice)" -#endif - , - "fbdev", - "Szabolcs Berecz <sz...@in...>", - "" +#define MAX_NR_TOKEN 16 + +#define MAX_LINE_LEN 1000 + +#define RET_EOF -1 +#define RET_EOL -2 + +struct priv_conf_t { + priv_conf_t(); + ~priv_conf_t() {} +/* command line/config file options */ + char* dev_name; + const char* mode_cfgfile; + char* mode_name; + const char* monitor_hfreq_str; + const char* monitor_vfreq_str; + const char* monitor_dotclock_str; }; +static priv_conf_t priv_conf; +priv_conf_t::priv_conf_t() { + mode_cfgfile = "/etc/priv.modes"; +} +static const mrl_config_t fbconf[]= +{ + { "modeconfig", &priv_conf.mode_cfgfile, MRL_TYPE_STRING, 0, 0 }, + { "hfreq", &priv_conf.monitor_hfreq_str, MRL_TYPE_STRING, 0, 0 }, + { "vfreq", &priv_conf.monitor_vfreq_str, MRL_TYPE_STRING, 0, 0 }, + { "dotclock", &priv_conf.monitor_dotclock_str, MRL_TYPE_STRING, 0, 0 }, + { NULL, NULL, 0, 0, 0 }, +}; + /****************************** * fb.modes support * ******************************/ @@ -64,15 +85,6 @@ uint32_t vmode; } fb_mode_t; -#define PRINT_LINENUM //MSG_DBG2(" at line %d\n", line_num) - -#define MAX_NR_TOKEN 16 - -#define MAX_LINE_LEN 1000 - -#define RET_EOF -1 -#define RET_EOL -2 - static int __FASTCALL__ validate_mode(fb_mode_t *m) { if (!m->xres) { @@ -94,84 +106,210 @@ float max; } range_t; -struct fbdev_priv_t : public video_private { - fbdev_priv_t(); - virtual ~fbdev_priv_t() {} - FILE * fp; - int line_num; - char * line; - char * token[MAX_NR_TOKEN]; - uint32_t srcFourcc,dstFourcc; +class FBDev_VO_Interface : public VO_Interface { + public: + FBDev_VO_Interface(const char* args); + virtual ~FBDev_VO_Interface(); + + virtual MPXP_Rc configure(uint32_t width, + uint32_t height, + uint32_t d_width, + uint32_t d_height, + unsigned flags, + const char *title, + uint32_t format); + virtual void select_frame(unsigned idx); + virtual MPXP_Rc ctrl(uint32_t request, any_t*data); + private: + MPXP_Rc fb_preinit(); + uint32_t parse_sub_device(const char *sd); + int parse_fbmode_cfg(const char *cfgfile); + int get_token(int num); + void vt_set_textarea(int u, int l); + void lots_of_printf() const; + + void dri_get_surface_caps(dri_surface_cap_t *caps) const; + void dri_get_surface(dri_surface_t *surf) const; + MPXP_Rc query_format(vo_query_fourcc_t* format) const; + + FILE * fp; + int line_num; + char * line; + char * token[MAX_NR_TOKEN]; + uint32_t srcFourcc,dstFourcc; + unsigned flags; /* fb.modes related variables */ - range_t * monitor_hfreq; - range_t * monitor_vfreq; - range_t * monitor_dotclock; - fb_mode_t * mode; + range_t * monitor_hfreq; + range_t * monitor_vfreq; + range_t * monitor_dotclock; + fb_mode_t * mode; /* vt related variables */ - int vt_fd; - FILE * vt_fp; - int vt_doit; + int vt_fd; + FILE * vt_fp; + int vt_doit; /* vo_fbdev related variables */ - int dev_fd; - int tty_fd; - size_t size; - uint8_t * frame_buffer; - uint8_t * L123123875; /* thx .so :) */ - struct fb_fix_screeninfo finfo; - struct fb_var_screeninfo orig_vinfo; - struct fb_var_screeninfo vinfo; - struct fb_cmap oldcmap; - int cmap_changed; - unsigned pixel_size; // 32: 4 24: 3 16: 2 15: 2 - uint32_t pixel_format; - unsigned real_bpp; // 32: 24 24: 24 16: 16 15: 15 - unsigned bpp; // 32: 32 24: 24 16: 16 15: 15 - unsigned bpp_we_want; // 32: 32 24: 24 16: 16 15: 15 - unsigned line_len; - unsigned xres; - unsigned yres; + int dev_fd; + int tty_fd; + size_t size; + uint8_t * frame_buffer; + uint8_t * L123123875; /* thx .so :) */ + struct fb_fix_screeninfo finfo; + struct fb_var_screeninfo orig_vinfo; + struct fb_var_screeninfo vinfo; + struct fb_cmap oldcmap; + int cmap_changed; + unsigned pixel_size; // 32: 4 24: 3 16: 2 15: 2 + uint32_t pixel_format; + unsigned real_bpp; // 32: 24 24: 24 16: 16 15: 15 + unsigned bpp; // 32: 32 24: 24 16: 16 15: 15 + unsigned bpp_we_want; // 32: 32 24: 24 16: 16 15: 15 + unsigned line_len; + unsigned xres; + unsigned yres; - uint8_t * next_frame[MAX_DRI_BUFFERS]; - unsigned total_fr; - int in_width; - int in_height; - unsigned out_width; - unsigned out_height; - int last_row; - int fs; - MPXP_Rc pre_init_err; + uint8_t * next_frame[MAX_DRI_BUFFERS]; + unsigned total_fr; + int in_width; + int in_height; + unsigned out_width; + unsigned out_height; + int last_row; + int fs; + MPXP_Rc pre_init_err; #ifdef CONFIG_VIDIX /* Name of VIDIX driver */ - const char* vidix_name; - vidix_server_t* vidix_server; + const char* vidix_name; + vidix_server_t* vidix_server; + vidix_priv_t* vidix; #endif + int fb_preinit_done; + MPXP_Rc fb_works; }; -fbdev_priv_t::fbdev_priv_t() { +uint32_t FBDev_VO_Interface::parse_sub_device(const char *sd) +{ + const char *param; +#ifdef CONFIG_VIDIX + if(memcmp(sd,"vidix",5) == 0) vidix_name = &sd[5]; /* vidix_name will be valid within init() */ + else +#endif + { + param=mrl_parse_line(sd,NULL,NULL,&priv_conf.dev_name,&priv_conf.mode_name); + mrl_parse_params(param,fbconf); + } + return 0; +} + +MPXP_Rc FBDev_VO_Interface::fb_preinit() +{ + fb_preinit_done = 0; + fb_works = MPXP_Ok; vt_doit = 1; - pre_init_err = MPXP_Ok; + + if (fb_preinit_done) return fb_works; + + if (!priv_conf.dev_name && !(priv_conf.dev_name = getenv("FRAMEBUFFER"))) + priv_conf.dev_name = (char *)"/dev/fb0"; + MSG_DBG2(FBDEV "using %s\n", priv_conf.dev_name); + + if ((dev_fd = open(priv_conf.dev_name, O_RDWR)) == -1) { + MSG_ERR(FBDEV "Can't open %s: %s\n", priv_conf.dev_name, strerror(errno)); + goto err_out; + } + if (ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo)) { + MSG_ERR(FBDEV "Can't get VSCREENINFO: %s\n", strerror(errno)); + goto err_out_fd; + } + orig_vinfo = vinfo; + + if ((tty_fd = open("/dev/tty", O_RDWR)) < 0) { + MSG_DBG2(FBDEV "notice: Can't open /dev/tty: %s\n", strerror(errno)); + } + + bpp = vinfo.bits_per_pixel; + + if (bpp == 8 && !vo_conf.dbpp) { + MSG_ERR(FBDEV "8 bpp output is not supported.\n"); + goto err_out_tty_fd; + } + + /* 16 and 15 bpp is reported as 16 bpp */ + if (bpp == 16) + bpp = vinfo.red.length + vinfo.green.length + vinfo.blue.length; + + if (vo_conf.dbpp) { + if (vo_conf.dbpp != 15 && vo_conf.dbpp != 16 && vo_conf.dbpp != 24 && vo_conf.dbpp != 32) { + MSG_ERR(FBDEV "can't switch to %d bpp\n", vo_conf.dbpp); + goto err_out_fd; + } + bpp = vo_conf.dbpp; + } + + fb_preinit_done = 1; + fb_works = MPXP_Ok; + return MPXP_Ok; +err_out_tty_fd: + close(tty_fd); + tty_fd = -1; +err_out_fd: + close(dev_fd); + dev_fd = -1; +err_out: + fb_preinit_done = 1; + fb_works = MPXP_False; + return MPXP_False; } -struct priv_conf_t { - priv_conf_t(); - ~priv_conf_t() {} -/* command line/config file options */ - char* dev_name; - const char* mode_cfgfile; - char* mode_name; - const char* monitor_hfreq_str; - const char* monitor_vfreq_str; - const char* monitor_dotclock_str; -}; -static priv_conf_t priv_conf; -priv_conf_t::priv_conf_t() { - mode_cfgfile = "/etc/priv.modes"; +FBDev_VO_Interface::~FBDev_VO_Interface() +{ + unsigned i; + MSG_V(FBDEV "uninit\n"); + if (cmap_changed) { + if (ioctl(dev_fd, FBIOPUTCMAP, &oldcmap)) + MSG_ERR(FBDEV "Can't restore original cmap\n"); + cmap_changed = 0; + } + for(i=0;i<total_fr;i++) delete next_frame[i]; + if (ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo)) + MSG_ERR(FBDEV "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); + orig_vinfo.xoffset = vinfo.xoffset; + orig_vinfo.yoffset = vinfo.yoffset; + if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &orig_vinfo)) + MSG_ERR(FBDEV "Can't reset original fb_var_screeninfo: %s\n", strerror(errno)); + if (tty_fd >= 0) { + if (ioctl(tty_fd, KDSETMODE, KD_TEXT) < 0) + MSG_ERR(FBDEV "Can't restore text mode: %s\n", strerror(errno)); + } + if (vt_doit) vt_set_textarea(0, orig_vinfo.yres); + close(tty_fd); + close(dev_fd); + if(frame_buffer) munmap(frame_buffer,size); +#ifdef CONFIG_VIDIX + if(vidix_name) vidix_term(vidix); + delete vidix_server; + delete vidix; +#endif } -static int __FASTCALL__ get_token(vo_data_t*vo,int num) +FBDev_VO_Interface::FBDev_VO_Interface(const char *arg) + :VO_Interface(arg) { - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); + if(arg) parse_sub_device(arg); +#ifdef CONFIG_VIDIX + if(vidix_name) { + vidix=vidix_preinit(vidix_name); + if(!(vidix_server=vidix_get_server(vidix))) { + MSG_ERR("Cannot initialze vidix with '%s' argument\n",vidix_name); + exit_player("Vidix error"); + } + } +#endif + if(fb_preinit()!=MPXP_Ok) exit_player("FBDev preinit"); +} + +int FBDev_VO_Interface::get_token(int num) +{ static int read_nextline = 1; static int line_pos; int i; @@ -183,33 +321,33 @@ } if (read_nextline) { - if (!fgets(priv.line, MAX_LINE_LEN, priv.fp)) goto out_eof; + if (!fgets(line, MAX_LINE_LEN, fp)) goto out_eof; line_pos = 0; - ++priv.line_num; + ++line_num; read_nextline = 0; } for (i = 0; i < num; i++) { - while (isspace(priv.line[line_pos])) ++line_pos; - if (priv.line[line_pos] == '\0' || priv.line[line_pos] == '#') { + while (isspace(line[line_pos])) ++line_pos; + if (line[line_pos] == '\0' || line[line_pos] == '#') { read_nextline = 1; goto out_eol; } - priv.token[i] = priv.line + line_pos; - c = priv.line[line_pos]; + token[i] = line + line_pos; + c = line[line_pos]; if (c == '"' || c == '\'') { - priv.token[i]++; - while (priv.line[++line_pos] != c && priv.line[line_pos]) /* NOTHING */; - if (!priv.line[line_pos]) goto out_eol; - priv.line[line_pos] = ' '; + token[i]++; + while (line[++line_pos] != c && line[line_pos]) /* NOTHING */; + if (!line[line_pos]) goto out_eol; + line[line_pos] = ' '; } else { - for (/* NOTHING */; !isspace(priv.line[line_pos]) && priv.line[line_pos]; line_pos++) /* NOTHING */; + for (/* NOTHING */; !isspace(line[line_pos]) && line[line_pos]; line_pos++) /* NOTHING */; } - if (!priv.line[line_pos]) { + if (!line[line_pos]) { read_nextline = 1; if (i == num - 1) goto out_ok; goto out_eol; } - priv.line[line_pos++] = '\0'; + line[line_pos++] = '\0'; } out_ok: return i; @@ -222,9 +360,8 @@ static fb_mode_t *fb_modes = NULL; static int nr_modes = 0; -static int __FASTCALL__ parse_fbmode_cfg(vo_data_t*vo,const char *cfgfile) +int FBDev_VO_Interface::parse_fbmode_cfg(const char *cfgfile) { - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); #define CHECK_IN_MODE_DEF\ do {\ if (!in_mode_def) {\ @@ -233,39 +370,39 @@ }\ } while (0) - fb_mode_t *mode = NULL; + fb_mode_t *_mode = NULL; char *endptr; // strtoul()... int in_mode_def = 0; int tmp, i; MSG_DBG2("Reading %s: ", cfgfile); - if ((priv.fp = fopen(cfgfile, "r")) == NULL) { + if ((fp = fopen(cfgfile, "r")) == NULL) { MSG_ERR("can't open '%s': %s\n", cfgfile, strerror(errno)); return -1; } - if ((priv.line = (char *) mp_malloc(MAX_LINE_LEN + 1)) == NULL) { - MSG_ERR("can't get memory for 'priv.line': %s\n", strerror(errno)); + if ((line = (char *) mp_malloc(MAX_LINE_LEN + 1)) == NULL) { + MSG_ERR("can't get memory for 'line': %s\n", strerror(errno)); return -2; } /* * check if the cfgfile starts with 'mode' */ - while ((tmp = get_token(vo,1)) == RET_EOL) /* NOTHING */; + while ((tmp = get_token(1)) == RET_EOL) /* NOTHING */; if (tmp == RET_EOF) goto out; - if (!strcmp(priv.token[0], "mode")) goto loop_enter; + if (!strcmp(token[0], "mode")) goto loop_enter; goto err_out_parse_error; - while ((tmp = get_token(vo,1)) != RET_EOF) { + while ((tmp = get_token(1)) != RET_EOF) { if (tmp == RET_EOL) continue; - if (!strcmp(priv.token[0], "mode")) { + if (!strcmp(token[0], "mode")) { if (in_mode_def) { MSG_ERR("'endmode' required"); goto err_out_print_linenum; } - if (!validate_mode(mode)) goto err_out_not_valid; + if (!validate_mode(_mode)) goto err_out_not_valid; loop_enter: if (!(fb_modes = (fb_mode_t *) mp_realloc(fb_modes, sizeof(fb_mode_t) * (nr_modes + 1)))) { @@ -273,105 +410,105 @@ " %s\n", nr_modes, strerror(errno)); goto err_out; } - mode=fb_modes + nr_modes; + _mode=fb_modes + nr_modes; ++nr_modes; - memset(mode,0,sizeof(fb_mode_t)); + memset(_mode,0,sizeof(fb_mode_t)); - if (get_token(vo,1) < 0) goto err_out_parse_error; + if (get_token(1) < 0) goto err_out_parse_error; for (i = 0; i < nr_modes - 1; i++) { - if (!strcmp(priv.token[0], fb_modes[i].name)) { - MSG_ERR("mode name '%s' isn't unique", priv.token[0]); + if (!strcmp(token[0], fb_modes[i].name)) { + MSG_ERR("mode name '%s' isn't unique", token[0]); goto err_out_print_linenum; } } - if (!(mode->name = mp_strdup(priv.token[0]))) { + if (!(_mode->name = mp_strdup(token[0]))) { MSG_ERR("can't mp_strdup -> 'name': %s\n", strerror(errno)); goto err_out; } in_mode_def = 1; - } else if (!strcmp(priv.token[0], "geometry")) { + } else if (!strcmp(token[0], "geometry")) { CHECK_IN_MODE_DEF; - if (get_token(vo,5) < 0) goto err_out_parse_error; - mode->xres = strtoul(priv.token[0], &endptr, 0); + if (get_token(5) < 0) goto err_out_parse_error; + _mode->xres = strtoul(token[0], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->yres = strtoul(priv.token[1], &endptr, 0); + _mode->yres = strtoul(token[1], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->vxres = strtoul(priv.token[2], &endptr, 0); + _mode->vxres = strtoul(token[2], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->vyres = strtoul(priv.token[3], &endptr, 0); + _mode->vyres = strtoul(token[3], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->depth = strtoul(priv.token[4], &endptr, 0); + _mode->depth = strtoul(token[4], &endptr, 0); if (*endptr) goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "timings")) { + } else if (!strcmp(token[0], "timings")) { CHECK_IN_MODE_DEF; - if (get_token(vo,7) < 0) goto err_out_parse_error; - mode->pixclock = strtoul(priv.token[0], &endptr, 0); + if (get_token(7) < 0) goto err_out_parse_error; + _mode->pixclock = strtoul(token[0], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->left = strtoul(priv.token[1], &endptr, 0); + _mode->left = strtoul(token[1], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->right = strtoul(priv.token[2], &endptr, 0); + _mode->right = strtoul(token[2], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->upper = strtoul(priv.token[3], &endptr, 0); + _mode->upper = strtoul(token[3], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->lower = strtoul(priv.token[4], &endptr, 0); + _mode->lower = strtoul(token[4], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->hslen = strtoul(priv.token[5], &endptr, 0); + _mode->hslen = strtoul(token[5], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->vslen = strtoul(priv.token[6], &endptr, 0); + _mode->vslen = strtoul(token[6], &endptr, 0); if (*endptr) goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "endmode")) { + } else if (!strcmp(token[0], "endmode")) { CHECK_IN_MODE_DEF; in_mode_def = 0; - } else if (!strcmp(priv.token[0], "accel")) { + } else if (!strcmp(token[0], "accel")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; + if (get_token(1) < 0) goto err_out_parse_error; /* * it's only used for text acceleration * so we just ignore it. */ - } else if (!strcmp(priv.token[0], "hsync")) { + } else if (!strcmp(token[0], "hsync")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "low")) mode->sync &= ~FB_SYNC_HOR_HIGH_ACT; - else if(!strcmp(priv.token[0], "high")) mode->sync |= FB_SYNC_HOR_HIGH_ACT; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_HOR_HIGH_ACT; + else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_HOR_HIGH_ACT; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "vsync")) { + } else if (!strcmp(token[0], "vsync")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "low")) mode->sync &= ~FB_SYNC_VERT_HIGH_ACT; - else if(!strcmp(priv.token[0], "high")) mode->sync |= FB_SYNC_VERT_HIGH_ACT; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_VERT_HIGH_ACT; + else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_VERT_HIGH_ACT; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "csync")) { + } else if (!strcmp(token[0], "csync")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "low")) mode->sync &= ~FB_SYNC_COMP_HIGH_ACT; - else if(!strcmp(priv.token[0], "high")) mode->sync |= FB_SYNC_COMP_HIGH_ACT; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_COMP_HIGH_ACT; + else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_COMP_HIGH_ACT; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "extsync")) { + } else if (!strcmp(token[0], "extsync")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "false")) mode->sync &= ~FB_SYNC_EXT; - else if(!strcmp(priv.token[0], "true")) mode->sync |= FB_SYNC_EXT; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "false")) _mode->sync &= ~FB_SYNC_EXT; + else if(!strcmp(token[0], "true")) _mode->sync |= FB_SYNC_EXT; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "laced")) { + } else if (!strcmp(token[0], "laced")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "false")) mode->vmode = FB_VMODE_NONINTERLACED; - else if (!strcmp(priv.token[0], "true")) mode->vmode = FB_VMODE_INTERLACED; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "false")) _mode->vmode = FB_VMODE_NONINTERLACED; + else if (!strcmp(token[0], "true")) _mode->vmode = FB_VMODE_INTERLACED; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "double")) { + } else if (!strcmp(token[0], "double")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "false")) ; - else if (!strcmp(priv.token[0], "true")) mode->vmode = FB_VMODE_DOUBLE; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "false")) ; + else if (!strcmp(token[0], "true")) _mode->vmode = FB_VMODE_DOUBLE; else goto err_out_parse_error; } else goto err_out_parse_error; } - if (!validate_mode(mode)) goto err_out_not_valid; + if (!validate_mode(_mode)) goto err_out_not_valid; out: MSG_DBG2("%d modes\n", nr_modes); - delete priv.line; - fclose(priv.fp); + delete line; + fclose(fp); return nr_modes; err_out_parse_error: MSG_ERR("parse error"); @@ -383,8 +520,8 @@ fb_modes = NULL; } nr_modes = 0; - delete priv.line; - delete priv.fp; + delete line; + delete fp; return -2; err_out_not_valid: MSG_ERR("previous mode is not correct"); @@ -674,160 +811,75 @@ return cmap; } -static const mrl_config_t fbconf[]= +void FBDev_VO_Interface::lots_of_printf() const { - { "modeconfig", &priv_conf.mode_cfgfile, MRL_TYPE_STRING, 0, 0 }, - { "hfreq", &priv_conf.monitor_hfreq_str, MRL_TYPE_STRING, 0, 0 }, - { "vfreq", &priv_conf.monitor_vfreq_str, MRL_TYPE_STRING, 0, 0 }, - { "dotclock", &priv_conf.monitor_dotclock_str, MRL_TYPE_STRING, 0, 0 }, - { NULL, NULL, 0, 0, 0 }, -}; - -static uint32_t __FASTCALL__ parseSubDevice(fbdev_priv_t* priv,const char *sd) -{ - const char *param; -#ifdef CONFIG_VIDIX - if(memcmp(sd,"vidix",5) == 0) priv->vidix_name = &sd[5]; /* vidix_name will be valid within init() */ - else -#endif - { - param=mrl_parse_line(sd,NULL,NULL,&priv_conf.dev_name,&priv_conf.mode_name); - mrl_parse_params(param,fbconf); - } - return 0; -} - -static MPXP_Rc fb_preinit(vo_data_t*vo) -{ - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); - static int fb_preinit_done = 0; - static MPXP_Rc fb_works = MPXP_Ok; - - if (fb_preinit_done) return fb_works; - - if (!priv_conf.dev_name && !(priv_conf.dev_name = getenv("FRAMEBUFFER"))) - priv_conf.dev_name = "/dev/fb0"; - MSG_DBG2(FBDEV "using %s\n", priv_conf.dev_name); - - if ((priv.dev_fd = open(priv_conf.dev_name, O_RDWR)) == -1) { - MSG_ERR(FBDEV "Can't open %s: %s\n", priv_conf.dev_name, strerror(errno)); - goto err_out; - } - if (ioctl(priv.dev_fd, FBIOGET_VSCREENINFO, &priv.vinfo)) { - MSG_ERR(FBDEV "Can't get VSCREENINFO: %s\n", strerror(errno)); - goto err_out_fd; - } - priv.orig_vinfo = priv.vinfo; - - if ((priv.tty_fd = open("/dev/tty", O_RDWR)) < 0) { - MSG_DBG2(FBDEV "notice: Can't open /dev/tty: %s\n", strerror(errno)); - } - - priv.bpp = priv.vinfo.bits_per_pixel; - - if (priv.bpp == 8 && !vo_conf.dbpp) { - MSG_ERR(FBDEV "8 bpp output is not supported.\n"); - goto err_out_tty_fd; - } - - /* 16 and 15 bpp is reported as 16 bpp */ - if (priv.bpp == 16) - priv.bpp = priv.vinfo.red.length + priv.vinfo.green.length + priv.vinfo.blue.length; - - if (vo_conf.dbpp) { - if (vo_conf.dbpp != 15 && vo_conf.dbpp != 16 && vo_conf.dbpp != 24 && vo_conf.dbpp != 32) { - MSG_ERR(FBDEV "can't switch to %d bpp\n", vo_conf.dbpp); - goto err_out_fd; - } - priv.bpp = vo_conf.dbpp; - } - - fb_preinit_done = 1; - fb_works = MPXP_Ok; - return MPXP_Ok; -err_out_tty_fd: - close(priv.tty_fd); - priv.tty_fd = -1; -err_out_fd: - close(priv.dev_fd); - priv.dev_fd = -1; -err_out: - fb_preinit_done = 1; - fb_works = MPXP_False; - return MPXP_False; -} - -static void lots_of_printf(vo_data_t*vo) -{ - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); MSG_V(FBDEV "var info:\n"); - MSG_V(FBDEV "xres: %u\n", priv.vinfo.xres); - MSG_V(FBDEV "yres: %u\n", priv.vinfo.yres); - MSG_V(FBDEV "xres_virtual: %u\n", priv.vinfo.xres_virtual); - MSG_V(FBDEV "yres_virtual: %u\n", priv.vinfo.yres_virtual); - MSG_V(FBDEV "xoffset: %u\n", priv.vinfo.xoffset); - MSG_V(FBDEV "yoffset: %u\n", priv.vinfo.yoffset); - MSG_V(FBDEV "bits_per_pixel: %u\n", priv.vinfo.bits_per_pixel); - MSG_V(FBDEV "grayscale: %u\n", priv.vinfo.grayscale); + MSG_V(FBDEV "xres: %u\n", vinfo.xres); + MSG_V(FBDEV "yres: %u\n", vinfo.yres); + MSG_V(FBDEV "xres_virtual: %u\n", vinfo.xres_virtual); + MSG_V(FBDEV "yres_virtual: %u\n", vinfo.yres_virtual); + MSG_V(FBDEV "xoffset: %u\n", vinfo.xoffset); + MSG_V(FBDEV "yoffset: %u\n", vinfo.yoffset); + MSG_V(FBDEV "bits_per_pixel: %u\n", vinfo.bits_per_pixel); + MSG_V(FBDEV "grayscale: %u\n", vinfo.grayscale); MSG_V(FBDEV "red: %lu %lu %lu\n", - (unsigned long) priv.vinfo.red.offset, - (unsigned long) priv.vinfo.red.length, - (unsigned long) priv.vinfo.red.msb_right); + (unsigned long) vinfo.red.offset, + (unsigned long) vinfo.red.length, + (unsigned long) vinfo.red.msb_right); MSG_V(FBDEV "green: %lu %lu %lu\n", - (unsigned long) priv.vinfo.green.offset, - (unsigned long) priv.vinfo.green.length, - (unsigned long) priv.vinfo.green.msb_right); + (unsigned long) vinfo.green.offset, + (unsigned long) vinfo.green.length, + (unsigned long) vinfo.green.msb_right); MSG_V(FBDEV "blue: %lu %lu %lu\n", - (unsigned long) priv.vinfo.blue.offset, - (unsigned long) priv.vinfo.blue.length, - (unsigned long) priv.vinfo.blue.msb_right); + (unsigned long) vinfo.blue.offset, + (unsigned long) vinfo.blue.length, + (unsigned long) vinfo.blue.msb_right); MSG_V(FBDEV "transp: %lu %lu %lu\n", - (unsigned long) priv.vinfo.transp.offset, - (unsigned long) priv.vinfo.transp.length, - (unsigned long) priv.vinfo.transp.msb_right); - MSG_V(FBDEV "nonstd: %u\n", priv.vinfo.nonstd); - MSG_DBG2(FBDEV "activate: %u\n", priv.vinfo.activate); - MSG_DBG2(FBDEV "height: %u\n", priv.vinfo.height); - MSG_DBG2(FBDEV "width: %u\n", priv.vinfo.width); - MSG_DBG2(FBDEV "accel_flags: %u\n", priv.vinfo.accel_flags); + (unsigned long) vinfo.transp.offset, + (unsigned long) vinfo.transp.length, + (unsigned long) vinfo.transp.msb_right); + MSG_V(FBDEV "nonstd: %u\n", vinfo.nonstd); + MSG_DBG2(FBDEV "activate: %u\n", vinfo.activate); + MSG_DBG2(FBDEV "height: %u\n", vinfo.height); + MSG_DBG2(FBDEV "width: %u\n", vinfo.width); + MSG_DBG2(FBDEV "accel_flags: %u\n", vinfo.accel_flags); MSG_DBG2(FBDEV "timing:\n"); - MSG_DBG2(FBDEV "pixclock: %u\n", priv.vinfo.pixclock); - MSG_DBG2(FBDEV "left_margin: %u\n", priv.vinfo.left_margin); - MSG_DBG2(FBDEV "right_margin: %u\n", priv.vinfo.right_margin); - MSG_DBG2(FBDEV "upper_margin: %u\n", priv.vinfo.upper_margin); - MSG_DBG2(FBDEV "lower_margin: %u\n", priv.vinfo.lower_margin); - MSG_DBG2(FBDEV "hsync_len: %u\n", priv.vinfo.hsync_len); - MSG_DBG2(FBDEV "vsync_len: %u\n", priv.vinfo.vsync_len); - MSG_DBG2(FBDEV "sync: %u\n", priv.vinfo.sync); - MSG_DBG2(FBDEV "vmode: %u\n", priv.vinfo.vmode); + MSG_DBG2(FBDEV "pixclock: %u\n", vinfo.pixclock); + MSG_DBG2(FBDEV "left_margin: %u\n", vinfo.left_margin); + MSG_DBG2(FBDEV "right_margin: %u\n", vinfo.right_margin); + MSG_DBG2(FBDEV "upper_margin: %u\n", vinfo.upper_margin); + MSG_DBG2(FBDEV "lower_margin: %u\n", vinfo.lower_margin); + MSG_DBG2(FBDEV "hsync_len: %u\n", vinfo.hsync_len); + MSG_DBG2(FBDEV "vsync_len: %u\n", vinfo.vsync_len); + MSG_DBG2(FBDEV "sync: %u\n", vinfo.sync); + MSG_DBG2(FBDEV "vmode: %u\n", vinfo.vmode); MSG_V(FBDEV "fix info:\n"); - MSG_V(FBDEV "framebuffer size: %d bytes\n", priv.finfo.smem_len); - MSG_V(FBDEV "type: %lu\n", (unsigned long) priv.finfo.type); - MSG_V(FBDEV "type_aux: %lu\n", (unsigned long) priv.finfo.type_aux); - MSG_V(FBDEV "visual: %lu\n", (unsigned long) priv.finfo.visual); - MSG_V(FBDEV "line_length: %lu bytes\n", (unsigned long) priv.finfo.line_length); - MSG_DBG2(FBDEV "id: %.16s\n", priv.finfo.id); - MSG_DBG2(FBDEV "smem_start: %p\n", (any_t*) priv.finfo.smem_start); - MSG_DBG2(FBDEV "xpanstep: %u\n", priv.finfo.xpanstep); - MSG_DBG2(FBDEV "ypanstep: %u\n", priv.finfo.ypanstep); - MSG_DBG2(FBDEV "ywrapstep: %u\n", priv.finfo.ywrapstep); - MSG_DBG2(FBDEV "mmio_start: %p\n", (any_t*) priv.finfo.mmio_start); - MSG_DBG2(FBDEV "mmio_len: %u bytes\n", priv.finfo.mmio_len); - MSG_DBG2(FBDEV "accel: %u\n", priv.finfo.accel); - MSG_V(FBDEV "priv.bpp: %d\n", priv.bpp); - MSG_V(FBDEV "priv.real_bpp: %d\n", priv.real_bpp); - MSG_V(FBDEV "priv.pixel_size: %d bytes\n", priv.pixel_size); + MSG_V(FBDEV "framebuffer size: %d bytes\n", finfo.smem_len); + MSG_V(FBDEV "type: %lu\n", (unsigned long) finfo.type); + MSG_V(FBDEV "type_aux: %lu\n", (unsigned long) finfo.type_aux); + MSG_V(FBDEV "visual: %lu\n", (unsigned long) finfo.visual); + MSG_V(FBDEV "line_length: %lu bytes\n", (unsigned long) finfo.line_length); + MSG_DBG2(FBDEV "id: %.16s\n", finfo.id); + MSG_DBG2(FBDEV "smem_start: %p\n", (any_t*) finfo.smem_start); + MSG_DBG2(FBDEV "xpanstep: %u\n", finfo.xpanstep); + MSG_DBG2(FBDEV "ypanstep: %u\n", finfo.ypanstep); + MSG_DBG2(FBDEV "ywrapstep: %u\n", finfo.ywrapstep); + MSG_DBG2(FBDEV "mmio_start: %p\n", (any_t*) finfo.mmio_start); + MSG_DBG2(FBDEV "mmio_len: %u bytes\n", finfo.mmio_len); + MSG_DBG2(FBDEV "accel: %u\n", finfo.accel); + MSG_V(FBDEV "priv.bpp: %d\n", bpp); + MSG_V(FBDEV "priv.real_bpp: %d\n", real_bpp); + MSG_V(FBDEV "priv.pixel_size: %d bytes\n",pixel_size); MSG_V(FBDEV "other:\n"); - MSG_V(FBDEV "priv.in_width: %d\n", priv.in_width); - MSG_V(FBDEV "priv.in_height: %d\n", priv.in_height); - MSG_V(FBDEV "priv.out_width: %d\n", priv.out_width); - MSG_V(FBDEV "priv.out_height: %d\n", priv.out_height); - MSG_V(FBDEV "priv.last_row: %d\n", priv.last_row); + MSG_V(FBDEV "priv.in_width: %d\n", in_width); + MSG_V(FBDEV "priv.in_height: %d\n", in_height); + MSG_V(FBDEV "priv.out_width: %d\n", out_width); + MSG_V(FBDEV "priv.out_height: %d\n", out_height); + MSG_V(FBDEV "priv.last_row: %d\n", last_row); } -static void __FASTCALL__ vt_set_textarea(vo_data_t*vo,int u, int l) +void FBDev_VO_Interface::vt_set_textarea(int u, int l) { - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); /* how can I determine the font height? * just use 16 for now */ @@ -836,364 +888,318 @@ if (mp_conf.verbose > 1) MSG_DBG2(FBDEV "vt_set_textarea(%d,%d): %d,%d\n", u, l, urow, lrow); - fprintf(priv.vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); - fflush(priv.vt_fp); + fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); + fflush(vt_fp); } -static MPXP_Rc __FASTCALL__ config_vo(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height, const char *title, +MPXP_Rc FBDev_VO_Interface::configure(uint32_t width, uint32_t height, uint32_t d_width, + uint32_t d_height, unsigned _flags, const char *title, uint32_t format) { - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); struct fb_cmap *cmap; unsigned x_offset,y_offset,i; + flags=_flags; UNUSED(title); - priv.srcFourcc = format; - if((int)priv.pre_init_err == MPXP_Error) { + srcFourcc = format; + if((int)pre_init_err == MPXP_Error) { MSG_ERR(FBDEV "Internal fatal error: init() was called before preinit()\n"); return MPXP_False; } - if (priv.pre_init_err!=MPXP_Ok) return MPXP_False; + if (pre_init_err!=MPXP_Ok) return MPXP_False; - if (priv_conf.mode_name && !vo_VM(vo)) { + if (priv_conf.mode_name && !flags&VOFLAG_MODESWITCHING) { MSG_ERR(FBDEV "-fbmode can only be used with -vm\n"); return MPXP_False; } - if (vo_VM(vo) && (parse_fbmode_cfg(vo,priv_conf.mode_cfgfile) < 0)) return MPXP_False; - if (d_width && (vo_ZOOM(vo) || vo_VM(vo))) { - priv.out_width = d_width; - priv.out_height = d_height; + if ((flags&VOFLAG_MODESWITCHING) && (parse_fbmode_cfg(priv_conf.mode_cfgfile) < 0)) return MPXP_False; + if (d_width && ((flags&VOFLAG_SWSCALE) || (flags&VOFLAG_MODESWITCHING))) { + out_width = d_width; + out_height = d_height; } else { - priv.out_width = width; - priv.out_height = height; + out_width = width; + out_height = height; } - priv.in_width = width; - priv.in_height = height; - priv.pixel_format = format; + in_width = width; + in_height = height; + pixel_format = format; if (priv_conf.mode_name) { - if (!(priv.mode = find_mode_by_name(priv_conf.mode_name))) { + if (!(mode = find_mode_by_name(priv_conf.mode_name))) { MSG_ERR(FBDEV "can't find requested video mode\n"); return MPXP_False; } - fb_mode2fb_vinfo(priv.mode, &priv.vinfo); - } else if (vo_VM(vo)) { - priv.monitor_hfreq = str2range(priv_conf.monitor_hfreq_str); - priv.monitor_vfreq = str2range(priv_conf.monitor_vfreq_str); - priv.monitor_dotclock = str2range(priv_conf.monitor_dotclock_str); - if (!priv.monitor_hfreq || !priv.monitor_vfreq || !priv.monitor_dotclock) { + fb_mode2fb_vinfo(mode, &vinfo); + } else if (flags&VOFLAG_MODESWITCHING) { + monitor_hfreq = str2range(priv_conf.monitor_hfreq_str); + monitor_vfreq = str2range(priv_conf.monitor_vfreq_str); + monitor_dotclock = str2range(priv_conf.monitor_dotclock_str); + if (!monitor_hfreq || !monitor_vfreq || !monitor_dotclock) { MSG_ERR(FBDEV "you have to specify the capabilities of" " the monitor.\n"); return MPXP_False; } - if (!(priv.mode = find_best_mode(priv.out_width, priv.out_height, - priv.monitor_hfreq, priv.monitor_vfreq, - priv.monitor_dotclock))) { + if (!(mode = find_best_mode(out_width, out_height, + monitor_hfreq, monitor_vfreq, + monitor_dotclock))) { MSG_ERR(FBDEV "can't find best video mode\n"); return MPXP_False; } - MSG_ERR(FBDEV "using mode %dx%d @ %.1fHz\n", priv.mode->xres, - priv.mode->yres, vsf(priv.mode)); - fb_mode2fb_vinfo(priv.mode, &priv.vinfo); + MSG_ERR(FBDEV "using mode %dx%d @ %.1fHz\n", mode->xres, + mode->yres, vsf(mode)); + fb_mode2fb_vinfo(mode, &vinfo); } - priv.bpp_we_want = priv.bpp; - set_bpp(&priv.vinfo, priv.bpp); - priv.vinfo.xres_virtual = priv.vinfo.xres; - priv.vinfo.yres_virtual = priv.vinfo.yres; + bpp_we_want = bpp; + set_bpp(&vinfo, bpp); + vinfo.xres_virtual = vinfo.xres; + vinfo.yres_virtual = vinfo.yres; - if (priv.tty_fd >= 0 && ioctl(priv.tty_fd, KDSETMODE, KD_GRAPHICS) < 0) { + if (tty_fd >= 0 && ioctl(tty_fd, KDSETMODE, KD_GRAPHICS) < 0) { MSG_DBG2(FBDEV "Can't set graphics mode: %s\n", strerror(errno)); - close(priv.tty_fd); - priv.tty_fd = -1; + close(tty_fd); + tty_fd = -1; } - if (ioctl(priv.dev_fd, FBIOPUT_VSCREENINFO, &priv.vinfo)) { + if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &vinfo)) { MSG_ERR(FBDEV "Can't put VSCREENINFO: %s\n", strerror(errno)); - if (priv.tty_fd >= 0 && ioctl(priv.tty_fd, KDSETMODE, KD_TEXT) < 0) { + if (tty_fd >= 0 && ioctl(tty_fd, KDSETMODE, KD_TEXT) < 0) { MSG_ERR(FBDEV "Can't restore text mode: %s\n", strerror(errno)); } return MPXP_False; } - priv.pixel_size = (priv.vinfo.bits_per_pixel+7) / 8; - priv.real_bpp = priv.vinfo.red.length + priv.vinfo.green.length + - priv.vinfo.blue.length; - priv.bpp = (priv.pixel_size == 4) ? 32 : priv.real_bpp; - if (priv.bpp_we_want != priv.bpp) + pixel_size = (vinfo.bits_per_pixel+7) / 8; + real_bpp = vinfo.red.length + vinfo.green.length + + vinfo.blue.length; + bpp = (pixel_size == 4) ? 32 : real_bpp; + if (bpp_we_want != bpp) MSG_ERR(FBDEV "requested %d bpp, got %d bpp!!!\n", - priv.bpp_we_want, priv.bpp); + bpp_we_want, bpp); - switch (priv.bpp) { + switch (bpp) { case 32: - priv.dstFourcc = IMGFMT_BGR32; + dstFourcc = IMGFMT_BGR32; break; case 24: - priv.dstFourcc = IMGFMT_BGR24; + dstFourcc = IMGFMT_BGR24; break; default: case 16: - priv.dstFourcc = IMGFMT_BGR16; + dstFourcc = IMGFMT_BGR16; break; case 15: - priv.dstFourcc = IMGFMT_BGR15; + dstFourcc = IMGFMT_BGR15; break; } - if (vo_FLIP(vo) && ((((priv.pixel_format & 0xff) + 7) / 8) != priv.pixel_size)) { + if ((flags&VOFLAG_FLIPPING) && ((((pixel_format & 0xff) + 7) / 8) != pixel_size)) { MSG_ERR(FBDEV "Flipped output with depth conversion is not " "supported\n"); return MPXP_False; } - priv.xres = priv.vinfo.xres; - priv.yres = priv.vinfo.yres; - priv.last_row = (priv.xres-priv.out_height) / 2; + xres = vinfo.xres; + yres = vinfo.yres; + last_row = (xres-out_height) / 2; - if (ioctl(priv.dev_fd, FBIOGET_FSCREENINFO, &priv.finfo)) { + if (ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo)) { MSG_ERR(FBDEV "Can't get FSCREENINFO: %s\n", strerror(errno)); return MPXP_False; } - lots_of_printf(vo); + lots_of_printf(); - if (priv.finfo.type != FB_TYPE_PACKED_PIXELS) { - MSG_ERR(FBDEV "type %d not supported\n", priv.finfo.type); + if (finfo.type != FB_TYPE_PACKED_PIXELS) { + MSG_ERR(FBDEV "type %d not supported\n", finfo.type); return MPXP_False; } - switch (priv.finfo.visual) { + switch (finfo.visual) { case FB_VISUAL_TRUECOLOR: break; case FB_VISUAL_DIRECTCOLOR: MSG_DBG2(FBDEV "creating cmap for directcolor\n"); - if (ioctl(priv.dev_fd, FBIOGETCMAP, &priv.oldcmap)) { + if (ioctl(dev_fd, FBIOGETCMAP, &oldcmap)) { MSG_ERR(FBDEV "can't get cmap: %s\n",strerror(errno)); return MPXP_False; } - if (!(cmap = make_directcolor_cmap(&priv.vinfo))) return MPXP_False; - if (ioctl(priv.dev_fd, FBIOPUTCMAP, cmap)) { + if (!(cmap = make_directcolor_cmap(&vinfo))) return MPXP_False; + if (ioctl(dev_fd, FBIOPUTCMAP, cmap)) { MSG_ERR(FBDEV "can't put cmap: %s\n",strerror(errno)); return MPXP_False; } - priv.cmap_changed = 1; + cmap_changed = 1; delete cmap->red; delete cmap->green; delete cmap->blue; delete cmap; break; default: - MSG_ERR(FBDEV "visual: %d not yet supported\n",priv.finfo.visual); + MSG_ERR(FBDEV "visual: %d not yet supported\n",finfo.visual); return MPXP_False; } - priv.line_len = priv.finfo.line_length; - priv.size = priv.finfo.smem_len; - priv.frame_buffer = NULL; - memset(priv.next_frame,0,sizeof(priv.next_frame)); - priv.out_width=width; - priv.out_height=height; - if(vo_ZOOM(vo)) { + line_len = finfo.line_length; + size = finfo.smem_len; + frame_buffer = NULL; + memset(next_frame,0,sizeof(next_frame)); + out_width=width; + out_height=height; + if(flags&VOFLAG_SWSCALE) { aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); - aspect_save_screenres(priv.xres,priv.yres); - aspect(&priv.out_width,&priv.out_height,A_ZOOM); - } else if(vo_FS(vo)) { - priv.out_width = priv.xres; - priv.out_height = priv.yres; + aspect_save_screenres(xres,yres); + aspect(&out_width,&out_height,A_ZOOM); + } else if(flags&VOFLAG_FULLSCREEN) { + out_width = xres; + out_height = yres; } - if(priv.xres > priv.out_width) - x_offset = (priv.xres - priv.out_width) / 2; + if(xres > out_width) + x_offset = (xres - out_width) / 2; else x_offset = 0; - if(priv.yres > priv.out_height) - y_offset = (priv.yres - priv.out_height) / 2; + if(yres > out_height) + y_offset = (yres - out_height) / 2; else y_offset = 0; #ifdef CONFIG_VIDIX - if(priv.vidix_name) { - if(vidix_init(vo,width,height,x_offset,y_offset,priv.out_width, - priv.out_height,format,priv.bpp, - priv.xres,priv.yres) != MPXP_Ok) { + if(vidix_name) { + if(vidix_init(vidix,width,height,x_offset,y_offset,out_width, + out_height,format,bpp, + xres,yres) != MPXP_Ok) { MSG_ERR(FBDEV "Can't initialize VIDIX driver\n"); - priv.vidix_name = NULL; - vidix_term(vo); + vidix_name = NULL; + vidix_term(vidix); return MPXP_False; } else MSG_V(FBDEV "Using VIDIX\n"); - if ((priv.frame_buffer = (uint8_t *) mmap(0, priv.size, PROT_READ | PROT_WRITE, - MAP_SHARED, priv.dev_fd, 0)) == (uint8_t *) -1) { + if ((frame_buffer = (uint8_t *) mmap(0, size, PROT_READ | PROT_WRITE, + MAP_SHARED, dev_fd, 0)) == (uint8_t *) -1) { MSG_ERR(FBDEV "Can't mmap %s: %s\n", priv_conf.dev_name, strerror(errno)); return MPXP_False; } - memset(priv.frame_buffer, 0, priv.line_len * priv.yres); - if(vidix_start(vo)!=0) { vidix_term(vo); return MPXP_False; } + memset(frame_buffer, 0, line_len * yres); + if(vidix_start(vidix)!=0) { vidix_term(vidix); return MPXP_False; } } else #endif { - if ((priv.frame_buffer = (uint8_t *) mmap(0, priv.size, PROT_READ | PROT_WRITE, - MAP_SHARED, priv.dev_fd, 0)) == (uint8_t *) -1) { + if ((frame_buffer = (uint8_t *) mmap(0, size, PROT_READ | PROT_WRITE, + MAP_SHARED, dev_fd, 0)) == (uint8_t *) -1) { MSG_ERR(FBDEV "Can't mmap %s: %s\n", priv_conf.dev_name, strerror(errno)); return MPXP_False; } - if(priv.out_width > priv.xres) priv.out_width=priv.xres; - if(priv.out_height > priv.yres) priv.out_width=priv.yres; - priv.L123123875 = priv.frame_buffer + x_offset * priv.pixel_size + y_offset * priv.line_len; - MSG_DBG2(FBDEV "priv.frame_buffer @ %p\n", priv.frame_buffer); - MSG_DBG2(F... [truncated message content] |