summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-11-15 18:56:25 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-11-15 18:56:25 +0000
commit4b9ee2e2063f8d0a56288cb9d1aa8b35e640600b (patch)
treeb871040755c18ef882d0f8d0fcc46bcec7e31ba1 /libvo
parentc8d9e2eb60e942009c35270b97045e84e74dd5d5 (diff)
downloadmpv-4b9ee2e2063f8d0a56288cb9d1aa8b35e640600b.tar.bz2
mpv-4b9ee2e2063f8d0a56288cb9d1aa8b35e640600b.tar.xz
Simplify vo_vm_switch and vo_vm_close, everyone was using the (almost) same
boiler-plate code with them, just with different bugs. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27924 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_x11.c14
-rw-r--r--libvo/vo_xv.c14
-rw-r--r--libvo/vo_xvmc.c13
-rw-r--r--libvo/x11_common.c40
-rw-r--r--libvo/x11_common.h4
5 files changed, 26 insertions, 59 deletions
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c
index 41de2c7e95..af5dcfb0a8 100644
--- a/libvo/vo_x11.c
+++ b/libvo/vo_x11.c
@@ -377,17 +377,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
#ifdef CONFIG_XF86VM
if (vm)
{
- if ((d_width == 0) && (d_height == 0))
- {
- vm_width = image_width;
- vm_height = image_height;
- } else
- {
- vm_width = d_width;
- vm_height = d_height;
- }
- vo_vm_switch(vm_width, vm_height, &modeline_width,
- &modeline_height);
+ vo_vm_switch();
}
#endif
bg = WhitePixel(mDisplay, mScreen);
@@ -704,7 +694,7 @@ static void uninit(void)
freeMyXImage();
#ifdef CONFIG_XF86VM
- vo_vm_close(mDisplay);
+ vo_vm_close();
#endif
zoomFlag = 0;
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index d557838738..302d98f1b2 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -232,17 +232,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
#ifdef CONFIG_XF86VM
if (vm)
{
- if ((d_width == 0) && (d_height == 0))
- {
- vm_width = image_width;
- vm_height = image_height;
- } else
- {
- vm_width = d_width;
- vm_height = d_height;
- }
- vo_vm_switch(vm_width, vm_height, &modeline_width,
- &modeline_height);
+ vo_vm_switch();
} else
#endif
XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay),
@@ -659,7 +649,7 @@ static void uninit(void)
for (i = 0; i < num_buffers; i++)
deallocate_xvimage(i);
#ifdef CONFIG_XF86VM
- vo_vm_close(mDisplay);
+ vo_vm_close();
#endif
mp_input_rm_event_fd(ConnectionNumber(mDisplay));
vo_x11_uninit();
diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c
index 8e0fbbb15d..23ba186071 100644
--- a/libvo/vo_xvmc.c
+++ b/libvo/vo_xvmc.c
@@ -656,16 +656,7 @@ skip_surface_allocation:
#ifdef CONFIG_XF86VM
if ( vm )
{
- if ((d_width==0) && (d_height==0))
- { vm_width=image_width; vm_height=image_height; }
- else
- { vm_width=d_width; vm_height=d_height; }
- vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height);
- hint.x=(vo_screenwidth-modeline_width)/2;
- hint.y=(vo_screenheight-modeline_height)/2;
- hint.width=modeline_width;
- hint.height=modeline_height;
- aspect_save_screenres(modeline_width,modeline_height);
+ vo_vm_switch();
}
else
#endif
@@ -1152,7 +1143,7 @@ static void uninit(void){
xvmc_free();
//from vo_xv
#ifdef CONFIG_XF86VM
- vo_vm_close(mDisplay);
+ vo_vm_close();
#endif
vo_x11_uninit();
}
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index f03a062d73..cdbffad7a2 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -1743,12 +1743,13 @@ void vo_x11_selectinput_witherr(Display * display, Window w,
}
#ifdef CONFIG_XF86VM
-void vo_vm_switch(uint32_t X, uint32_t Y, int *modeline_width,
- int *modeline_height)
+void vo_vm_switch(void)
{
int vm_event, vm_error;
int vm_ver, vm_rev;
int i, j, have_vm = 0;
+ int X = vo_dwidth, Y = vo_dheight;
+ int modeline_width, modeline_height;
int modecount;
@@ -1761,8 +1762,6 @@ void vo_vm_switch(uint32_t X, uint32_t Y, int *modeline_width,
} else {
mp_msg(MSGT_VO, MSGL_WARN,
"XF86VidMode extension not available.\n");
- *modeline_width = vo_screenwidth;
- *modeline_height = vo_screenheight;
}
if (have_vm)
@@ -1771,39 +1770,39 @@ void vo_vm_switch(uint32_t X, uint32_t Y, int *modeline_width,
XF86VidModeGetAllModeLines(mDisplay, mScreen, &modecount,
&vidmodes);
j = 0;
- *modeline_width = vidmodes[0]->hdisplay;
- *modeline_height = vidmodes[0]->vdisplay;
+ modeline_width = vidmodes[0]->hdisplay;
+ modeline_height = vidmodes[0]->vdisplay;
for (i = 1; i < modecount; i++)
if ((vidmodes[i]->hdisplay >= X)
&& (vidmodes[i]->vdisplay >= Y))
- if ((vidmodes[i]->hdisplay <= *modeline_width)
- && (vidmodes[i]->vdisplay <= *modeline_height))
+ if ((vidmodes[i]->hdisplay <= modeline_width)
+ && (vidmodes[i]->vdisplay <= modeline_height))
{
- *modeline_width = vidmodes[i]->hdisplay;
- *modeline_height = vidmodes[i]->vdisplay;
+ modeline_width = vidmodes[i]->hdisplay;
+ modeline_height = vidmodes[i]->vdisplay;
j = i;
}
mp_msg(MSGT_VO, MSGL_INFO, MSGTR_SelectedVideoMode,
- *modeline_width, *modeline_height, X, Y);
+ modeline_width, modeline_height, X, Y);
XF86VidModeLockModeSwitch(mDisplay, mScreen, 0);
XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[j]);
XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[j]);
// FIXME: all this is more of a hack than proper solution
- X = (vo_screenwidth - *modeline_width) / 2;
- Y = (vo_screenheight - *modeline_height) / 2;
+ X = (vo_screenwidth - modeline_width) / 2;
+ Y = (vo_screenheight - modeline_height) / 2;
XF86VidModeSetViewPort(mDisplay, mScreen, X, Y);
vo_dx = X;
vo_dy = Y;
- vo_dwidth = *modeline_width;
- vo_dheight = *modeline_height;
- aspect_save_screenres(*modeline_width, *modeline_height);
+ vo_dwidth = modeline_width;
+ vo_dheight = modeline_height;
+ aspect_save_screenres(modeline_width, modeline_height);
}
}
-void vo_vm_close(Display * dpy)
+void vo_vm_close(void)
{
#ifdef CONFIG_GUI
if (vidmodes != NULL && vo_window != None)
@@ -1812,9 +1811,6 @@ void vo_vm_close(Display * dpy)
#endif
{
int i, modecount;
- int screen;
-
- screen = DefaultScreen(dpy);
free(vidmodes);
vidmodes = NULL;
@@ -1830,8 +1826,8 @@ void vo_vm_close(Display * dpy)
break;
}
- XF86VidModeSwitchToMode(dpy, screen, vidmodes[i]);
- XF86VidModeSwitchToMode(dpy, screen, vidmodes[i]);
+ XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[i]);
+ XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[i]);
free(vidmodes);
vidmodes = NULL;
}
diff --git a/libvo/x11_common.h b/libvo/x11_common.h
index 11bf755d15..b4f1e4ae9f 100644
--- a/libvo/x11_common.h
+++ b/libvo/x11_common.h
@@ -122,8 +122,8 @@ void saver_off( Display * );
void saver_on( Display * );
#ifdef CONFIG_XF86VM
-void vo_vm_switch(uint32_t, uint32_t, int*, int*);
-void vo_vm_close(Display*);
+void vo_vm_switch(void);
+void vo_vm_close(void);
#endif
void update_xinerama_info(void);