ges: add a track-object-added signal to GESTrack
authorMathieu Duponchelle <seeed@laposte.net>
Sun, 28 Aug 2011 01:48:36 +0000 (03:48 +0200)
committerThibault Saunier <thibault.saunier@collabora.com>
Wed, 11 Jan 2012 14:56:14 +0000 (11:56 -0300)
API: GESTrack::track-object-added signal

ges/ges-track.c

index 6d9d5cbd9eebf18bb900ae689fa034ad04c2b1bf..0e808615a675c04ad88169f08718d3c75382013f 100644 (file)
@@ -32,6 +32,7 @@
 #include "ges-internal.h"
 #include "ges-track.h"
 #include "ges-track-object.h"
+#include "gesmarshal.h"
 
 G_DEFINE_TYPE (GESTrack, ges_track, GST_TYPE_BIN);
 
@@ -54,9 +55,13 @@ enum
   ARG_CAPS,
   ARG_TYPE,
   ARG_DURATION,
-  ARG_LAST
+  ARG_LAST,
+  TRACK_OBJECT_ADDED,
+  LAST_SIGNAL
 };
 
+static guint ges_track_signals[LAST_SIGNAL] = { 0 };
+
 static GParamSpec *properties[ARG_LAST];
 
 static void pad_added_cb (GstElement * element, GstPad * pad, GESTrack * track);
@@ -191,6 +196,21 @@ ges_track_class_init (GESTrackClass * klass)
       G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
   g_object_class_install_property (object_class, ARG_TYPE,
       properties[ARG_TYPE]);
+
+  /**
+   * GESTrack::track-object-added
+   * @object: the #GESTrack
+   * @effect: the #GESTrackObject that was added.
+   *
+   * Will be emitted after a track object was added to the track.
+   *
+   * Since: 0.10.2
+   */
+  ges_track_signals[TRACK_OBJECT_ADDED] =
+      g_signal_new ("track-object-added", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_FIRST, 0, NULL, NULL, ges_marshal_VOID__OBJECT,
+      G_TYPE_NONE, 1, GES_TYPE_TRACK_OBJECT);
+
 }
 
 static void
@@ -365,6 +385,8 @@ ges_track_add_object (GESTrack * track, GESTrackObject * object)
   g_object_ref_sink (object);
 
   track->priv->trackobjects = g_list_append (track->priv->trackobjects, object);
+  g_signal_emit (track, ges_track_signals[TRACK_OBJECT_ADDED], 0,
+      GES_TRACK_OBJECT (object));
 
   return TRUE;
 }