static GESTimelinePipeline * create_pipeline (gchar * load_path, gchar * save_path, int argc, char **argv, gchar * audio, gchar * video) { GESTimelinePipeline *pipeline = NULL; GESTimeline *timeline = NULL; /* Timeline creation */ if (load_path) { gchar *uri; g_printf ("Loading project from : %s\n", load_path); if (!(uri = ensure_uri (load_path))) { g_error ("couldn't create uri for '%s'", load_path); goto failure; } g_printf ("reading from '%s' (arguments ignored)\n", load_path); if (!(timeline = ges_timeline_new_from_uri (uri))) { g_error ("failed to create timeline from file '%s'", load_path); goto failure; } g_printf ("loaded project successfully\n"); g_free (uri); } else /* Normal timeline creation */ if (!(timeline = create_timeline (argc, argv, audio, video))) goto failure; /* save project if path is given. we do this now in case GES crashes or * hangs during playback. */ if (save_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); g_free (uri); } /* In order to view our timeline, let's grab a convenience pipeline to put * our timeline in. */ pipeline = ges_timeline_pipeline_new (); /* Add the timeline to that pipeline */ if (!ges_timeline_pipeline_add_timeline (pipeline, timeline)) goto failure; return pipeline; failure: { if (timeline) g_object_unref (timeline); if (pipeline) g_object_unref (pipeline); return NULL; } }
static gboolean _serialize_project (GstValidateScenario * scenario, GstValidateAction * action) { const gchar *uri = gst_structure_get_string (action->structure, "uri"); GESTimeline *timeline = get_timeline (scenario); gboolean res; gst_validate_printf (action, "Saving project to %s", uri); res = ges_timeline_save_to_uri (timeline, uri, NULL, TRUE, NULL); g_object_unref(timeline); return res; }