mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
ges/ges-simple-timeline-layer.c: implement simple stair-step like priority
management scheme.
This commit is contained in:
parent
3118c0f510
commit
e5ae1405c8
1 changed files with 40 additions and 2 deletions
|
@ -29,6 +29,8 @@
|
||||||
#include "ges-internal.h"
|
#include "ges-internal.h"
|
||||||
#include "ges-simple-timeline-layer.h"
|
#include "ges-simple-timeline-layer.h"
|
||||||
#include "ges-timeline-object.h"
|
#include "ges-timeline-object.h"
|
||||||
|
#include "ges-timeline-source.h"
|
||||||
|
#include "ges-timeline-transition.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_simple_timeline_layer_object_removed (GESTimelineLayer * layer,
|
ges_simple_timeline_layer_object_removed (GESTimelineLayer * layer,
|
||||||
|
@ -100,17 +102,53 @@ gstl_recalculate (GESSimpleTimelineLayer * self)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
GstClockTime pos = 0;
|
GstClockTime pos = 0;
|
||||||
|
gint priority = GES_TIMELINE_LAYER (self)->min_gnl_priority;
|
||||||
|
GESTimelineObject *prev_object = NULL;
|
||||||
|
|
||||||
GST_DEBUG ("recalculating values");
|
GST_DEBUG ("recalculating values");
|
||||||
|
|
||||||
for (tmp = self->objects; tmp; tmp = tmp->next) {
|
for (tmp = self->objects; tmp; tmp = tmp->next) {
|
||||||
GESTimelineObject *obj = (GESTimelineObject *) tmp->data;
|
GESTimelineObject *obj = (GESTimelineObject *) tmp->data;
|
||||||
|
GST_DEBUG ("%p, %ld", obj, pos);
|
||||||
|
|
||||||
|
if (GES_IS_TIMELINE_SOURCE (obj)) {
|
||||||
|
GST_DEBUG ("%p is a source\n", obj);
|
||||||
|
priority++;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (GES_TIMELINE_OBJECT_START (obj) != pos)) {
|
||||||
|
ges_timeline_object_set_start (obj, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (G_UNLIKELY (GES_TIMELINE_OBJECT_PRIORITY (obj) != priority)) {
|
||||||
|
ges_timeline_object_set_priority (obj, priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
pos += GES_TIMELINE_OBJECT_DURATION (obj);
|
||||||
|
} else if (GES_IS_TIMELINE_TRANSITION (obj)) {
|
||||||
|
GST_DEBUG ("%p is transition\n", obj);
|
||||||
|
|
||||||
|
if (GES_IS_TIMELINE_TRANSITION (prev_object)) {
|
||||||
|
GST_ERROR ("two transitions in sequence!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GES_IS_TIMELINE_SOURCE (prev_object)) {
|
||||||
|
pos -= GES_TIMELINE_OBJECT_DURATION (obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (G_UNLIKELY (GES_TIMELINE_OBJECT_PRIORITY (obj) != priority)) {
|
||||||
|
ges_timeline_object_set_priority (obj, priority - 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (G_UNLIKELY (GES_TIMELINE_OBJECT_START (obj) != pos)) {
|
|
||||||
ges_timeline_object_set_start (obj, pos);
|
ges_timeline_object_set_start (obj, pos);
|
||||||
}
|
}
|
||||||
pos += GES_TIMELINE_OBJECT_DURATION (obj);
|
|
||||||
|
GST_DEBUG (", %ld\n", pos);
|
||||||
|
|
||||||
|
prev_object = obj;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GES_TIMELINE_LAYER (self)->max_gnl_priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue