From 20d94bea134330d7d3ce76b70b4e56b350d841b2 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sun, 1 Mar 2015 13:10:55 +0100 Subject: [PATCH] ges: Accept path as URI in the create clip structured interface --- ges/ges-structured-interface.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ges/ges-structured-interface.c b/ges/ges-structured-interface.c index 3a940cb2bc..5ff474a172 100644 --- a/ges/ges-structured-interface.c +++ b/ges/ges-structured-interface.c @@ -245,6 +245,14 @@ done: } \ } G_STMT_END +static gchar * +ensure_uri (gchar * location) +{ + if (gst_uri_is_valid (location)) + return g_strdup (location); + else + return gst_filename_to_uri (location, NULL); +} gboolean _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure, @@ -255,7 +263,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure, GESClip *clip; gint layer_priority; const gchar *name; - const gchar *asset_id; + gchar *asset_id = NULL; const gchar *type_string; GType type; gboolean res = FALSE; @@ -290,6 +298,12 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure, goto beach; } + if (type == GES_TYPE_URI_CLIP) { + asset_id = ensure_uri (asset_id); + } else { + asset_id = g_strdup (asset_id); + } + asset = _ges_get_asset_from_timeline (timeline, type, asset_id, error); if (!asset) { res = FALSE; @@ -339,6 +353,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure, gst_object_unref (layer); beach: + g_free (asset_id); return res; }