[Mplayer-cvslog] CVS: main/libvo vo_x11.c,1.125,1.126

Arpi of Ize arpi at mplayerhq.hu
Tue Feb 4 19:32:01 CET 2003


Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv10992

Modified Files:
	vo_x11.c 
Log Message:
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.

Jouni Tulkki <jitulkki at cc.hut.fi>


Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -r1.125 -r1.126
--- vo_x11.c	26 Jan 2003 22:24:17 -0000	1.125
+++ vo_x11.c	4 Feb 2003 18:31:44 -0000	1.126
@@ -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), 
@@ -298,7 +299,8 @@
 
     xswa.background_pixel=0;
     xswa.border_pixel=0;
-    xswamask=CWBackPixel | CWBorderPixel;
+    xswa.colormap=theCmap;
+    xswamask=CWBackPixel | CWBorderPixel | CWColormap;
 
 #ifdef HAVE_XF86VM
     if ( vm )
@@ -322,8 +324,6 @@
      {
       if ( vo_window == None )
        {
-        xswa.colormap=theCmap;
-        xswamask|=CWColormap;
         vo_window=XCreateWindow( mDisplay,mRootWin,
     			 vo_dx,vo_dy,
 			 vo_dwidth,vo_dheight,



More information about the MPlayer-cvslog mailing list