diff options
author | Stefan Kost <ensonic@users.sourceforge.net> | 2008-07-29 08:59:32 +0000 |
---|---|---|
committer | Stefan Kost <ensonic@users.sourceforge.net> | 2008-07-29 08:59:32 +0000 |
commit | 95376f913027a8f5f55452f88dddffdb8ece5c80 (patch) | |
tree | 5d618927a7cae78a2954b1cfcaefc89b59d1dc71 /sys | |
parent | e98057986b7a55bc04346dd294c219c624982260 (diff) |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/xvimage/xvimagesink.c | 32 | ||||
-rw-r--r-- | sys/xvimage/xvimagesink.h | 8 |
2 files changed, 36 insertions, 4 deletions
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 96c70edf..21f3d652 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 7142d2ac..295dce76 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 { |