[MPlayer-cygwin] Testers needed for -vo gl under Vista
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Apr 9 14:18:57 CEST 2007
Hello,
to anyone who wants the issues to be fixed, I need someone who can
compile MPlayer and test patches.
Attached is a patch that might make -vo gl actually display something.
I was reading the VirtualDub blog, and it seems Vista just doesn't
update windows as long as there is still a DC allocated - and MPlayer
for simplicity always keeps one.
Note: I did not even test for compilation.
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libvo/w32_common.c
===================================================================
--- libvo/w32_common.c (revision 22946)
+++ libvo/w32_common.c (working copy)
@@ -10,6 +10,9 @@
#include "video_out.h"
#include "aspect.h"
#include "w32_common.h"
+#ifndef PFD_SUPPORT_COMPOSITION
+#define PFD_SUPPORT_COMPOSITION 0x00008000
+#endif
#include "mp_fifo.h"
extern int enable_mouse_movements;
@@ -20,7 +23,6 @@
static const char* classname = "MPlayer - Media player for Win32";
int vo_vm = 0;
-HDC vo_hdc = 0;
// last non-fullscreen extends
int prev_width;
@@ -250,6 +253,7 @@
static int createRenderingContext(void) {
HWND layer = HWND_NOTOPMOST;
PIXELFORMATDESCRIPTOR pfd;
+ HDC vo_hdc = GetDC(vo_window);
RECT r;
int pf;
if (WinID < 0) {
@@ -298,13 +302,14 @@
memset(&pfd, 0, sizeof pfd);
pfd.nSize = sizeof pfd;
pfd.nVersion = 1;
- pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
+ pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_SUPPORT_COMPOSITION;
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_hdc);
return 0;
}
@@ -312,6 +317,7 @@
mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, vo_depthonscreen);
+ ReleaseDC(vo_hdc);
return 1;
}
@@ -366,8 +372,6 @@
}
}
- vo_hdc = GetDC(vo_window);
-
myMonitorFromWindow = NULL;
myGetMonitorInfo = NULL;
myEnumDisplayMonitors = NULL;
Index: libvo/gl_common.c
===================================================================
--- libvo/gl_common.c (revision 22946)
+++ libvo/gl_common.c (working copy)
@@ -1341,6 +1381,7 @@
HDC windc = GetDC(win);
HGLRC new_context = 0;
int keep_context = 0;
+ int res = SET_WINDOW_FAILED;
// should only be needed when keeping context, but not doing glFinish
// can cause flickering even when we do not keep it.
@@ -1356,7 +1397,7 @@
new_context = wglCreateContext(windc);
if (!new_context) {
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GL context!\n");
- return SET_WINDOW_FAILED;
+ goto out;
}
}
@@ -1366,12 +1407,11 @@
if (!keep_context) {
wglDeleteContext(new_context);
}
- return SET_WINDOW_FAILED;
+ goto out;
}
// set new values
vo_w32_window = win;
- vo_hdc = windc;
{
RECT rect;
GetClientRect(win, &rect);
@@ -1386,9 +1426,13 @@
getFunctions(w32gpa, NULL);
// and inform that reinit is neccessary
- return SET_WINDOW_REINIT;
- }
- return SET_WINDOW_OK;
+ res = SET_WINDOW_REINIT;
+ } else
+ res = SET_WINDOW_OK;
+
+out:
+ ReleaseDC(windc);
+ return res;
}
void releaseGlContext(int *vinfo, HGLRC *context) {
@@ -1401,7 +1445,9 @@
}
void swapGlBuffers() {
+ HDC vo_hdc = GetDC(vo_w32_window);
SwapBuffers(vo_hdc);
+ ReleaseDC(vo_hdc);
}
#else
#ifdef HAVE_LIBDL
Index: libvo/vo_gl2.c
===================================================================
--- libvo/vo_gl2.c (revision 22946)
+++ libvo/vo_gl2.c (working copy)
@@ -106,6 +106,7 @@
{
#ifdef GL_WIN32
PIXELFORMATDESCRIPTOR pfd;
+ HDC vo_hdc = GetDC(vo_w32_window);
int pf = GetPixelFormat(vo_hdc);
if (!DescribePixelFormat(vo_hdc, pf, sizeof pfd, &pfd)) {
r_sz = g_sz = b_sz = a_sz = 0;
@@ -115,6 +116,7 @@
b_sz = pfd.cBlueBits;
a_sz = pfd.cAlphaBits;
}
+ ReleaseDC(vo_hdc);
#else
if (glXGetConfig(mDisplay, gl_vinfo, GLX_RED_SIZE, &r_sz) != 0) r_sz = 0;
if (glXGetConfig(mDisplay, gl_vinfo, GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0;
More information about the MPlayer-cygwin
mailing list