GESTrackObject: add an hashtable linking childs properityName -> GstElement
authorThibault Saunier <thibault.saunier@collabora.co.uk>
Mon, 7 Feb 2011 16:06:01 +0000 (17:06 +0100)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 6 May 2011 08:39:02 +0000 (10:39 +0200)
We also add a Virtual method that should be implementented in subclasses to generate the new GHasTable

ges/ges-track-object.c
ges/ges-track-object.h

index 2e1106ed6a26f7957a954cba1843e66ff6f5ba33..c560a6e2f1f68d18719a698c644444d4b18a51be 100644 (file)
@@ -49,6 +49,11 @@ struct _GESTrackObjectPrivate
   GstElement *gnlobject;        /* The GnlObject */
   GstElement *element;          /* The element contained in the gnlobject (can be NULL) */
 
+  /* We keep a link between properties name and elements internally
+   * The hashtable should look like
+   * {'ClassName-propertyName' ---> element,}*/
+  GHashTable *properties_hashtable;
+
   GESTimelineObject *timelineobj;
   GESTrack *track;
 
@@ -156,6 +161,10 @@ ges_track_object_set_property (GObject * object, guint property_id,
 static void
 ges_track_object_dispose (GObject * object)
 {
+  GESTrackObjectPrivate *priv = GES_TRACK_OBJECT (object)->priv;
+  if (priv->properties_hashtable)
+    g_hash_table_destroy (priv->properties_hashtable);
+
   G_OBJECT_CLASS (ges_track_object_parent_class)->dispose (object);
 }
 
@@ -259,6 +268,7 @@ ges_track_object_init (GESTrackObject * self)
   self->priv->pending_priority = 1;
   self->priv->pending_active = TRUE;
   self->priv->locked = TRUE;
+  self->priv->properties_hashtable = NULL;
 }
 
 static inline gboolean
@@ -625,6 +635,7 @@ ensure_gnl_object (GESTrackObject * object)
 {
   GESTrackObjectClass *class;
   GstElement *gnlobject;
+  GHashTable *props_hash;
   gboolean res = FALSE;
 
   if (object->priv->gnlobject && object->priv->valid)
@@ -684,6 +695,17 @@ ensure_gnl_object (GESTrackObject * object)
           "priority", object->priv->pending_priority,
           "active", object->priv->pending_active, NULL);
 
+      /*  We feed up the props_hashtable if possible */
+      if (class->get_props_hastable) {
+        props_hash = class->get_props_hastable (object);
+
+        if (props_hash == NULL) {
+          GST_DEBUG ("'get_props_hastable' implementation returned TRUE but no\
+                 properties_hashtable is available");
+        } else {
+          object->priv->properties_hashtable = props_hash;
+        }
+      }
     }
   }
 
index 926ac7dbf0e65f64e47875adb7fffebc2c80aa3a..bc4aadbb751b4222d98aa58a304f128495a28727 100644 (file)
@@ -118,6 +118,7 @@ struct _GESTrackObjectClass {
   const gchar *gnlobject_factorytype;
   GstElement* (*create_gnl_object) (GESTrackObject * object);
   GstElement* (*create_element) (GESTrackObject * object);
+  GHashTable* (*get_props_hastable) (GESTrackObject * object);
 
   void (*start_changed) (GESTrackObject *object, guint64 start);
   void (*media_start_changed) (GESTrackObject *object, guint64 media_start);