From dc463e2550d6d80100fae027e5fbbae08d99c17f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20G=C3=B6pfert?= Date: Thu, 29 Nov 2018 19:12:24 +0100 Subject: [PATCH] add assets to layer and adjust position and duration (closes #45) --- examples/c/concatenate.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/c/concatenate.c b/examples/c/concatenate.c index f84dea174d..3a0f54e510 100644 --- a/examples/c/concatenate.c +++ b/examples/c/concatenate.c @@ -27,7 +27,9 @@ bus_message_cb (GstBus * bus, GstMessage * message, GMainLoop * mainloop); static GstEncodingProfile *make_profile_from_info (GstDiscovererInfo * info); +GESLayer *layer = NULL; GESPipeline *pipeline = NULL; +GESTimeline *timeline = NULL; gchar *output_uri = NULL; guint assetsCount = 0; guint assetsLoaded = 0; @@ -37,16 +39,23 @@ asset_loaded_cb (GObject * source_object, GAsyncResult * res, GMainLoop * mainloop) { GError *error = NULL; + guint64 duration = 0; GESUriClipAsset *mfs = GES_URI_CLIP_ASSET (ges_asset_request_finish (res, &error)); if (error) { - GST_WARNING ("error creating asseti %s", error->message); + GST_WARNING ("error creating asset %s", error->message); return; } + duration = ges_uri_clip_asset_get_duration (mfs); + ges_layer_add_asset (layer, + GES_ASSET (source_object), + ges_timeline_get_duration (timeline), + 0, duration, ges_clip_asset_get_supported_formats (GES_CLIP_ASSET (mfs))); + assetsLoaded++; /* * Check if we have loaded last asset and trigger concatenating @@ -71,7 +80,6 @@ main (int argc, char **argv) { GMainLoop *mainloop = NULL; GESTimeline *timeline; - GESLayer *layer = NULL; GstBus *bus = NULL; guint i;