[MPlayer-dev-eng] [PATCH] Fix wrong aspect after window minimization (direct3d, gl, gl2)

Georgi Petrov gogothebee at gmail.com
Sun Feb 22 19:58:17 CET 2009


The affected video outs are: direct3d, gl, gl2.

When a video is played (MPlayer from the CLI, not a slave window mode)
and the window is minimized with one of those three video outs (they
share the window management code) and restored, the aspect is wrong.
Window movement fixes it.

This happens for sure under Windows Vista with Aero on. I'm not sure
for other cases. The problem is that in w32_common we check the event
WM_WINDOWPOSCHANGING. On window minimize and restore GetClientRect
returns all zeros. After it GetWindowRect returns random data.
aspect_fit() depends on them, so it fails, returning the aspect to an
uncorrected value. This is because the window is "still
minimizing/restoring". If we check for the event WINDOWPOSCHANGED (not
-ED), this doesn't happen. However the fix is even more simple.

In case GetClientRect returns all zeroes, we just quit. This indicates
that the window is still resizing and we shouldn't change anything
yet. Otherwise we're trying to fit the aspect to the returned values
of GetWindowRect, which will be incorrect!

The bug was discovered by a guy named AdmSlash. I just confirmed,
analyzed and corrected it.
-------------- next part --------------
Index: libvo/w32_common.c
===================================================================
--- libvo/w32_common.c	(revision 28702)
+++ libvo/w32_common.c	(working copy)
@@ -111,6 +111,9 @@
               int xborder, yborder;
               RECT r2;
               GetClientRect(vo_window, &r);
+              if (r.left == 0 && r.right == 0 &&
+                  r.top == 0 && r.bottom == 0)
+                  return 0;
               GetWindowRect(vo_window, &r2);
               xborder = (r2.right - r2.left) - (r.right - r.left);
               yborder = (r2.bottom - r2.top) - (r.bottom - r.top);


More information about the MPlayer-dev-eng mailing list