diff options
author | Thibault Saunier <tsaunier@gnome.org> | 2016-08-11 09:14:42 -0400 |
---|---|---|
committer | Thibault Saunier <thibault.saunier@osg.samsung.com> | 2016-09-26 13:32:53 -0300 |
commit | 3daf8bd78833f60d26d5f19b119936dd4b61f6d6 (patch) | |
tree | 30234ca37e3f0fafc8ac0b9e4c00bb3f0c5fefeb /ges | |
parent | 2854c91ebcf5b189a2e2857c1f31493151837303 (diff) |
Finally move clip priority handling to GESLayer.
Fix all tests as we now have 1 priority inside the layer
dedicated to transitions (basically no source clip will
ever have a priority of 0 inside a layer).
Differential Revision: https://phabricator.freedesktop.org/D1276
Diffstat (limited to 'ges')
-rw-r--r-- | ges/ges-auto-transition.c | 19 | ||||
-rw-r--r-- | ges/ges-layer.c | 30 |
2 files changed, 23 insertions, 26 deletions
diff --git a/ges/ges-auto-transition.c b/ges/ges-auto-transition.c index c539dbf6..3961621f 100644 --- a/ges/ges-auto-transition.c +++ b/ges/ges-auto-transition.c @@ -86,19 +86,6 @@ neighbour_changed_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED, } static void -_height_changed_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED, - GESAutoTransition * self) -{ - /* FIXME This is really not smart and we should properly implement clip - * priority management at the Layer level */ - self->positioning = TRUE; - _set_priority0 (GES_TIMELINE_ELEMENT (self->next_clip), - _PRIORITY (self->previous_clip) + - GES_CONTAINER_HEIGHT (self->previous_clip)); - self->positioning = FALSE; -} - -static void _track_changed_cb (GESTrackElement * track_element, GParamSpec * arg G_GNUC_UNUSED, GESAutoTransition * self) { @@ -125,8 +112,6 @@ ges_auto_transition_finalize (GObject * object) neighbour_changed_cb, self); g_signal_handlers_disconnect_by_func (self->next_source, neighbour_changed_cb, self); - g_signal_handlers_disconnect_by_func (self->previous_clip, - _height_changed_cb, self); g_signal_handlers_disconnect_by_func (self->next_source, _track_changed_cb, self); g_signal_handlers_disconnect_by_func (self->previous_source, @@ -177,16 +162,12 @@ ges_auto_transition_new (GESTrackElement * transition, G_CALLBACK (neighbour_changed_cb), self); g_signal_connect (next_source, "notify::duration", G_CALLBACK (neighbour_changed_cb), self); - g_signal_connect (self->previous_clip, "notify::height", - G_CALLBACK (_height_changed_cb), self); g_signal_connect (next_source, "notify::track", G_CALLBACK (_track_changed_cb), self); g_signal_connect (previous_source, "notify::track", G_CALLBACK (_track_changed_cb), self); - _height_changed_cb (self->previous_clip, NULL, self); - GST_DEBUG_OBJECT (self, "Created transition %" GST_PTR_FORMAT " between %" GST_PTR_FORMAT " and: %" GST_PTR_FORMAT " in layer nb %i, start: %" GST_TIME_FORMAT " duration: %" diff --git a/ges/ges-layer.c b/ges/ges-layer.c index ebc69a64..ca780656 100644 --- a/ges/ges-layer.c +++ b/ges/ges-layer.c @@ -228,18 +228,34 @@ ges_layer_init (GESLayer * self) static gboolean ges_layer_resync_priorities (GESLayer * layer) { + GstClockTime next_reset = 0; + gint priority = 1; GList *tmp; GESTimelineElement *element; - GST_DEBUG ("Resync priorities of %p", layer); - - /* TODO : Inhibit composition updates while doing this. - * Ideally we want to do it from an even higher level, but here will - * do in the meantime. */ + GST_INFO_OBJECT (layer, "Resync priorities (prio: %d)", + layer->priv->priority); for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) { + element = GES_TIMELINE_ELEMENT (tmp->data); - _set_priority0 (element, _PRIORITY (element)); + + if (GES_IS_TRANSITION_CLIP (element)) { + _set_priority0 (element, 0); + + continue; + } + + if (element->start > next_reset) { + priority = 1; + next_reset = 0; + } + + if (element->start + element->duration > next_reset) + next_reset = element->start + element->duration; + + _set_priority0 (element, priority); + priority = priority + GES_CONTAINER_HEIGHT (element); } return TRUE; @@ -515,7 +531,7 @@ ges_layer_add_clip (GESLayer * layer, GESClip * clip) g_return_val_if_fail (GES_IS_LAYER (layer), FALSE); g_return_val_if_fail (GES_IS_CLIP (clip), FALSE); - GST_DEBUG_OBJECT (layer, "adding clip:%p", clip); + GST_DEBUG_OBJECT (layer, "adding clip: %s", GES_TIMELINE_ELEMENT_NAME (clip)); priv = layer->priv; current_layer = ges_clip_get_layer (clip); |