mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-02 08:42:32 +00:00
gstl_recalculate() won't set priorities to -1
This commit is contained in:
parent
73814e225d
commit
462cd2b41f
1 changed files with 32 additions and 20 deletions
|
@ -109,10 +109,13 @@ gstl_recalculate (GESSimpleTimelineLayer * self)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
GstClockTime pos = 0;
|
GstClockTime pos = 0;
|
||||||
gint priority = GES_TIMELINE_LAYER (self)->min_gnl_priority;
|
gint priority = 0;
|
||||||
|
gint transition_priority = 0;
|
||||||
GESTimelineObject *prev_object = NULL;
|
GESTimelineObject *prev_object = NULL;
|
||||||
GESTimelineObject *prev_transition = NULL;
|
GESTimelineObject *prev_transition = NULL;
|
||||||
|
|
||||||
|
priority = GES_TIMELINE_LAYER (self)->min_gnl_priority;
|
||||||
|
|
||||||
GST_DEBUG ("recalculating values");
|
GST_DEBUG ("recalculating values");
|
||||||
|
|
||||||
for (tmp = self->objects; tmp; tmp = tmp->next) {
|
for (tmp = self->objects; tmp; tmp = tmp->next) {
|
||||||
|
@ -123,10 +126,10 @@ gstl_recalculate (GESSimpleTimelineLayer * self)
|
||||||
obj = (GESTimelineObject *) tmp->data;
|
obj = (GESTimelineObject *) tmp->data;
|
||||||
dur = GES_TIMELINE_OBJECT_DURATION (obj);
|
dur = GES_TIMELINE_OBJECT_DURATION (obj);
|
||||||
|
|
||||||
GST_DEBUG ("%p, %ld", obj, pos);
|
GST_DEBUG ("obj: %p, %ld", obj, pos);
|
||||||
|
|
||||||
if (GES_IS_TIMELINE_SOURCE (obj)) {
|
if (GES_IS_TIMELINE_SOURCE (obj)) {
|
||||||
GST_DEBUG ("%p is a source\n", obj);
|
|
||||||
priority++;
|
priority++;
|
||||||
|
|
||||||
if (G_UNLIKELY (GES_TIMELINE_OBJECT_START (obj) != pos)) {
|
if (G_UNLIKELY (GES_TIMELINE_OBJECT_START (obj) != pos)) {
|
||||||
|
@ -138,54 +141,63 @@ gstl_recalculate (GESSimpleTimelineLayer * self)
|
||||||
}
|
}
|
||||||
|
|
||||||
pos += dur;
|
pos += dur;
|
||||||
|
|
||||||
|
g_assert (priority != -1);
|
||||||
|
|
||||||
} else if (GES_IS_TIMELINE_TRANSITION (obj)) {
|
} else if (GES_IS_TIMELINE_TRANSITION (obj)) {
|
||||||
GST_DEBUG ("%p is transition\n", obj);
|
GST_LOG ("%p is transition\n", obj);
|
||||||
|
|
||||||
|
pos -= dur;
|
||||||
|
transition_priority = MAX (0, priority - 1);
|
||||||
|
|
||||||
|
g_assert (transition_priority != -1);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (GES_TIMELINE_OBJECT_START (obj) != pos))
|
||||||
|
ges_timeline_object_set_start (obj, pos);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (GES_TIMELINE_OBJECT_PRIORITY (obj) !=
|
||||||
|
transition_priority)) {
|
||||||
|
ges_timeline_object_set_priority (obj, transition_priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sanity checks */
|
||||||
|
l_next = g_list_next (tmp);
|
||||||
|
|
||||||
if (GES_IS_TIMELINE_TRANSITION (prev_object)) {
|
if (GES_IS_TIMELINE_TRANSITION (prev_object)) {
|
||||||
GST_ERROR ("two transitions in sequence!");
|
GST_ERROR ("two transitions in sequence!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GES_IS_TIMELINE_SOURCE (prev_object)) {
|
|
||||||
pos -= dur;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (G_UNLIKELY (GES_TIMELINE_OBJECT_PRIORITY (obj) != priority)) {
|
|
||||||
ges_timeline_object_set_priority (obj, priority - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prev_object && (GES_TIMELINE_OBJECT_DURATION (prev_object) < dur)) {
|
if (prev_object && (GES_TIMELINE_OBJECT_DURATION (prev_object) < dur)) {
|
||||||
GST_ERROR ("transition duration exceeds that of previous neighbor!");
|
GST_ERROR ("transition duration exceeds that of previous neighbor!");
|
||||||
}
|
}
|
||||||
|
|
||||||
l_next = g_list_next (tmp);
|
|
||||||
|
|
||||||
if (l_next && (GES_TIMELINE_OBJECT_DURATION (l_next->data) < dur)) {
|
if (l_next && (GES_TIMELINE_OBJECT_DURATION (l_next->data) < dur)) {
|
||||||
GST_ERROR ("transition duration exceeds that of next neighbor!");
|
GST_ERROR ("transition duration exceeds that of next neighbor!");
|
||||||
}
|
}
|
||||||
|
|
||||||
ges_timeline_object_set_start (obj, pos);
|
|
||||||
|
|
||||||
if (prev_transition) {
|
if (prev_transition) {
|
||||||
guint64 start, end;
|
guint64 start, end;
|
||||||
end = (GES_TIMELINE_OBJECT_DURATION (prev_transition) +
|
end = (GES_TIMELINE_OBJECT_DURATION (prev_transition) +
|
||||||
GES_TIMELINE_OBJECT_START (prev_transition));
|
GES_TIMELINE_OBJECT_START (prev_transition));
|
||||||
|
|
||||||
start = GES_TIMELINE_OBJECT_START (obj);
|
start = pos;
|
||||||
|
|
||||||
if (end > start)
|
if (end > start)
|
||||||
GST_ERROR ("%d, %d: overlapping transitions!", start, end);
|
GST_ERROR ("%d, %d: overlapping transitions!", start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
prev_transition = obj;
|
prev_transition = obj;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG (", %ld\n", pos);
|
GST_LOG ("obj: %p, start: " GST_TIME_FORMAT " pri: %ld",
|
||||||
|
obj, GST_TIME_ARGS (pos), priority);
|
||||||
|
|
||||||
prev_object = obj;
|
prev_object = obj;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_DEBUG ("Finished recalculating: final start pos is: " GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (pos));
|
||||||
|
|
||||||
GES_TIMELINE_LAYER (self)->max_gnl_priority = priority;
|
GES_TIMELINE_LAYER (self)->max_gnl_priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue