mirror of
https://github.com/mpv-player/mpv
synced 2025-01-01 04:36:24 +01:00
user settable colorkey
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10989 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
9aefb6b0f0
commit
22c9bcf824
@ -271,6 +271,7 @@ m_option_t mplayer_opts[]={
|
||||
{"fsmode-dontuse", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
|
||||
// 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},
|
||||
// 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},
|
||||
|
@ -47,6 +47,8 @@ float vo_fps=0; // for mp1e rte
|
||||
char *vo_subdevice = NULL;
|
||||
int vo_directrendering=0;
|
||||
|
||||
int vo_colorkey = 0x0000ff00; // default colorkey is green
|
||||
|
||||
//
|
||||
// Externally visible list of all vo drivers
|
||||
//
|
||||
|
@ -211,6 +211,8 @@ extern float vo_fps;
|
||||
|
||||
extern char *vo_subdevice;
|
||||
|
||||
extern int vo_colorkey;
|
||||
|
||||
#if defined(HAVE_FBDEV)||defined(HAVE_VESA)
|
||||
|
||||
typedef struct {
|
||||
|
@ -62,7 +62,7 @@ static XGCValues wGCV;
|
||||
|
||||
static uint32_t mDepth;
|
||||
static XWindowAttributes attribs;
|
||||
static uint32_t fgColor;
|
||||
static int colorkey;
|
||||
|
||||
static uint32_t mvHeight;
|
||||
static uint32_t mvWidth;
|
||||
@ -81,7 +81,7 @@ static void mDrawColorKey( void )
|
||||
{
|
||||
XSetBackground( mDisplay,vo_gc,0 );
|
||||
XClearWindow( mDisplay,vo_window );
|
||||
XSetForeground( mDisplay,vo_gc,fgColor );
|
||||
XSetForeground( mDisplay,vo_gc,colorkey );
|
||||
XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) );
|
||||
XFlush( mDisplay );
|
||||
}
|
||||
@ -112,6 +112,7 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3
|
||||
char * mTitle=(title == NULL) ? "XMGA render" : title;
|
||||
XVisualInfo vinfo;
|
||||
unsigned long xswamask;
|
||||
int r, g, b;
|
||||
|
||||
if(mga_init(width,height,format)) return -1; // ioctl errors?
|
||||
|
||||
@ -129,14 +130,18 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3
|
||||
vo_dwidth=d_width; vo_dheight=d_height;
|
||||
vo_mouse_autohide=1;
|
||||
|
||||
r = (vo_colorkey & 0x00ff0000) >> 16;
|
||||
g = (vo_colorkey & 0x0000ff00) >> 8;
|
||||
b = vo_colorkey & 0x000000ff;
|
||||
switch ( vo_depthonscreen )
|
||||
{
|
||||
case 32:
|
||||
case 24: fgColor=0x00ff00ffL; break;
|
||||
case 16: fgColor=0xf81fL; break;
|
||||
case 15: fgColor=0x7c1fL; break;
|
||||
case 32: colorkey = vo_colorkey; break;
|
||||
case 24: colorkey = vo_colorkey & 0x00ffffff; break;
|
||||
case 16: colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); break;
|
||||
case 15: colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); break;
|
||||
default: mp_msg(MSGT_VO,MSGL_ERR,"Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1;
|
||||
}
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "Using colorkey: %x\n", colorkey);
|
||||
|
||||
inited=1;
|
||||
|
||||
@ -208,9 +213,9 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3
|
||||
panscan_calc();
|
||||
|
||||
mga_vid_config.colkey_on=1;
|
||||
mga_vid_config.colkey_red=255;
|
||||
mga_vid_config.colkey_green=0;
|
||||
mga_vid_config.colkey_blue=255;
|
||||
mga_vid_config.colkey_red=r;
|
||||
mga_vid_config.colkey_green=g;
|
||||
mga_vid_config.colkey_blue=b;
|
||||
|
||||
set_window(); // set up mga_vid_config.dest_width etc
|
||||
|
||||
|
@ -53,8 +53,7 @@ LIBVO_EXTERN(xover)
|
||||
/* X11 related variables */
|
||||
/* Colorkey handling */
|
||||
static XGCValues mGCV;
|
||||
static uint32_t fgColor;
|
||||
static uint32_t bgColor;
|
||||
static int colorkey;
|
||||
|
||||
/* Image parameters */
|
||||
static uint32_t image_width;
|
||||
@ -188,9 +187,9 @@ static void set_window(int force_update)
|
||||
/* mDrawColorKey: */
|
||||
|
||||
/* fill drawable with specified color */
|
||||
XSetBackground( mDisplay,vo_gc,bgColor );
|
||||
XSetBackground(mDisplay, vo_gc, 0L);
|
||||
XClearWindow( mDisplay,vo_window );
|
||||
XSetForeground(mDisplay, vo_gc, fgColor);
|
||||
XSetForeground(mDisplay, vo_gc, colorkey);
|
||||
XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
|
||||
(vo_fs ? drwHeight - 1 : drwHeight));
|
||||
/* flush, update drawable */
|
||||
@ -210,7 +209,7 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
XSetWindowAttributes xswa;
|
||||
unsigned long xswamask;
|
||||
XWindowAttributes attribs;
|
||||
int window_depth;
|
||||
int window_depth, r, g, b;
|
||||
mp_colorkey_t colork;
|
||||
char _title[255];
|
||||
|
||||
@ -233,24 +232,28 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
window_width = d_width;
|
||||
window_height = d_height;
|
||||
|
||||
/* from xmga.c */
|
||||
bgColor = 0x0L;
|
||||
r = (vo_colorkey & 0x00ff0000) >> 16;
|
||||
g = (vo_colorkey & 0x0000ff00) >> 8;
|
||||
b = vo_colorkey & 0x000000ff;
|
||||
switch(vo_depthonscreen)
|
||||
{
|
||||
case 32:
|
||||
colorkey = vo_colorkey;
|
||||
break;
|
||||
case 24:
|
||||
fgColor = 0x00ff00ffL;
|
||||
colorkey = vo_colorkey & 0x00ffffff;
|
||||
break;
|
||||
case 16:
|
||||
fgColor = 0xf81fL;
|
||||
colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
|
||||
break;
|
||||
case 15:
|
||||
fgColor = 0x7c1fL;
|
||||
colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "Sorry, this (%d) color depth is not supported\n",
|
||||
vo_depthonscreen);
|
||||
}
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "Using colorkey: %x\n", colorkey);
|
||||
|
||||
aspect(&d_width, &d_height, A_NOZOOM);
|
||||
|
||||
@ -332,10 +335,10 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "xover: sub vo config failed\n");
|
||||
return 1;
|
||||
}
|
||||
colork.x11 = fgColor;
|
||||
colork.r = 255;
|
||||
colork.g = 0;
|
||||
colork.b = 255;
|
||||
colork.x11 = colorkey;
|
||||
colork.r = r;
|
||||
colork.g = g;
|
||||
colork.b = b;
|
||||
if(sub_vo->control(VOCTRL_XOVERLAY_SET_COLORKEY,&colork) != VO_TRUE)
|
||||
mp_msg(MSGT_VO, MSGL_WARN, "xover: set_colorkey failed\n");
|
||||
|
||||
|
@ -53,8 +53,7 @@ LIBVO_EXTERN(xvidix)
|
||||
/* X11 related variables */
|
||||
/* Colorkey handling */
|
||||
static XGCValues mGCV;
|
||||
static uint32_t fgColor;
|
||||
static uint32_t bgColor;
|
||||
static int colorkey;
|
||||
static vidix_grkey_t gr_key;
|
||||
|
||||
/* VIDIX related */
|
||||
@ -198,9 +197,9 @@ static void set_window(int force_update)
|
||||
/* mDrawColorKey: */
|
||||
|
||||
/* fill drawable with specified color */
|
||||
XSetBackground( mDisplay,vo_gc,bgColor );
|
||||
XSetBackground(mDisplay, vo_gc, 0L);
|
||||
XClearWindow( mDisplay,vo_window );
|
||||
XSetForeground(mDisplay, vo_gc, fgColor);
|
||||
XSetForeground(mDisplay, vo_gc, colorkey);
|
||||
XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
|
||||
(vo_fs ? drwHeight - 1 : drwHeight));
|
||||
/* flush, update drawable */
|
||||
@ -220,7 +219,7 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
XSetWindowAttributes xswa;
|
||||
unsigned long xswamask;
|
||||
XWindowAttributes attribs;
|
||||
int window_depth;
|
||||
int window_depth, r, g, b;
|
||||
|
||||
title = "MPlayer VIDIX X11 Overlay";
|
||||
|
||||
@ -246,24 +245,28 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
// if (vo_fs)
|
||||
// { vo_old_width=d_width; vo_old_height=d_height; }
|
||||
|
||||
/* from xmga.c */
|
||||
bgColor = 0x0L;
|
||||
r = (vo_colorkey & 0x00ff0000) >> 16;
|
||||
g = (vo_colorkey & 0x0000ff00) >> 8;
|
||||
b = vo_colorkey & 0x000000ff;
|
||||
switch(vo_depthonscreen)
|
||||
{
|
||||
case 32:
|
||||
colorkey = vo_colorkey;
|
||||
break;
|
||||
case 24:
|
||||
fgColor = 0x00ff00ffL;
|
||||
colorkey = vo_colorkey & 0x00ffffff;
|
||||
break;
|
||||
case 16:
|
||||
fgColor = 0xf81fL;
|
||||
colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
|
||||
break;
|
||||
case 15:
|
||||
fgColor = 0x7c1fL;
|
||||
colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "Sorry, this (%d) color depth is not supported\n",
|
||||
vo_depthonscreen);
|
||||
}
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "Using colorkey: %x\n", colorkey);
|
||||
|
||||
aspect(&d_width, &d_height, A_NOZOOM);
|
||||
|
||||
@ -344,9 +347,9 @@ else
|
||||
vidix_grkey_get(&gr_key);
|
||||
gr_key.key_op = KEYS_PUT;
|
||||
gr_key.ckey.op = CKEY_TRUE;
|
||||
gr_key.ckey.red = 255;
|
||||
gr_key.ckey.green = 0;
|
||||
gr_key.ckey.blue = 255;
|
||||
gr_key.ckey.red = r;
|
||||
gr_key.ckey.green = g;
|
||||
gr_key.ckey.blue = b;
|
||||
vidix_grkey_set(&gr_key);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user