From a2212a71a74718d71673336a6b08b11f6cf1535b Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 21 Apr 2008 01:44:53 +0300 Subject: Remove vo_depthonscreen references from non-X VOs X-specific code uses this global as its internal variable (assuming that X is initialized if it is set). While using non-X VOs the variable is not accessed outside the VO. So make those VOs use their own variables instead of the global vo_depthonscreen. --- libvo/vo_ggi.c | 10 ++++++---- libvo/vo_winvidix.c | 5 +++-- libvo/w32_common.c | 11 ++++++----- 3 files changed, 15 insertions(+), 11 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_ggi.c b/libvo/vo_ggi.c index 009c3c2e2b..a4ded390a6 100644 --- a/libvo/vo_ggi.c +++ b/libvo/vo_ggi.c @@ -67,6 +67,8 @@ static struct ggi_conf_s { } flushregion; int voflags; + + int depthonscreen; } ggi_conf; @@ -194,7 +196,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, ggiSetFlags(ggi_conf.drawvis, GGIFLAG_ASYNC); } - vo_depthonscreen = GT_DEPTH(mode.graphtype); + ggi_conf.depthonscreen = GT_DEPTH(mode.graphtype); vo_screenwidth = mode.virt.x; vo_screenheight = mode.virt.y; @@ -358,9 +360,9 @@ static int query_format(uint32_t format) | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_ACCEPT_STRIDE; - if ((!vo_depthonscreen || !vo_dbpp) && ggi_conf.vis) { + if ((!ggi_conf.depthonscreen || !vo_dbpp) && ggi_conf.vis) { if (ggiGetMode(ggi_conf.vis, &mode) == 0) { - vo_depthonscreen = GT_DEPTH(mode.graphtype); + ggi_conf.depthonscreen = GT_DEPTH(mode.graphtype); vo_dbpp = GT_SIZE(mode.graphtype); } if (GT_SCHEME(mode.graphtype) == GT_AUTO) { @@ -368,7 +370,7 @@ static int query_format(uint32_t format) } if (GT_SCHEME(mode.graphtype) != GT_TRUECOLOR) { mode.graphtype = GT_32BIT; - vo_depthonscreen = GT_DEPTH(mode.graphtype); + ggi_conf.depthonscreen = GT_DEPTH(mode.graphtype); vo_dbpp = GT_SIZE(mode.graphtype); } } diff --git a/libvo/vo_winvidix.c b/libvo/vo_winvidix.c index 5ddc6f5617..4838165da1 100644 --- a/libvo/vo_winvidix.c +++ b/libvo/vo_winvidix.c @@ -43,6 +43,7 @@ LIBVO_EXTERN(winvidix) /* VIDIX related */ static char *vidix_name; +static int depthonscreen; /* Image parameters */ static uint32_t image_width; static uint32_t image_height; @@ -116,7 +117,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l /*update vidix*/ /* FIXME: implement runtime resize/move if possible, this way is very ugly! */ vidix_stop(); - if(vidix_init(image_width, image_height, vo_dx, vo_dy, vo_dwidth, vo_dheight, image_format, vo_depthonscreen, vo_screenwidth, vo_screenheight) != 0) + if(vidix_init(image_width, image_height, vo_dx, vo_dy, vo_dwidth, vo_dheight, image_format, depthonscreen, vo_screenwidth, vo_screenheight) != 0) mp_msg(MSGT_VO, MSGL_FATAL, "Can't initialize VIDIX driver: %s\n", strerror(errno)); /*set colorkey*/ vidix_start(); @@ -190,7 +191,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,uint32_t d_h image_format = format; vo_screenwidth = GetSystemMetrics(SM_CXSCREEN); vo_screenheight = GetSystemMetrics(SM_CYSCREEN); - vo_depthonscreen = GetDeviceCaps(GetDC(GetDesktopWindow()),BITSPIXEL); + depthonscreen = GetDeviceCaps(GetDC(GetDesktopWindow()),BITSPIXEL); aspect_save_orig(width, height); diff --git a/libvo/w32_common.c b/libvo/w32_common.c index 8fdfc1da24..82cd9c94a1 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -23,6 +23,7 @@ extern int enable_mouse_movements; static const char classname[] = "MPlayer - Media player for Win32"; int vo_vm = 0; +static int depthonscreen; // last non-fullscreen extends static int prev_width; static int prev_height; @@ -233,7 +234,7 @@ static void updateScreenProperties(void) { vo_screenwidth = dm.dmPelsWidth; vo_screenheight = dm.dmPelsHeight; - vo_depthonscreen = dm.dmBitsPerPel; + depthonscreen = dm.dmBitsPerPel; w32_update_xinerama_info(); } @@ -243,7 +244,7 @@ static void changeMode(void) { dm.dmDriverExtra = 0; dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; - dm.dmBitsPerPel = vo_depthonscreen; + dm.dmBitsPerPel = depthonscreen; dm.dmPelsWidth = vo_screenwidth; dm.dmPelsHeight = vo_screenheight; @@ -253,7 +254,7 @@ static void changeMode(void) { int i; for (i = 0; EnumDisplaySettings(0, i, &dm); ++i) { int score = (dm.dmPelsWidth - o_dwidth) * (dm.dmPelsHeight - o_dheight); - if (dm.dmBitsPerPel != vo_depthonscreen) continue; + if (dm.dmBitsPerPel != depthonscreen) continue; if (dm.dmPelsWidth < o_dwidth) continue; if (dm.dmPelsHeight < o_dheight) continue; @@ -343,7 +344,7 @@ static int createRenderingContext(void) { SetPixelFormat(vo_hdc, pf, &pfd); - mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, vo_depthonscreen); + mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, depthonscreen); ReleaseDC(vo_window, vo_hdc); return 1; @@ -442,7 +443,7 @@ void vo_w32_uninit(void) { mp_msg(MSGT_VO, MSGL_V, "vo: win32: uninit\n"); resetMode(); ShowCursor(1); - vo_depthonscreen = 0; + depthonscreen = 0; DestroyWindow(vo_window); vo_window = 0; UnregisterClass(classname, 0); -- cgit v1.2.3