gst-editing-services: ges: Keep the track object list sorted in track

Thibault Saunier tsaunier at kemper.freedesktop.org
Wed Jan 11 07:04:31 PST 2012


Module: gst-editing-services
Branch: master
Commit: 9413d9f9e902fef7a36911a009d7232083136119
URL:    http://cgit.freedesktop.org/gstreamer/gst-editing-services/commit/?id=9413d9f9e902fef7a36911a009d7232083136119

Author: Mathieu Duponchelle <seeed at laposte.net>
Date:   Wed Jul 27 02:04:48 2011 +0200

ges: Keep the track object list sorted in track

---

 ges/ges-track.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/ges/ges-track.c b/ges/ges-track.c
index c61451a..71cc6cb 100644
--- a/ges/ges-track.c
+++ b/ges/ges-track.c
@@ -69,6 +69,9 @@ static void
 pad_removed_cb (GstElement * element, GstPad * pad, GESTrack * track);
 static void composition_duration_cb (GstElement * composition, GParamSpec * arg
     G_GNUC_UNUSED, GESTrack * obj);
+static void
+sort_track_objects_cb (GESTrackObject * child,
+    GParamSpec * arg G_GNUC_UNUSED, GESTrack * track);
 
 static void
 ges_track_get_property (GObject * object, guint property_id,
@@ -409,6 +412,12 @@ ges_track_add_object (GESTrack * track, GESTrackObject * object)
   g_signal_emit (track, ges_track_signals[TRACK_OBJECT_ADDED], 0,
       GES_TRACK_OBJECT (object));
 
+  g_signal_connect (GES_TRACK_OBJECT (object), "notify::start",
+      G_CALLBACK (sort_track_objects_cb), track);
+
+  g_signal_connect (GES_TRACK_OBJECT (object), "notify::priority",
+      G_CALLBACK (sort_track_objects_cb), track);
+
   return TRUE;
 }
 
@@ -534,6 +543,15 @@ composition_duration_cb (GstElement * composition,
   }
 }
 
+static void
+sort_track_objects_cb (GESTrackObject * child,
+    GParamSpec * arg G_GNUC_UNUSED, GESTrack * track)
+{
+  track->priv->trackobjects =
+      g_list_sort (track->priv->trackobjects,
+      (GCompareFunc) objects_start_compare);
+}
+
 /**
  * ges_track_get_caps:
  * @track: a #GESTrack



More information about the gstreamer-commits mailing list