ges-launch: Make use of assets for uri clips
authorThibault Saunier <thibault.saunier@collabora.com>
Wed, 12 Jun 2013 14:48:03 +0000 (10:48 -0400)
committerThibault Saunier <thibault.saunier@collabora.com>
Wed, 12 Jun 2013 14:49:50 +0000 (10:49 -0400)
It avoids races in TrackElement creations.

We should make use of assets everywhere in ges-launch but start using
them for uriclips first for now.

tools/ges-launch.c

index cef2409..30cb138 100644 (file)
@@ -203,15 +203,31 @@ create_timeline (int nbargs, gchar ** argv, gchar * audio, gchar * video)
 
     else {
       gchar *uri;
+      GESAsset *asset;
       guint64 inpoint;
 
+      GError *error = NULL;
+
       if (!(uri = ensure_uri (source))) {
         GST_ERROR ("couldn't create uri for '%s'", source);
         goto build_failure;
       }
 
       inpoint = str_to_time (argv[i * 3 + 1]);
-      clip = GES_CLIP (ges_uri_clip_new (uri));
+      asset = GES_ASSET (ges_uri_clip_asset_request_sync (uri, &error));
+      if (error) {
+        g_printerr ("Can not create asset for %s", uri);
+
+        return NULL;
+      }
+
+      clip = GES_CLIP (ges_asset_extract (asset, &error));
+      if (error) {
+        g_printerr ("Can not extract asset for %s", uri);
+
+        return NULL;
+      }
+
       g_object_set (clip,
           "in-point", (guint64) inpoint, "duration", (guint64) duration, NULL);