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,9 +209,14 @@ _load_project (GESProject * project, GESTimeline * timeline, GError ** error)
g_signal_emit (project, _signals[LOADING_SIGNAL], 0, timeline);
if (priv->uri == NULL) {
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);
GST_LOG_OBJECT (project, "%s, Loading an empty timeline %s"
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)));
@ -222,6 +227,7 @@ _load_project (GESProject * project, GESTimeline * timeline, GError ** error)
g_idle_add ((GSourceFunc) _emit_loaded_in_idle, data);
return TRUE;
}
}
if (priv->formatter_asset == NULL)
priv->formatter_asset = _find_formatter_asset_for_id (priv->uri);