container: Update start if adding a child that as a start < current start

Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D629
This commit is contained in:
Thibault Saunier 2016-01-06 17:20:20 +01:00
parent 0c46363f74
commit a526e5634e

View file

@ -134,6 +134,13 @@ compare_grouping_prio (GType * a, GType * b)
return ret;
}
static void
_resync_start_offsets (GESTimelineElement * child,
ChildMapping * map, GESContainer * container)
{
map->start_offset = _START (container) - _START (child);
}
/*****************************************************
* *
* GESTimelineElement virtual methods implementation *
@ -677,6 +684,7 @@ gboolean
ges_container_add (GESContainer * container, GESTimelineElement * child)
{
ChildMapping *mapping;
gboolean notify_start = FALSE;
GESContainerClass *class;
GESContainerPrivate *priv;
@ -700,6 +708,14 @@ ges_container_add (GESContainer * container, GESTimelineElement * child)
}
container->children_control_mode = GES_CHILDREN_UPDATE;
if (_START (container) > _START (child)) {
_START (container) = _START (child);
g_hash_table_foreach (priv->mappings, (GHFunc) _resync_start_offsets,
container);
notify_start = TRUE;
}
mapping = g_slice_new0 (ChildMapping);
mapping->child = gst_object_ref (child);
mapping->start_offset = _START (container) - _START (child);
@ -740,6 +756,9 @@ ges_container_add (GESContainer * container, GESTimelineElement * child)
child);
priv->adding_children = g_list_remove (priv->adding_children, child);
if (notify_start)
g_object_notify (G_OBJECT (container), "start");
return TRUE;
}