From 0fe4207dfba3a8b28db86522d2b5b78df7379a5e Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 17 Feb 2007 20:58:55 +0000 Subject: Move common vo initialization code to video_out.c git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22250 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/video_out.c | 22 ++++++++++++++++++++++ libvo/video_out.h | 5 +++++ libvo/vo_gl.c | 17 +++-------------- libvo/vo_gl2.c | 18 +++--------------- libvo/vo_x11.c | 12 +++--------- libvo/vo_xv.c | 19 +++---------------- libvo/vo_xvidix.c | 21 ++++----------------- libvo/vo_xvmc.c | 16 +++------------- 8 files changed, 46 insertions(+), 84 deletions(-) (limited to 'libvo') diff --git a/libvo/video_out.c b/libvo/video_out.c index 1920782267..b8ec45ed14 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -11,6 +11,8 @@ #include "config.h" #include "video_out.h" +#include "aspect.h" +#include "geometry.h" #include "mp_msg.h" #include "help_mp.h" @@ -322,6 +324,26 @@ vo_functions_t* init_best_video_out(char** vo_list){ return NULL; } +int config_video_out(vo_functions_t *vo, uint32_t width, uint32_t height, + uint32_t d_width, uint32_t d_height, uint32_t flags, + char *title, uint32_t format) { + panscan_init(); + aspect_save_orig(width,height); + aspect_save_prescale(d_width,d_height); + vo->control(VOCTRL_UPDATE_SCREENINFO, NULL); + + aspect(&d_width,&d_height,A_NOZOOM); + vo_dx = (int)(vo_screenwidth - d_width) / 2; + vo_dy = (int)(vo_screenheight - d_height) / 2; + geometry(&vo_dx, &vo_dy, &d_width, &d_height, + vo_screenwidth, vo_screenheight); + vo_dx += xinerama_x; + vo_dy += xinerama_y; + vo_dwidth = d_width; + vo_dheight = d_height; + + return vo->config(width, height, d_width, d_height, flags, title, format); +} #if defined(HAVE_FBDEV)||defined(HAVE_VESA) /* Borrowed from vo_fbdev.c diff --git a/libvo/video_out.h b/libvo/video_out.h index b2e7dadc57..3efe047361 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -68,6 +68,8 @@ typedef struct { #define VOCTRL_SET_DEINTERLACE 30 #define VOCTRL_GET_DEINTERLACE 31 +#define VOCTRL_UPDATE_SCREENINFO 32 + // Vo can be used by xover #define VOCTRL_XOVERLAY_SUPPORT 22 @@ -179,6 +181,9 @@ const char *vo_format_name(int format); int vo_init(void); vo_functions_t* init_best_video_out(char** vo_list); +int config_video_out(vo_functions_t *vo, uint32_t width, uint32_t height, + uint32_t d_width, uint32_t d_height, uint32_t flags, + char *title, uint32_t format); void list_video_out(void); // NULL terminated array of all drivers diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 74ffa9a15a..6c33c19625 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -451,23 +451,9 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin int_pause = 0; vo_flipped = !!(flags & VOFLAG_FLIPPING); - panscan_init(); - aspect_save_orig(width,height); - aspect_save_prescale(d_width,d_height); - update_xinerama_info(); - - aspect(&d_width,&d_height,A_NOZOOM); - vo_dx = (int)(vo_screenwidth - d_width) / 2; - vo_dy = (int)(vo_screenheight - d_height) / 2; - geometry(&vo_dx, &vo_dy, &d_width, &d_height, - vo_screenwidth, vo_screenheight); - vo_dx += xinerama_x; - vo_dy += xinerama_y; #ifdef HAVE_NEW_GUI if (use_gui) { // GUI creates and manages window for us - vo_dwidth = d_width; - vo_dheight= d_height; guiGetEvent(guiSetShVideo, 0); #ifndef GL_WIN32 goto glconfig; @@ -1066,6 +1052,9 @@ static int control(uint32_t request, void *data, ...) return VO_TRUE; } break; + case VOCTRL_UPDATE_SCREENINFO: + update_xinerama_info(); + return VO_TRUE; } return VO_NOTIMPL; } diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index d50ae88b15..7719e4e118 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -738,8 +738,6 @@ static int config_glx(uint32_t width, uint32_t height, uint32_t d_width, uint32_ #ifdef HAVE_NEW_GUI static int config_glx_gui(uint32_t d_width, uint32_t d_height) { - vo_dwidth = d_width; - vo_dheight = d_height; guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window return 0; } @@ -810,19 +808,6 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin int_pause = 0; - panscan_init(); - aspect_save_orig(width,height); - aspect_save_prescale(d_width,d_height); - update_xinerama_info(); - - aspect(&d_width,&d_height,A_NOZOOM); - vo_dx = (int)(vo_screenwidth - d_width) / 2; - vo_dy = (int)(vo_screenheight - d_height) / 2; - geometry(&vo_dx, &vo_dy, &d_width, &d_height, - vo_screenwidth, vo_screenheight); - vo_dx += xinerama_x; - vo_dy += xinerama_y; - #ifdef HAVE_NEW_GUI if (use_gui) { if (config_glx_gui(d_width, d_height) == -1) @@ -1142,6 +1127,9 @@ static int control(uint32_t request, void *data, ...) return vo_x11_get_equalizer(data, value); } #endif + case VOCTRL_UPDATE_SCREENINFO: + update_xinerama_info(); + return VO_TRUE; } return VO_NOTIMPL; } diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c index b0948f3fd5..f94d5c9c30 100644 --- a/libvo/vo_x11.c +++ b/libvo/vo_x11.c @@ -336,15 +336,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, in_format = format; srcW = width; srcH = height; - update_xinerama_info(); - vo_dx = (vo_screenwidth - d_width) / 2; - vo_dy = (vo_screenheight - d_height) / 2; - geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, - vo_screenheight); - vo_dx += xinerama_x; - vo_dy += xinerama_y; - vo_dwidth = d_width; - vo_dheight = d_height; if (flags & (VOFLAG_FULLSCREEN|VOFLAG_MODESWITCHING)) fullscreen = 1; @@ -834,6 +825,9 @@ static int control(uint32_t request, void *data, ...) vo_x11_clearwindow(mDisplay, vo_window); } return VO_TRUE; + case VOCTRL_UPDATE_SCREENINFO: + update_xinerama_info(); + return VO_TRUE; } return VO_NOTIMPL; } diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 2aff1742b1..ecd5e24817 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -168,11 +168,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, static uint32_t vm_height; #endif - panscan_init(); - - aspect_save_orig(width, height); - aspect_save_prescale(d_width, d_height); - image_height = height; image_width = width; image_format = format; @@ -190,17 +185,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, int_pause = 0; visible_buf = -1; - update_xinerama_info(); - aspect(&d_width, &d_height, A_NOZOOM); - vo_dx = (vo_screenwidth - d_width) / 2; - vo_dy = (vo_screenheight - d_height) / 2; - geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, - vo_screenheight); - vo_dx += xinerama_x; - vo_dy += xinerama_y; - vo_dwidth = d_width; - vo_dheight = d_height; - #ifdef HAVE_XF86VM if (flags & VOFLAG_MODESWITCHING) vm = 1; @@ -1004,6 +988,9 @@ static int control(uint32_t request, void *data, ...) case VOCTRL_ONTOP: vo_x11_ontop(); return VO_TRUE; + case VOCTRL_UPDATE_SCREENINFO: + update_xinerama_info(); + return VO_TRUE; } return VO_NOTIMPL; } diff --git a/libvo/vo_xvidix.c b/libvo/vo_xvidix.c index 9bb65415ae..e8360e7266 100644 --- a/libvo/vo_xvidix.c +++ b/libvo/vo_xvidix.c @@ -240,23 +240,11 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, title = "MPlayer VIDIX X11 Overlay"; - panscan_init(); - image_height = height; image_width = width; image_format = format; vo_mouse_autohide = 1; - aspect_save_orig(width, height); - aspect_save_prescale(d_width, d_height); - aspect_save_screenres(vo_screenwidth, vo_screenheight); - - vo_dx = 0; - vo_dy = 0; - vo_dx = (vo_screenwidth - d_width) / 2; - vo_dy = (vo_screenheight - d_height) / 2; - geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, - vo_screenheight); window_width = d_width; window_height = d_height; @@ -288,11 +276,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, } mp_msg(MSGT_VO, MSGL_V, "Using colorkey: %x\n", colorkey); - aspect(&d_width, &d_height, A_NOZOOM); - - vo_dwidth = d_width; - vo_dheight = d_height; - #ifdef HAVE_NEW_GUI if (use_gui) guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window @@ -556,6 +539,10 @@ static int control(uint32_t request, void *data, ...) return vidix_control(request, data, value); } + case VOCTRL_UPDATE_SCREENINFO: + aspect_save_screenres(vo_screenwidth, vo_screenheight); + return VO_TRUE; + } return vidix_control(request, data); // return VO_NOTIMPL; diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index fde5ee40df..6fc415cb24 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -601,24 +601,11 @@ found_subpic: vo_xv_enable_vsync();//it won't break anything //taken from vo_xv - panscan_init(); - - aspect_save_orig(width,height); - aspect_save_prescale(d_width,d_height); - image_height = height; image_width = width; vo_mouse_autohide = 1; - update_xinerama_info(); - aspect(&d_width,&d_height,A_NOZOOM); - vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2; - geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight); - vo_dx += xinerama_x; - vo_dy += xinerama_y; - vo_dwidth=d_width; vo_dheight=d_height; - #ifdef HAVE_XF86VM if( flags&VOFLAG_MODESWITCHING ) vm = 1; #endif @@ -1442,6 +1429,9 @@ static int control(uint32_t request, void *data, ... ) return(vo_xv_get_eq(xv_port, data, value)); } + case VOCTRL_UPDATE_SCREENINFO: + update_xinerama_info(); + return VO_TRUE; } return VO_NOTIMPL; } -- cgit v1.2.3