add assets to layer and adjust position and duration (closes #45)

This commit is contained in:
Jens Göpfert 2018-11-29 19:12:24 +01:00 committed by Thibault Saunier
parent 3b182342e0
commit dc463e2550

View file

@ -27,7 +27,9 @@ bus_message_cb (GstBus * bus, GstMessage * message, GMainLoop * mainloop);
static GstEncodingProfile *make_profile_from_info (GstDiscovererInfo * info); static GstEncodingProfile *make_profile_from_info (GstDiscovererInfo * info);
GESLayer *layer = NULL;
GESPipeline *pipeline = NULL; GESPipeline *pipeline = NULL;
GESTimeline *timeline = NULL;
gchar *output_uri = NULL; gchar *output_uri = NULL;
guint assetsCount = 0; guint assetsCount = 0;
guint assetsLoaded = 0; guint assetsLoaded = 0;
@ -37,16 +39,23 @@ asset_loaded_cb (GObject * source_object, GAsyncResult * res,
GMainLoop * mainloop) GMainLoop * mainloop)
{ {
GError *error = NULL; GError *error = NULL;
guint64 duration = 0;
GESUriClipAsset *mfs = GESUriClipAsset *mfs =
GES_URI_CLIP_ASSET (ges_asset_request_finish (res, &error)); GES_URI_CLIP_ASSET (ges_asset_request_finish (res, &error));
if (error) { if (error) {
GST_WARNING ("error creating asseti %s", error->message); GST_WARNING ("error creating asset %s", error->message);
return; 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++; assetsLoaded++;
/* /*
* Check if we have loaded last asset and trigger concatenating * Check if we have loaded last asset and trigger concatenating
@ -71,7 +80,6 @@ main (int argc, char **argv)
{ {
GMainLoop *mainloop = NULL; GMainLoop *mainloop = NULL;
GESTimeline *timeline; GESTimeline *timeline;
GESLayer *layer = NULL;
GstBus *bus = NULL; GstBus *bus = NULL;
guint i; guint i;