changeset 11158:85f4534d1edb

Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support by Jake Page <jake@CS.Stanford.EDU>
author alex
date Fri, 17 Oct 2003 09:08:37 +0000
parents c470a29b500b
children 8ac4d769a1fb
files cfg-mplayer.h libvo/video_out.c libvo/vo_cvidix.c libvo/vo_fbdev.c libvo/vo_svga.c libvo/vo_vesa.c libvo/vo_xvidix.c
diffstat 7 files changed, 70 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Fri Oct 17 08:36:47 2003 +0000
+++ b/cfg-mplayer.h	Fri Oct 17 09:08:37 2003 +0000
@@ -272,6 +272,7 @@
 	// set bpp (x11+vm, dga, fbdev, vesa, svga?)
         {"bpp", &vo_dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL},
 	{"colorkey", &vo_colorkey, CONF_TYPE_INT, 0, 0, 0, NULL},
+	{"nocolorkey", &vo_colorkey, CONF_TYPE_FLAG, 0, 0, 0xff000000, NULL},
 	// double buffering:  (mga/xmga, xv, vidix, vesa, fbdev)
 	{"double", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"nodouble", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 1, 0, NULL},
--- a/libvo/video_out.c	Fri Oct 17 08:36:47 2003 +0000
+++ b/libvo/video_out.c	Fri Oct 17 09:08:37 2003 +0000
@@ -48,6 +48,7 @@
 int vo_directrendering=0;
 
 int vo_colorkey = 0x0000ff00; // default colorkey is green
+			      // (0xff000000 means that colorkey has been disabled)
 
 //
 // Externally visible list of all vo drivers
--- a/libvo/vo_cvidix.c	Fri Oct 17 08:36:47 2003 +0000
+++ b/libvo/vo_cvidix.c	Fri Oct 17 09:08:37 2003 +0000
@@ -48,8 +48,15 @@
   if(vidix_grkey_support()){
     vidix_grkey_get(&gr_key);
     gr_key.key_op = KEYS_PUT;
-    gr_key.ckey.op = CKEY_TRUE;
-    gr_key.ckey.red = gr_key.ckey.green = gr_key.ckey.blue = 0;
+    if (vo_colorkey != 0xff000000)
+    {
+	gr_key.ckey.op = CKEY_TRUE;
+	gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
+	gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
+	gr_key.ckey.blue = vo_colorkey & 0x000000FF;
+    }
+    else
+	gr_key.ckey.op = CKEY_FALSE;
     vidix_grkey_set(&gr_key);
   }         
   return 0;
--- a/libvo/vo_fbdev.c	Fri Oct 17 08:36:47 2003 +0000
+++ b/libvo/vo_fbdev.c	Fri Oct 17 09:08:37 2003 +0000
@@ -42,6 +42,7 @@
 #ifdef CONFIG_VIDIX
 /* Name of VIDIX driver */
 static const char *vidix_name = NULL;
+static vidix_grkey_t gr_key;
 #endif
 static signed int pre_init_err = -2;
 /******************************
@@ -976,6 +977,21 @@
 		}
 		else mp_msg(MSGT_VO, MSGL_V, "Using VIDIX\n");
 		vidix_start();
+		if (vidix_grkey_support())
+		{
+		    vidix_grkey_get(&gr_key);
+		    gr_key.key_op = KEYS_PUT;
+		    if (vo_colorkey != 0xff000000)
+		    {
+			gr_key.ckey.op = CKEY_TRUE;
+			gr_key.ckey.red = (vo_colorkey & 0x00ff0000) >> 16;
+			gr_key.ckey.green = (vo_colorkey & 0x0000ff00) >> 8;
+			gr_key.ckey.blue = vo_colorkey & 0x000000ff;
+		    }
+		    else
+			gr_key.ckey.op = CKEY_FALSE;
+		    vidix_grkey_set(&gr_key);
+		}
 	}
 	else
 #endif
--- a/libvo/vo_svga.c	Fri Oct 17 08:36:47 2003 +0000
+++ b/libvo/vo_svga.c	Fri Oct 17 09:08:37 2003 +0000
@@ -105,6 +105,7 @@
 
 #ifdef CONFIG_VIDIX
 static char vidix_name[32] = "";
+static vidix_grkey_t gr_key;
 #endif
 
 LIBVO_EXTERN(svga)
@@ -526,6 +527,19 @@
     printf("vo_svga: Using VIDIX. w=%i h=%i  mw=%i mh=%i\n",width,height,
            modeinfo->width,modeinfo->height);
     vidix_start();
+    /*set colorkey*/       
+    if(vidix_grkey_support()){
+      vidix_grkey_get(&gr_key);
+      gr_key.key_op = KEYS_PUT;
+      if (vo_colorkey != 0xFF000000) {
+	gr_key.ckey.op = CKEY_TRUE;
+	gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
+	gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
+	gr_key.ckey.blue = vo_colorkey & 0x000000FF;
+      } else
+	gr_key.ckey.op = CKEY_FALSE;
+      vidix_grkey_set(&gr_key);
+    }         
   }
 #endif    
 
--- a/libvo/vo_vesa.c	Fri Oct 17 08:36:47 2003 +0000
+++ b/libvo/vo_vesa.c	Fri Oct 17 09:08:37 2003 +0000
@@ -120,6 +120,7 @@
 #ifdef CONFIG_VIDIX
 static const char *vidix_name = NULL;
 static int vidix_opened = 0;
+static vidix_grkey_t gr_key;
 #endif
 
 #define HAS_DGA()  (win.idx == -1)
@@ -958,6 +959,22 @@
 		  }
 		  else printf("vo_vesa: Using VIDIX\n");
 		  vidix_start();
+
+		  /* set colorkey */       
+		  if (vidix_grkey_support())
+		  {
+		    vidix_grkey_get(&gr_key);
+		    gr_key.key_op = KEYS_PUT;
+		    if (vo_colorkey != 0xFF000000)
+		    {
+			gr_key.ckey.op = CKEY_TRUE;
+			gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
+			gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
+			gr_key.ckey.blue = vo_colorkey & 0x000000FF;
+		    } else
+			gr_key.ckey.op = CKEY_FALSE;
+		    vidix_grkey_set(&gr_key);
+		  }         
 		  vidix_opened = 1;
 		}
 #endif
--- a/libvo/vo_xvidix.c	Fri Oct 17 08:36:47 2003 +0000
+++ b/libvo/vo_xvidix.c	Fri Oct 17 09:08:37 2003 +0000
@@ -197,11 +197,14 @@
     /* mDrawColorKey: */
 
     /* fill drawable with specified color */
+    if (vo_colorkey != 0xff000000)
+    {
     XSetBackground(mDisplay, vo_gc, 0L);
     XClearWindow( mDisplay,vo_window );
     XSetForeground(mDisplay, vo_gc, colorkey);
     XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
 	(vo_fs ? drwHeight - 1 : drwHeight));
+    }
     /* flush, update drawable */
     XFlush(mDisplay);
 
@@ -346,10 +349,15 @@
     {
 	vidix_grkey_get(&gr_key);
 	gr_key.key_op = KEYS_PUT;
-	gr_key.ckey.op = CKEY_TRUE;
-	gr_key.ckey.red = r;
-	gr_key.ckey.green = g;
-	gr_key.ckey.blue = b;
+	if (vo_colorkey != 0xff000000)
+	{
+	    gr_key.ckey.op = CKEY_TRUE;
+	    gr_key.ckey.red = r;
+	    gr_key.ckey.green = g;
+	    gr_key.ckey.blue = b;
+	}
+	else
+	    gr_key.ckey.op = CKEY_FALSE;
 	vidix_grkey_set(&gr_key);
     }