From f34454b6b5acba9c21dcc98d9b7d877731aa98cf Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 4 Feb 2010 22:08:23 +0000 Subject: Create the OpenGL probe window as a hidden Window on X11. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30507 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/video_out.h | 1 + libvo/vo_gl.c | 2 +- libvo/x11_common.c | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'libvo') diff --git a/libvo/video_out.h b/libvo/video_out.h index b9380fadf1..1fce2c2877 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -108,6 +108,7 @@ typedef struct { #define VOFLAG_MODESWITCHING 0x02 #define VOFLAG_SWSCALE 0x04 #define VOFLAG_FLIPPING 0x08 +#define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window #define VOFLAG_XOVERLAY_SUB_VO 0x10000 typedef struct vo_info_s diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 5219b06cab..066ad5b71b 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1167,7 +1167,7 @@ static int preinit(const char *arg) if (!init_mpglcontext(&glctx, gltype)) goto err_out; if (use_yuv == -1) { - if (create_window(320, 200, 0, NULL) < 0) + if (create_window(320, 200, VOFLAG_HIDDEN, NULL) < 0) goto err_out; if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED) goto err_out; diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 871ab62940..bb46588ea4 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -104,6 +104,7 @@ int mLocalDisplay; int vo_mouse_autohide = 0; int vo_wm_type = 0; int vo_fs_type = 0; // needs to be accessible for GUI X11 code +static int window_state; static int vo_fs_flip = 0; char **vo_fstype_list; @@ -1102,13 +1103,18 @@ void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y, goto final; } if (vo_window == None) { - XSizeHints hint; - XEvent xev; vo_fs = 0; vo_dwidth = width; vo_dheight = height; vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vis->visual, x, y, width, height, vis->depth, col_map); + window_state = VOFLAG_HIDDEN; + } + if (flags & VOFLAG_HIDDEN) + goto final; + if (window_state & VOFLAG_HIDDEN) { + XSizeHints hint; + XEvent xev; vo_x11_classhint(mDisplay, vo_window, classname); XStoreName(mDisplay, vo_window, title); vo_hidecursor(mDisplay, vo_window); -- cgit v1.2.3 From bf6dc310dc523deee16b9193b31f77eb884c7c1c Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 4 Feb 2010 22:46:01 +0000 Subject: Set the PixelFormat right after creating the window and set it only once. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30508 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/w32_common.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'libvo') diff --git a/libvo/w32_common.c b/libvo/w32_common.c index da8ed74695..7c60f2d301 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -329,10 +329,7 @@ static void resetMode(void) { static int createRenderingContext(void) { HWND layer = HWND_NOTOPMOST; - PIXELFORMATDESCRIPTOR pfd; - HDC vo_hdc = vo_w32_get_dc(vo_window); RECT r; - int pf; if (WinID < 0) { int style = (vo_border && !vo_fs) ? (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP; @@ -378,26 +375,6 @@ static int createRenderingContext(void) { AdjustWindowRect(&r, style, 0); SetWindowPos(vo_window, layer, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_SHOWWINDOW); } - - memset(&pfd, 0, sizeof pfd); - pfd.nSize = sizeof pfd; - pfd.nVersion = 1; - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.cColorBits = 24; - pfd.iLayerType = PFD_MAIN_PLANE; - pf = ChoosePixelFormat(vo_hdc, &pfd); - if (!pf) { - mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to select a valid pixel format!\n"); - ReleaseDC(vo_window, vo_hdc); - return 0; - } - - 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); - - vo_w32_release_dc(vo_window, vo_hdc); return 1; } @@ -461,6 +438,9 @@ static char *get_display_name(void) { * \return 1 = Success, 0 = Failure */ int vo_w32_init(void) { + PIXELFORMATDESCRIPTOR pfd; + HDC vo_hdc; + int pf; HICON mplayerIcon = 0; char exedir[MAX_PATH]; HINSTANCE user32; @@ -517,6 +497,26 @@ int vo_w32_init(void) { if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL); updateScreenProperties(); + vo_hdc = vo_w32_get_dc(vo_window); + memset(&pfd, 0, sizeof pfd); + pfd.nSize = sizeof pfd; + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.cColorBits = 24; + pfd.iLayerType = PFD_MAIN_PLANE; + pf = ChoosePixelFormat(vo_hdc, &pfd); + if (!pf) { + mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to select a valid pixel format!\n"); + vo_w32_release_dc(vo_window, vo_hdc); + return 0; + } + + SetPixelFormat(vo_hdc, pf, &pfd); + vo_w32_release_dc(vo_window, vo_hdc); + + mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, vo_depthonscreen); + return 1; } -- cgit v1.2.3 From 1cd3b3c5ddde1c9d93de1b8bd4f26916e41b9381 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 4 Feb 2010 22:46:45 +0000 Subject: Add support for VOFLAG_HIDDEN to the w32 backend. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30509 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/w32_common.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libvo') diff --git a/libvo/w32_common.c b/libvo/w32_common.c index 7c60f2d301..a0ffd9fb98 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -391,6 +391,9 @@ static int createRenderingContext(void) { * \return 1 - Success, 0 - Failure */ int vo_w32_config(uint32_t width, uint32_t height, uint32_t flags) { + // we already have a fully initialized window, so nothing needs to be done + if (flags & VOFLAG_HIDDEN) + return; // store original size for videomode switching o_dwidth = width; o_dheight = height; -- cgit v1.2.3 From 21208015e0e55c54c19168402b8fc11940831d61 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 5 Feb 2010 07:12:05 +0000 Subject: Print messages only after we are sure preinit will not fail anymore. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30510 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 066ad5b71b..acf7e96891 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1159,11 +1159,6 @@ static int preinit(const char *arg) "\n" ); return -1; } - if (many_fmts) - mp_msg(MSGT_VO, MSGL_INFO, "[gl] using extended formats. " - "Use -vo gl:nomanyfmts if playback fails.\n"); - mp_msg(MSGT_VO, MSGL_V, "[gl] Using %d as slice height " - "(0 means image height).\n", slice_height); if (!init_mpglcontext(&glctx, gltype)) goto err_out; if (use_yuv == -1) { @@ -1173,6 +1168,11 @@ static int preinit(const char *arg) goto err_out; autodetectGlExtensions(); } + if (many_fmts) + mp_msg(MSGT_VO, MSGL_INFO, "[gl] using extended formats. " + "Use -vo gl:nomanyfmts if playback fails.\n"); + mp_msg(MSGT_VO, MSGL_V, "[gl] Using %d as slice height " + "(0 means image height).\n", slice_height); return 0; -- cgit v1.2.3 From c5b0ff1cfacfa502eb0647f329756ddf7c79fcb6 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 5 Feb 2010 16:42:13 +0000 Subject: Fix hang with -fixed-vo due to VOFLAG_HIDDEN never being removed from window_state. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30514 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/x11_common.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libvo') diff --git a/libvo/x11_common.c b/libvo/x11_common.c index bb46588ea4..bb334f13f5 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -1115,6 +1115,7 @@ void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y, if (window_state & VOFLAG_HIDDEN) { XSizeHints hint; XEvent xev; + window_state &= ~VOFLAG_HIDDEN; vo_x11_classhint(mDisplay, vo_window, classname); XStoreName(mDisplay, vo_window, title); vo_hidecursor(mDisplay, vo_window); -- cgit v1.2.3