[gst-cvs] gst-plugins-good: smptealpha: Correctly detect property changes and update properties

Sebastian Dröge slomo at kemper.freedesktop.org
Thu Apr 29 10:36:21 PDT 2010


Module: gst-plugins-good
Branch: master
Commit: e17954aa6b521122f92b5563853f294ddf91cb6d
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=e17954aa6b521122f92b5563853f294ddf91cb6d

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Thu Apr 15 22:27:57 2010 +0200

smptealpha: Correctly detect property changes and update properties

---

 gst/smpte/gstsmptealpha.c |   39 +++++++++++++++++++++++++++------------
 1 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/gst/smpte/gstsmptealpha.c b/gst/smpte/gstsmptealpha.c
index 16c3d13..dbebb73 100644
--- a/gst/smpte/gstsmptealpha.c
+++ b/gst/smpte/gstsmptealpha.c
@@ -253,6 +253,16 @@ gst_smpte_alpha_update_mask (GstSMPTEAlpha * smpte, gint type, gint depth,
       return TRUE;
   }
 
+  smpte->type = type;
+  smpte->depth = depth;
+  smpte->width = width;
+  smpte->height = height;
+
+  /* Not negotiated yet */
+  if (width == 0 || height == 0) {
+    return TRUE;
+  }
+
   newmask = gst_mask_factory_new (type, depth, width, height);
   if (!newmask)
     goto mask_failed;
@@ -261,10 +271,6 @@ gst_smpte_alpha_update_mask (GstSMPTEAlpha * smpte, gint type, gint depth,
     gst_mask_destroy (smpte->mask);
 
   smpte->mask = newmask;
-  smpte->type = type;
-  smpte->depth = depth;
-  smpte->width = width;
-  smpte->height = height;
 
   return TRUE;
 
@@ -376,6 +382,7 @@ gst_smpte_alpha_init (GstSMPTEAlpha * smpte)
   smpte->type = DEFAULT_PROP_TYPE;
   smpte->border = DEFAULT_PROP_BORDER;
   smpte->depth = DEFAULT_PROP_DEPTH;
+  smpte->position = DEFAULT_PROP_POSITION;
 }
 
 static void
@@ -557,33 +564,41 @@ gst_smpte_alpha_set_property (GObject * object, guint prop_id,
   smpte = GST_SMPTE_ALPHA (object);
 
   switch (prop_id) {
-    case PROP_TYPE:
+    case PROP_TYPE:{
+      gint type;
+
+      type = g_value_get_enum (value);
+
       GST_BASE_TRANSFORM_LOCK (smpte);
       /* also lock with the object lock so that reading the property doesn't
        * have to wait for the transform lock */
       GST_OBJECT_LOCK (smpte);
-      smpte->type = g_value_get_enum (value);
       GST_OBJECT_UNLOCK (smpte);
-      gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->depth,
-          smpte->width, smpte->height);
+      gst_smpte_alpha_update_mask (smpte, type,
+          smpte->depth, smpte->width, smpte->height);
       GST_BASE_TRANSFORM_UNLOCK (smpte);
       break;
+    }
     case PROP_BORDER:
       GST_OBJECT_LOCK (smpte);
       smpte->border = g_value_get_int (value);
       GST_OBJECT_UNLOCK (smpte);
       break;
-    case PROP_DEPTH:
+    case PROP_DEPTH:{
+      gint depth;
+
+      depth = g_value_get_int (value);
+
       GST_BASE_TRANSFORM_LOCK (smpte);
       /* also lock with the object lock so that reading the property doesn't
        * have to wait for the transform lock */
       GST_OBJECT_LOCK (smpte);
-      smpte->depth = g_value_get_int (value);
       GST_OBJECT_UNLOCK (smpte);
-      gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->depth,
-          smpte->width, smpte->height);
+      gst_smpte_alpha_update_mask (smpte, smpte->type,
+          depth, smpte->width, smpte->height);
       GST_BASE_TRANSFORM_UNLOCK (smpte);
       break;
+    }
     case PROP_POSITION:
       GST_OBJECT_LOCK (smpte);
       smpte->position = g_value_get_double (value);





More information about the Gstreamer-commits mailing list