sys/xvimage/xvimagesink.*: Add autofill/colorkey properties. Fixes #538656.

Original commit message from CVS:
* sys/xvimage/xvimagesink.c:
* sys/xvimage/xvimagesink.h:
Add autofill/colorkey properties. Fixes #538656.
This commit is contained in:
Stefan Kost 2008-07-29 08:59:32 +00:00
parent e98057986b
commit 95376f9130
3 changed files with 42 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2008-07-29 Stefan Kost <ensonic@users.sf.net>
* sys/xvimage/xvimagesink.c:
* sys/xvimage/xvimagesink.h:
Add autofill/colorkey properties. Fixes #538656.
2008-07-28 David Schleef <ds@schleef.org>
* sys/xvimage/xvimagesink.c:

View file

@ -188,7 +188,9 @@ enum
ARG_DEVICE,
ARG_DEVICE_NAME,
ARG_HANDLE_EXPOSE,
ARG_DOUBLE_BUFFER
ARG_DOUBLE_BUFFER,
ARG_AUTOPAINT_COLORKEY,
ARG_COLORKEY
};
static GstVideoSinkClass *parent_class = NULL;
@ -1361,7 +1363,9 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
if (!strcmp (attr[i].name, autopaint)) {
const Atom atom = XInternAtom (xcontext->disp, autopaint, False);
XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom, 1);
/* turn on autopaint colorkey */
XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
(xvimagesink->autopaint_colorkey ? 1 : 0));
todo--;
} else if (!strcmp (attr[i].name, dbl_buffer)) {
const Atom atom = XInternAtom (xcontext->disp, dbl_buffer, False);
@ -1396,6 +1400,8 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
else
set_attr = FALSE;
xvimagesink->colorkey = (1 << 16) | (2 << 8) | 3;
if (set_attr) {
ckey = CLAMP (ckey, (guint32) attr[i].min_value,
(guint32) attr[i].max_value);
@ -2899,6 +2905,9 @@ gst_xvimagesink_set_property (GObject * object, guint prop_id,
case ARG_DOUBLE_BUFFER:
xvimagesink->double_buffer = g_value_get_boolean (value);
break;
case ARG_AUTOPAINT_COLORKEY:
xvimagesink->autopaint_colorkey = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -2966,6 +2975,12 @@ gst_xvimagesink_get_property (GObject * object, guint prop_id,
case ARG_DOUBLE_BUFFER:
g_value_set_boolean (value, xvimagesink->double_buffer);
break;
case ARG_AUTOPAINT_COLORKEY:
g_value_set_boolean (value, xvimagesink->autopaint_colorkey);
break;
case ARG_COLORKEY:
g_value_set_int (value, xvimagesink->colorkey);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -3006,6 +3021,8 @@ gst_xvimagesink_reset (GstXvImageSink * xvimagesink)
}
gst_xvimagesink_xcontext_clear (xvimagesink);
xvimagesink->colorkey = -1;
}
/* Finalize is called only once, dispose can be called multiple times.
@ -3077,6 +3094,9 @@ gst_xvimagesink_init (GstXvImageSink * xvimagesink)
xvimagesink->handle_events = TRUE;
xvimagesink->par = NULL;
xvimagesink->handle_expose = TRUE;
xvimagesink->autopaint_colorkey = TRUE;
xvimagesink->colorkey = -1;
}
static void
@ -3157,6 +3177,14 @@ gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
g_param_spec_boolean ("double-buffer", "Double-buffer",
"Whether to double-buffer the output", TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_AUTOPAINT_COLORKEY,
g_param_spec_boolean ("autopaint-colorkey", "Autofill with colorkey",
"Whether to autofill overlay with colorkey", TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_COLORKEY,
g_param_spec_int ("colorkey", "Colorkey",
"Color to use for the overlay mask", G_MININT, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gobject_class->finalize = gst_xvimagesink_finalize;

View file

@ -263,8 +263,12 @@ struct _GstXvImageSink {
gint saturation;
gboolean cb_changed;
guint video_width, video_height; /* size of incoming video;
* used as the size for XvImage */
/* size of incoming video, used as the size for XvImage */
guint video_width, video_height;
/* port attributes */
gboolean autopaint_colorkey;
gint colorkey;
};
struct _GstXvImageSinkClass {