From 95376f913027a8f5f55452f88dddffdb8ece5c80 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 29 Jul 2008 08:59:32 +0000 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ sys/xvimage/xvimagesink.c | 32 ++++++++++++++++++++++++++++++-- sys/xvimage/xvimagesink.h | 8 ++++++-- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12092b14d..23a5fe6f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-29 Stefan Kost + + * sys/xvimage/xvimagesink.c: + * sys/xvimage/xvimagesink.h: + Add autofill/colorkey properties. Fixes #538656. + 2008-07-28 David Schleef * sys/xvimage/xvimagesink.c: diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 96c70edf5..21f3d652b 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -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; diff --git a/sys/xvimage/xvimagesink.h b/sys/xvimage/xvimagesink.h index 7142d2aca..295dce76b 100644 --- a/sys/xvimage/xvimagesink.h +++ b/sys/xvimage/xvimagesink.h @@ -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 { -- 2.34.1