From 8b821511ad1de0b6476a0256c615d1658e7b1665 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 1 Jul 2015 11:35:42 +0200 Subject: [PATCH] clip: Use container priority offset when setting children prios Instead of trying to compute it ourself which might lead to wrong behaviour when moving between layer. + Make sure that when we reset clip children priority (to make space for effects,) we update the container knowledge of priority offsets --- ges/ges-clip.c | 13 +++++++++---- ges/nle/nlecomposition.c | 5 +++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ges/ges-clip.c b/ges/ges-clip.c index 380a32deee..9dd935a1fb 100644 --- a/ges/ges-clip.c +++ b/ges/ges-clip.c @@ -223,16 +223,17 @@ _set_priority (GESTimelineElement * element, guint32 priority) for (tmp = container->children; tmp; tmp = g_list_next (tmp)) { guint32 real_tck_prio; GESTimelineElement *child = (GESTimelineElement *) tmp->data; - gint off = _PRIORITY (child) - _PRIORITY (element) - min_prio; + gint off = _ges_container_get_priority_offset (container, child); + if (off >= LAYER_HEIGHT) { GST_ERROR ("%s child %s as a priority offset %d >= LAYER_HEIGHT %d" - "clamping it to 0", GES_TIMELINE_ELEMENT_NAME (element), + " ==> clamping it to 0", GES_TIMELINE_ELEMENT_NAME (element), GES_TIMELINE_ELEMENT_NAME (child), off, LAYER_HEIGHT); off = 0; } - real_tck_prio = min_prio + priority + off; + real_tck_prio = min_prio + priority - off; if (real_tck_prio > max_prio) { GST_WARNING ("%p priority of %i, is outside of the its containing " @@ -300,6 +301,7 @@ _add_child (GESContainer * container, GESTimelineElement * element) */ _get_priority_range (container, &min_prio, &max_prio); if (GES_IS_BASE_EFFECT (element)) { + GESChildrenControlMode mode = container->children_control_mode; GST_DEBUG_OBJECT (container, "Adding %ith effect: %" GST_PTR_FORMAT " Priority %i", priv->nb_effects + 1, element, @@ -307,12 +309,15 @@ _add_child (GESContainer * container, GESTimelineElement * element) priv->nb_effects); tmp = g_list_nth (GES_CONTAINER_CHILDREN (container), priv->nb_effects); - for (; tmp; tmp = tmp->next) + container->children_control_mode = GES_CHILDREN_UPDATE_OFFSETS; + for (; tmp; tmp = tmp->next) { ges_timeline_element_set_priority (GES_TIMELINE_ELEMENT (tmp->data), GES_TIMELINE_ELEMENT_PRIORITY (tmp->data) + 1); + } _set_priority0 (element, min_prio + GES_TIMELINE_ELEMENT_PRIORITY (container) + priv->nb_effects); + container->children_control_mode = mode; priv->nb_effects++; } else { /* We add the track element on top of the effect list */ diff --git a/ges/nle/nlecomposition.c b/ges/nle/nlecomposition.c index 13efe83f3a..77416d3e13 100644 --- a/ges/nle/nlecomposition.c +++ b/ges/nle/nlecomposition.c @@ -2134,8 +2134,9 @@ _is_ready_to_restart_task (NleComposition * comp, GstEvent * event) if (comp->priv->seqnum_to_restart_task == seqnum) { - gchar *name = g_strdup_printf ("new-stack__%" GST_TIME_FORMAT "--%" - GST_TIME_FORMAT "", GST_TIME_ARGS (comp->priv->segment_start), + gchar *name = g_strdup_printf ("%s-new-stack__%" GST_TIME_FORMAT "--%" + GST_TIME_FORMAT "", GST_OBJECT_NAME (comp), + GST_TIME_ARGS (comp->priv->segment_start), GST_TIME_ARGS (comp->priv->segment_stop)); GST_INFO_OBJECT (comp, "Got %s with proper seqnum"