tools:ges-launch: Save the project at the end of execution
authorThibault Saunier <tsaunier@gnome.org>
Thu, 25 Sep 2014 12:55:15 +0000 (14:55 +0200)
committerThibault Saunier <tsaunier@gnome.org>
Mon, 10 Nov 2014 15:22:38 +0000 (16:22 +0100)
So that changes from scenarios are taken into account

tools/ges-launch.c

index f5f7c12..bb7613d 100644 (file)
@@ -429,6 +429,22 @@ build_failure:
   }
 }
 
+static gboolean
+_save_timeline (GESTimeline * timeline, const gchar * load_path)
+{
+  if (save_path && !load_path) {
+    gchar *uri;
+    if (!(uri = ensure_uri (save_path))) {
+      g_error ("couldn't create uri for '%s", save_path);
+      return FALSE;
+    }
+
+    return ges_timeline_save_to_uri (timeline, uri, NULL, TRUE, NULL);
+  }
+
+  return TRUE;
+}
+
 static GESPipeline *
 create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
     int argc, char **argv, const gchar * scenario)
@@ -456,14 +472,8 @@ create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
 
   /* save project if path is given. we do this now in case GES crashes or
    * hangs during playback. */
-  if (save_path && !load_path) {
-    gchar *uri;
-    if (!(uri = ensure_uri (save_path))) {
-      g_error ("couldn't create uri for '%s", save_path);
-      goto failure;
-    }
-    ges_timeline_save_to_uri (timeline, uri, NULL, TRUE, NULL);
-  }
+  if (!_save_timeline (timeline, load_path))
+    goto failure;
 
   /* In order to view our timeline, let's grab a convenience pipeline to put
    * our timeline in. */
@@ -985,6 +995,9 @@ main (int argc, gchar ** argv)
 
   gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
 
+  /*  Re save the timeline in case the scenario changed it! */
+  _save_timeline (timeline, load_path);
+
   validate_res = ges_validate_clean (GST_PIPELINE (pipeline));
   if (seenerrors == FALSE)
     seenerrors = validate_res;