clip: Make sure that clip start change is notified before children changes

Fixes https://phabricator.freedesktop.org/T7577

Differential Revision: https://phabricator.freedesktop.org/D1600
This commit is contained in:
Thibault Saunier 2017-01-09 12:12:34 -03:00
parent 00d6c1e5ae
commit ab7865d41c
3 changed files with 54 additions and 46 deletions

View file

@ -141,6 +141,8 @@ _set_start (GESTimelineElement * element, GstClockTime start)
GST_DEBUG_OBJECT (element, "Setting children start, (initiated_move: %"
GST_PTR_FORMAT ")", container->initiated_move);
element->start = start;
g_object_notify (G_OBJECT (element), "start");
container->children_control_mode = GES_CHILDREN_IGNORE_NOTIFIES;
for (tmp = container->children; tmp; tmp = g_list_next (tmp)) {
GESTimelineElement *child = (GESTimelineElement *) tmp->data;
@ -156,7 +158,7 @@ _set_start (GESTimelineElement * element, GstClockTime start)
}
container->children_control_mode = GES_CHILDREN_UPDATE;
return TRUE;
return FALSE;
}
static gboolean

View file

@ -665,7 +665,7 @@ void
ges_timeline_element_set_start (GESTimelineElement * self, GstClockTime start)
{
GESTimelineElementClass *klass;
GESTimelineElement *toplevel_container;
GESTimelineElement *toplevel_container, *parent;
g_return_if_fail (GES_IS_TIMELINE_ELEMENT (self));
@ -676,9 +676,15 @@ ges_timeline_element_set_start (GESTimelineElement * self, GstClockTime start)
GST_TIME_ARGS (GES_TIMELINE_ELEMENT_START (self)), GST_TIME_ARGS (start));
toplevel_container = ges_timeline_element_get_toplevel_parent (self);
parent = self->parent;
if (((gint64) (_START (toplevel_container) + start - _START (self))) < 0) {
GST_INFO_OBJECT (self, "Can not move the object as it would imply its "
/* FIXME This should not belong to GESTimelineElement */
if (toplevel_container &&
((gint64) (_START (toplevel_container) + start - _START (self))) < 0 &&
parent
&& GES_CONTAINER (parent)->children_control_mode == GES_CHILDREN_UPDATE) {
GST_INFO_OBJECT (self,
"Can not move the object as it would imply its "
"container to have a negative start value");
gst_object_unref (toplevel_container);

View file

@ -1024,18 +1024,18 @@ GST_START_TEST (test_groups)
g_list_free (clips);
fail_unless (GES_IS_GROUP (group));
CHECK_OBJECT_PROPS (c, 0, 0, 10);
CHECK_OBJECT_PROPS (c1, 10, 0, 10);
CHECK_OBJECT_PROPS (c2, 20, 0, 10);
DEEP_CHECK (c, 0, 0, 10);
DEEP_CHECK (c1, 10, 0, 10);
DEEP_CHECK (c2, 20, 0, 10);
CHECK_OBJECT_PROPS (group, 0, 0, 30);
c3 = ges_layer_add_asset (layer, asset, 30, 0, 20, GES_TRACK_TYPE_UNKNOWN);
c4 = ges_layer_add_asset (layer1, asset, 40, 0, 20, GES_TRACK_TYPE_UNKNOWN);
c5 = ges_layer_add_asset (layer2, asset, 50, 0, 20, GES_TRACK_TYPE_UNKNOWN);
CHECK_OBJECT_PROPS (c3, 30, 0, 20);
CHECK_OBJECT_PROPS (c4, 40, 0, 20);
CHECK_OBJECT_PROPS (c5, 50, 0, 20);
DEEP_CHECK (c3, 30, 0, 20);
DEEP_CHECK (c4, 40, 0, 20);
DEEP_CHECK (c5, 50, 0, 20);
check_layer (c, 0);
check_layer (c1, 1);
check_layer (c2, 1);
@ -1046,12 +1046,12 @@ GST_START_TEST (test_groups)
fail_unless (ges_container_edit (GES_CONTAINER (c), NULL, -1,
GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, 10) == TRUE);
CHECK_OBJECT_PROPS (c, 10, 0, 10);
CHECK_OBJECT_PROPS (c1, 20, 0, 10);
CHECK_OBJECT_PROPS (c2, 30, 0, 10);
CHECK_OBJECT_PROPS (c3, 40, 0, 20);
CHECK_OBJECT_PROPS (c4, 50, 0, 20);
CHECK_OBJECT_PROPS (c5, 60, 0, 20);
DEEP_CHECK (c, 10, 0, 10);
DEEP_CHECK (c1, 20, 0, 10);
DEEP_CHECK (c2, 30, 0, 10);
DEEP_CHECK (c3, 40, 0, 20);
DEEP_CHECK (c4, 50, 0, 20);
DEEP_CHECK (c5, 60, 0, 20);
check_layer (c, 0);
check_layer (c1, 1);
check_layer (c2, 1);
@ -1061,12 +1061,12 @@ GST_START_TEST (test_groups)
fail_unless (ges_container_edit (GES_CONTAINER (c), NULL, 1,
GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, 10) == TRUE);
CHECK_OBJECT_PROPS (c, 10, 0, 10);
CHECK_OBJECT_PROPS (c1, 20, 0, 10);
CHECK_OBJECT_PROPS (c2, 30, 0, 10);
CHECK_OBJECT_PROPS (c3, 40, 0, 20);
CHECK_OBJECT_PROPS (c4, 50, 0, 20);
CHECK_OBJECT_PROPS (c5, 60, 0, 20);
DEEP_CHECK (c, 10, 0, 10);
DEEP_CHECK (c1, 20, 0, 10);
DEEP_CHECK (c2, 30, 0, 10);
DEEP_CHECK (c3, 40, 0, 20);
DEEP_CHECK (c4, 50, 0, 20);
DEEP_CHECK (c5, 60, 0, 20);
check_layer (c, 1);
check_layer (c1, 2);
check_layer (c2, 2);
@ -1076,12 +1076,12 @@ GST_START_TEST (test_groups)
fail_unless (ges_container_edit (GES_CONTAINER (c1), NULL, 2,
GES_EDIT_MODE_RIPPLE, GES_EDGE_END, 40) == TRUE);
CHECK_OBJECT_PROPS (c, 10, 0, 10);
CHECK_OBJECT_PROPS (c1, 20, 0, 20);
CHECK_OBJECT_PROPS (c2, 40, 0, 10);
CHECK_OBJECT_PROPS (c3, 50, 0, 20);
CHECK_OBJECT_PROPS (c4, 60, 0, 20);
CHECK_OBJECT_PROPS (c5, 70, 0, 20);
DEEP_CHECK (c, 10, 0, 10);
DEEP_CHECK (c1, 20, 0, 20);
DEEP_CHECK (c2, 40, 0, 10);
DEEP_CHECK (c3, 50, 0, 20);
DEEP_CHECK (c4, 60, 0, 20);
DEEP_CHECK (c5, 70, 0, 20);
check_layer (c, 1);
check_layer (c1, 2);
check_layer (c2, 2);
@ -1091,12 +1091,12 @@ GST_START_TEST (test_groups)
fail_unless (ges_container_edit (GES_CONTAINER (c1), NULL, 2,
GES_EDIT_MODE_RIPPLE, GES_EDGE_END, 30) == TRUE);
CHECK_OBJECT_PROPS (c, 10, 0, 10);
CHECK_OBJECT_PROPS (c1, 20, 0, 10);
CHECK_OBJECT_PROPS (c2, 30, 0, 10);
CHECK_OBJECT_PROPS (c3, 40, 0, 20);
CHECK_OBJECT_PROPS (c4, 50, 0, 20);
CHECK_OBJECT_PROPS (c5, 60, 0, 20);
DEEP_CHECK (c, 10, 0, 10);
DEEP_CHECK (c1, 20, 0, 10);
DEEP_CHECK (c2, 30, 0, 10);
DEEP_CHECK (c3, 40, 0, 20);
DEEP_CHECK (c4, 50, 0, 20);
DEEP_CHECK (c5, 60, 0, 20);
check_layer (c, 1);
check_layer (c1, 2);
check_layer (c2, 2);
@ -1106,12 +1106,12 @@ GST_START_TEST (test_groups)
fail_unless (ges_container_edit (GES_CONTAINER (c), NULL, 0,
GES_EDIT_MODE_RIPPLE, GES_EDGE_NONE, 0) == TRUE);
CHECK_OBJECT_PROPS (c, 0, 0, 10);
CHECK_OBJECT_PROPS (c1, 10, 0, 10);
CHECK_OBJECT_PROPS (c2, 20, 0, 10);
CHECK_OBJECT_PROPS (c3, 30, 0, 20);
CHECK_OBJECT_PROPS (c4, 40, 0, 20);
CHECK_OBJECT_PROPS (c5, 50, 0, 20);
DEEP_CHECK (c, 0, 0, 10);
DEEP_CHECK (c1, 10, 0, 10);
DEEP_CHECK (c2, 20, 0, 10);
DEEP_CHECK (c3, 30, 0, 20);
DEEP_CHECK (c4, 40, 0, 20);
DEEP_CHECK (c5, 50, 0, 20);
check_layer (c, 0);
check_layer (c1, 1);
check_layer (c2, 1);
@ -1121,12 +1121,12 @@ GST_START_TEST (test_groups)
fail_unless (ges_container_edit (GES_CONTAINER (c2), NULL, -1,
GES_EDIT_MODE_ROLL, GES_EDGE_END, 40) == TRUE);
CHECK_OBJECT_PROPS (c, 0, 0, 10);
CHECK_OBJECT_PROPS (c1, 10, 0, 10);
CHECK_OBJECT_PROPS (c2, 20, 0, 20);
CHECK_OBJECT_PROPS (c3, 40, 10, 10);
CHECK_OBJECT_PROPS (c4, 40, 0, 20);
CHECK_OBJECT_PROPS (c5, 50, 0, 20);
DEEP_CHECK (c, 0, 0, 10);
DEEP_CHECK (c1, 10, 0, 10);
DEEP_CHECK (c2, 20, 0, 20);
DEEP_CHECK (c3, 40, 10, 10);
DEEP_CHECK (c4, 40, 0, 20);
DEEP_CHECK (c5, 50, 0, 20);
CHECK_OBJECT_PROPS (group, 0, 0, 40);
check_layer (c, 0);
check_layer (c1, 1);