mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
scenarios: Check priority before creating a layer.
This commit is contained in:
parent
171710f0c5
commit
0de6ecebcf
1 changed files with 25 additions and 17 deletions
|
@ -160,23 +160,6 @@ _add_asset (GstValidateScenario *scenario, GstValidateAction *action)
|
||||||
return ges_project_add_asset(project, asset);
|
return ges_project_add_asset(project, asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
_add_layer (GstValidateScenario *scenario, GstValidateAction *action)
|
|
||||||
{
|
|
||||||
GESTimeline *timeline = get_timeline(scenario);
|
|
||||||
GESLayer *layer;
|
|
||||||
gint priority;
|
|
||||||
|
|
||||||
if (!gst_structure_get_int(action->structure, "priority", &priority)) {
|
|
||||||
GST_ERROR("priority is needed when adding a layer");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
layer = ges_layer_new();
|
|
||||||
g_object_set(layer, "priority", priority, NULL);
|
|
||||||
return ges_timeline_add_layer(timeline, layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unref after usage */
|
/* Unref after usage */
|
||||||
static GESLayer *
|
static GESLayer *
|
||||||
_get_layer_by_priority(GESTimeline *timeline, gint priority)
|
_get_layer_by_priority(GESTimeline *timeline, gint priority)
|
||||||
|
@ -199,6 +182,31 @@ _get_layer_by_priority(GESTimeline *timeline, gint priority)
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_add_layer (GstValidateScenario *scenario, GstValidateAction *action)
|
||||||
|
{
|
||||||
|
GESTimeline *timeline = get_timeline(scenario);
|
||||||
|
GESLayer *layer;
|
||||||
|
gint priority;
|
||||||
|
|
||||||
|
if (!gst_structure_get_int(action->structure, "priority", &priority)) {
|
||||||
|
GST_ERROR("priority is needed when adding a layer");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
layer = _get_layer_by_priority(timeline, priority);
|
||||||
|
|
||||||
|
if (layer != NULL) {
|
||||||
|
GST_ERROR("A layer with priority %d already exists, not creating a new one", priority);
|
||||||
|
gst_object_unref(layer);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
layer = ges_layer_new();
|
||||||
|
g_object_set(layer, "priority", priority, NULL);
|
||||||
|
return ges_timeline_add_layer(timeline, layer);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_remove_layer (GstValidateScenario *scenario, GstValidateAction *action)
|
_remove_layer (GstValidateScenario *scenario, GstValidateAction *action)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue