From 396196dfdf29a6b150f12c627ceee7ca74fba69c Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 20 Feb 2015 12:12:52 +0100 Subject: [PATCH] ges: Add layer up to the wanted layer priority in the structure interface Making the thing easier to use --- ges/ges-structured-interface.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ges/ges-structured-interface.c b/ges/ges-structured-interface.c index 00de33d..387a6cf 100644 --- a/ges/ges-structured-interface.c +++ b/ges/ges-structured-interface.c @@ -135,11 +135,21 @@ GESLayer * _ges_get_layer_by_priority (GESTimeline * timeline, gint priority) { GList *layers, *tmp; + gint nlayers; GESLayer *layer = NULL; layers = ges_timeline_get_layers (timeline); - if (priority == (gint) g_list_length (layers)) { - layer = gst_object_ref (ges_timeline_append_layer (timeline)); + nlayers = (gint) g_list_length (layers); + if (priority >= nlayers) { + gint i = nlayers; + + while (i <= priority) { + layer = ges_timeline_append_layer (timeline); + + i++; + } + + layer = gst_object_ref (layer); goto done; } -- 2.7.4