1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 17:12:36 +00:00

Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support

by Jake Page <jake@CS.Stanford.EDU>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11159 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
alex 2003-10-17 09:08:37 +00:00
parent e6bf2b355a
commit a34978c3a7
7 changed files with 70 additions and 6 deletions

View File

@ -272,6 +272,7 @@ m_option_t mplayer_opts[]={
// 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},

View File

@ -48,6 +48,7 @@ char *vo_subdevice = NULL;
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

View File

@ -48,8 +48,15 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,uint32_
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 = gr_key.ckey.green = gr_key.ckey.blue = 0;
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;

View File

@ -42,6 +42,7 @@ LIBVO_EXTERN(fbdev)
#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 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
}
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

View File

@ -105,6 +105,7 @@ static vo_info_t info = {
#ifdef CONFIG_VIDIX
static char vidix_name[32] = "";
static vidix_grkey_t gr_key;
#endif
LIBVO_EXTERN(svga)
@ -526,6 +527,19 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
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

View File

@ -120,6 +120,7 @@ static int lvo_opened = 0;
#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 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
}
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

View File

@ -197,11 +197,14 @@ static void set_window(int force_update)
/* 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 @@ else
{
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 = r;
gr_key.ckey.green = g;
gr_key.ckey.blue = b;
}
else
gr_key.ckey.op = CKEY_FALSE;
vidix_grkey_set(&gr_key);
}