[MPlayer-dev-eng] better patch for -vo x11 -wid bug

Jouni Tulkki jitulkki at cc.hut.fi
Wed Jan 29 11:33:35 CET 2003


The reason why mplayer crashes (in some cases) when using x11
output and -wid (>0) parameter is this:

Mplayer by default creates a colormap using DirectColor visual. If the
window given to mplayer uses TrueColor visual there will be an error
when mplayer sets the colormap for the window. This patch
modifies mplayer to use TrueColor visual if the window given to mplayer
uses TrueColor. Another solution is to make sure that the window given to
mplayer is created using DirectColor visual if it is supported by the
display.

Note that when using root window the colormap is not set, this is why
the bug doesn't appear when using -wid 0. To test the bug, first create
xterm window.
Then use xwininfo to check the id of the window, and also the visual class.
Then
run mplayer using the window id as a parameter. Don't expect to see any
video
when using xterm window, this method is only used to test if mplayer crashes
or not.

--- vo_x11.c.original   2003-01-26 16:37:57.000000000 +0200
+++ vo_x11.c    2003-01-29 12:10:28.000000000 +0200
@@ -261,7 +261,8 @@
    Visual *visual;
    depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual);
  }
- if ( !XMatchVisualInfo( mDisplay,mScreen,depth,DirectColor,&vinfo ))
+ if ( !XMatchVisualInfo( mDisplay,mScreen,depth,DirectColor,&vinfo ) ||
+      WinID > 0 && vinfo.visualid != XVisualIDFromVisual(attribs.visual))
    XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );

  /* set image size (which is indeed neither the input nor output size),








More information about the MPlayer-dev-eng mailing list