[MPlayer-users] gl/g2 don't work well with -wid in windows

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Feb 19 16:20:26 CET 2007


Hello,
On Sun, Feb 18, 2007 at 11:52:36PM +0100, Pepe wrote:
> I have no idea about Windows programming, but after searching in google I 
> copied this code in my application:
[...]
> I don't know if I've done something wrong but I cannot see any difference at 
> all. gl/gl2 still show the corrupted video after resizing.
> 
> I've uploaded the binary just in case you want to try: 
> http://www.escomposlinux.org/rvm/temp/SMP/smplayer_gl.zip
> 
> But are you sure that this is the problem? I mean, if the window hadn't 
> permission to draw OpenGL then nothing would appear, but it does.

Well, nothing appears for me at all, so this was supposed to fix my
problem, not yours :-). But since your are using Qt I think that
SetPixelFormat you add yourself happens far too late.
Btw. you have the very similar problem under Linux/X11, you must select
an OpenGL capable visual for the window.
Probably using something like this is the only sane solution:
http://doc.trolltech.com/4.1/qglwidget.html , though it does far too
much. Something that does not actually create the gl context but only
creates a windows suitable for OpenGL would be much better.

[...]
> It seems to me that the problem is that mplayer is not resizing the video.

Yes, of course, how should MPlayer find out it got resized? Normally it
would know by the window messages it receives, but that can not work
when the window is not MPlayer's.
vo_directx use a special-case to fix this, attached patch implements
something similar for gl.
Please test and see if it helps (as said, I can't test it with any of
the applications since already creating the GL context fails).

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libvo/w32_common.c
===================================================================
--- libvo/w32_common.c	(revision 22266)
+++ libvo/w32_common.c	(working copy)
@@ -132,6 +132,14 @@
 	TranslateMessage(&msg);
 	DispatchMessage(&msg);
     }
+    if (WinID >= 0) {
+	RECT r;
+	GetClientRect(vo_window, &r);
+	if (r.right != vo_dwidth || r.bottom != vo_dheight)
+	    event_flags |= VO_EVENT_RESIZE;
+	vo_dwidth = r.right;
+	vo_dheight = r.bottom;
+    }
     
     return event_flags;
 }


More information about the MPlayer-users mailing list