1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

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.
This commit is contained in:
Uoti Urpala 2008-04-21 01:44:53 +03:00
parent ce76dfdd4a
commit a2212a71a7
3 changed files with 15 additions and 11 deletions

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);