project: Use asset ID as URI if possible

It was making no sense to consider it an empty timeline when the user
had passed the project URI when requesting the asset. Usually user
use `ges_project_new` with the URI but it is also valid to use
`ges_asset_request` with the uri as ID so let's handle that properly.
This commit is contained in:
Thibault Saunier 2019-07-09 00:05:21 -04:00
parent 2c08770cf0
commit cb1ee4b641

View file

@ -209,18 +209,24 @@ _load_project (GESProject * project, GESTimeline * timeline, GError ** error)
g_signal_emit (project, _signals[LOADING_SIGNAL], 0, timeline);
if (priv->uri == NULL) {
EmitLoadedInIdle *data = g_slice_new (EmitLoadedInIdle);
GST_LOG_OBJECT (project, "%s, Loading an empty timeline %s"
" as no URI set yet", GST_OBJECT_NAME (timeline),
ges_asset_get_id (GES_ASSET (project)));
if (gst_uri_is_valid (ges_asset_get_id (GES_ASSET (project)))) {
ges_project_set_uri (project, ges_asset_get_id (GES_ASSET (project)));
GST_INFO_OBJECT (project, "Using asset ID %s as URI.", priv->uri);
} else {
EmitLoadedInIdle *data = g_slice_new (EmitLoadedInIdle);
data->timeline = gst_object_ref (timeline);
data->project = gst_object_ref (project);
GST_INFO_OBJECT (project, "%s, Loading an empty timeline %s"
" as no URI set yet", GST_OBJECT_NAME (timeline),
ges_asset_get_id (GES_ASSET (project)));
/* Make sure the signal is emitted after the functions ends */
g_idle_add ((GSourceFunc) _emit_loaded_in_idle, data);
return TRUE;
data->timeline = gst_object_ref (timeline);
data->project = gst_object_ref (project);
/* Make sure the signal is emitted after the functions ends */
g_idle_add ((GSourceFunc) _emit_loaded_in_idle, data);
return TRUE;
}
}
if (priv->formatter_asset == NULL)