mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
layer: Resort clips before syncing priorities
We set the priorities making the assumption that `start_clips` is properly ordered by start! Fixes https://gitlab.gnome.org/GNOME/pitivi/issues/2254
This commit is contained in:
parent
044c2a2d75
commit
dea6f0df98
2 changed files with 20 additions and 0 deletions
|
@ -234,6 +234,9 @@ ges_layer_resync_priorities_by_type (GESLayer * layer,
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
GESTimelineElement *element;
|
GESTimelineElement *element;
|
||||||
|
|
||||||
|
layer->priv->clips_start =
|
||||||
|
g_list_sort (layer->priv->clips_start,
|
||||||
|
(GCompareFunc) element_start_compare);
|
||||||
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
|
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
|
||||||
|
|
||||||
element = GES_TIMELINE_ELEMENT (tmp->data);
|
element = GES_TIMELINE_ELEMENT (tmp->data);
|
||||||
|
@ -783,6 +786,9 @@ ges_layer_get_clips_in_interval (GESLayer * layer, GstClockTime start,
|
||||||
|
|
||||||
g_return_val_if_fail (GES_IS_LAYER (layer), NULL);
|
g_return_val_if_fail (GES_IS_LAYER (layer), NULL);
|
||||||
|
|
||||||
|
layer->priv->clips_start =
|
||||||
|
g_list_sort (layer->priv->clips_start,
|
||||||
|
(GCompareFunc) element_start_compare);
|
||||||
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
|
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
|
||||||
clip_intersects = FALSE;
|
clip_intersects = FALSE;
|
||||||
clip_start = ges_timeline_element_get_start (tmp->data);
|
clip_start = ges_timeline_element_get_start (tmp->data);
|
||||||
|
|
|
@ -244,3 +244,17 @@ class TestTransitions(GESSimpleTimelineTest):
|
||||||
# transition and once for the audio transition.
|
# transition and once for the audio transition.
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
signals, ["notify::start", "clip-added", "clip-added"])
|
signals, ["notify::start", "clip-added", "clip-added"])
|
||||||
|
|
||||||
|
|
||||||
|
class TestPriorities(GESSimpleTimelineTest):
|
||||||
|
|
||||||
|
def test_clips_priorities(self):
|
||||||
|
clip = self.add_clip(0, 0, 100)
|
||||||
|
clip1 = self.add_clip(100, 0, 100)
|
||||||
|
self.timeline.commit()
|
||||||
|
|
||||||
|
self.assertLess(clip.props.priority, clip1.props.priority)
|
||||||
|
|
||||||
|
clip.props.start = 101
|
||||||
|
self.timeline.commit()
|
||||||
|
self.assertGreater(clip.props.priority, clip1.props.priority)
|
Loading…
Reference in a new issue