gst-editing-services: ges: Handle the new SourceMoved API in PitiviFormatter

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


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

Author: Thibault Saunier <thibault.saunier at collabora.com>
Date:   Wed Jan  4 15:06:11 2012 -0300

ges: Handle the new SourceMoved API in PitiviFormatter

---

 ges/ges-pitivi-formatter.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/ges/ges-pitivi-formatter.c b/ges/ges-pitivi-formatter.c
index 73a3090..995063e 100644
--- a/ges/ges-pitivi-formatter.c
+++ b/ges/ges-pitivi-formatter.c
@@ -16,7 +16,8 @@ static gboolean save_pitivi_timeline_to_uri (GESFormatter * pitivi_formatter,
 static gboolean load_pitivi_file_from_uri (GESFormatter * self,
     GESTimeline * timeline, const gchar * uri);
 static void ges_pitivi_formatter_finalize (GObject * object);
-
+static gboolean pitivi_formatter_update_source_uri (GESFormatter * formatter,
+    GESTimelineFileSource * tfs, gchar * new_uri);
 
 typedef struct SrcMapping
 {
@@ -80,6 +81,7 @@ ges_pitivi_formatter_class_init (GESPitiviFormatterClass * klass)
 
   formatter_klass->save_to_uri = save_pitivi_timeline_to_uri;
   formatter_klass->load_from_uri = load_pitivi_file_from_uri;
+  formatter_klass->update_source_uri = pitivi_formatter_update_source_uri;
   object_class->finalize = ges_pitivi_formatter_finalize;
 }
 
@@ -1077,3 +1079,25 @@ load_pitivi_file_from_uri (GESFormatter * self,
   xmlFreeDoc (doc);
   return ret;
 }
+
+static gboolean
+pitivi_formatter_update_source_uri (GESFormatter * formatter,
+    GESTimelineFileSource * tfs, gchar * new_uri)
+{
+  GESTimelineObject *tlobj = GES_TIMELINE_OBJECT (tfs);
+  GESTimelineLayer *layer = ges_timeline_object_get_layer (tlobj);
+  gboolean ret;
+
+  /*Keep a ref to it as we don't want it to be destroyed! */
+  g_object_ref (tlobj);
+
+  ges_timeline_layer_remove_object (layer, tlobj);
+
+  g_object_set (tfs, "uri", new_uri, NULL);
+  ret = ges_timeline_layer_add_object (layer, tlobj);
+
+  /* We do not need our reference anymore */
+  g_object_unref (tlobj);
+
+  return ret;
+}



More information about the gstreamer-commits mailing list