[MPlayer-users] XVideo output fails unless Xine is also running

Ben Liblit liblit at eecs.berkeley.edu
Wed Oct 16 12:57:02 CEST 2002


D Richard Felker III wrote:
> Sounds good to me, although drawing the color key manually might be
> more reliable. Opinions, anyone?

Attached below please find two patches.  The first fixes the problem in
the way I suggested (by setting XV_AUTOPAINT_COLORKEY to true).  The
second fixes the problem in the way Rich suggested (by setting the video
output window's background to the pixel given in XV_COLORKEY).

Either fix works just fine from what I can tell.  (Yay!)  I don't know
enough XVideo to make a rational choice between them.  But if somebody
with MPlayer checkin permissions thinks they like one or the other,
please go ahead and check in whichever fix you prefer.

We should probably tell the SDL people about this, as "-vo sdl:x11" has
the same problem.
-------------- next part --------------
Index: libvo/vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.120
diff -u -u -r1.120 vo_xv.c
--- libvo/vo_xv.c	10 Oct 2002 00:09:34 -0000	1.120
+++ libvo/vo_xv.c	16 Oct 2002 10:52:19 -0000
@@ -770,6 +770,19 @@
 	return -1;
     }
 
+    {
+      int howmany, i;
+      const XvAttribute * const attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany);
+      
+      for (i = 0; i < howmany && attributes; i++)
+	if (!strcmp(attributes[i].name, "XV_AUTOPAINT_COLORKEY"))
+	  {
+	    const Atom autopaint = XInternAtom(mDisplay, "XV_AUTOPAINT_COLORKEY", False);
+	    XvSetPortAttribute(mDisplay, xv_port, autopaint, 1);
+	    break;
+	  }
+    }
+
     fo = XvListImageFormats(mDisplay, xv_port, (int*)&formats);
 
     return 0;
-------------- next part --------------
Index: libvo/vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.120
diff -u -u -r1.120 vo_xv.c
--- libvo/vo_xv.c	10 Oct 2002 00:09:34 -0000	1.120
+++ libvo/vo_xv.c	16 Oct 2002 10:52:01 -0000
@@ -367,6 +367,21 @@
    xswa.border_pixel     = 0;
    xswamask = CWBackPixel | CWBorderPixel;
 
+   {
+     int howmany, i;
+     const XvAttribute * const attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany);
+
+     for (i = 0; i < howmany && attributes; i++)
+       if (!strcmp(attributes[i].name, "XV_COLORKEY"))
+	 {
+	   int value;
+	   const Atom colorkey = XInternAtom(mDisplay, "XV_COLORKEY", False);
+	   XvGetPortAttribute(mDisplay, xv_port, colorkey, &value);
+	   xswa.background_pixel = value;
+	   break;
+	 }
+   }
+
     if ( WinID>=0 ){
       vo_window = WinID ? ((Window)WinID) : mRootWin;
       if ( WinID ) 


More information about the MPlayer-users mailing list