ges: Fix trimming clip inside deeply nested groups

This broke in 6b7c658b6a
This commit is contained in:
Thibault Saunier 2020-03-31 11:25:49 -03:00
parent b1e7be7bfc
commit f307d3d51b
2 changed files with 36 additions and 2 deletions

View file

@ -567,6 +567,11 @@ _child_start_changed_cb (GESTimelineElement * child,
case GES_CHILDREN_IGNORE_NOTIFIES: case GES_CHILDREN_IGNORE_NOTIFIES:
return; return;
case GES_CHILDREN_UPDATE_ALL_VALUES: case GES_CHILDREN_UPDATE_ALL_VALUES:
{
gboolean was_setting_simple =
ELEMENT_FLAG_IS_SET (container, GES_TIMELINE_ELEMENT_SET_SIMPLE);
ELEMENT_SET_FLAG (container, GES_TIMELINE_ELEMENT_SET_SIMPLE);
_ges_container_sort_children (container); _ges_container_sort_children (container);
start = container->children ? start = container->children ?
_START (container->children->data) : _START (container); _START (container->children->data) : _START (container);
@ -577,14 +582,17 @@ _child_start_changed_cb (GESTimelineElement * child,
_DURATION (container) = _END (container) - start; _DURATION (container) = _END (container) - start;
_START (container) = start; _START (container) = start;
GST_DEBUG_OBJECT (container, "Child move made us move %" GES_FORMAT, GST_INFO ("%" GES_FORMAT " child %" GES_FORMAT " move made us move",
GES_ARGS (container)); GES_ARGS (container), GES_ARGS (container->children->data));
g_object_notify (G_OBJECT (container), "start"); g_object_notify (G_OBJECT (container), "start");
g_object_notify (G_OBJECT (container), "duration"); g_object_notify (G_OBJECT (container), "duration");
} }
if (!was_setting_simple)
ELEMENT_UNSET_FLAG (container, GES_TIMELINE_ELEMENT_SET_SIMPLE);
/* Falltrough! */ /* Falltrough! */
}
case GES_CHILDREN_UPDATE_OFFSETS: case GES_CHILDREN_UPDATE_OFFSETS:
map->start_offset = _START (container) - _START (child); map->start_offset = _START (container) - _START (child);
break; break;

View file

@ -610,6 +610,32 @@ class TestEditing(common.GESSimpleTimelineTest):
self.assertEqual(group.props.start, 5) self.assertEqual(group.props.start, 5)
self.assertEqual(group.props.duration, 15) self.assertEqual(group.props.duration, 15)
group1 = GES.Group.new ()
group1.add(group)
clips[0].trim(0)
self.assertTimelineTopology([
[ # Unique layer
(GES.TestClip, 0, 10),
(GES.TestClip, 10, 10),
]
])
self.assertEqual(group.props.start, 0)
self.assertEqual(group.props.duration, 20)
self.assertEqual(group1.props.start, 0)
self.assertEqual(group1.props.duration, 20)
self.assertTrue(clips[1].edit([], -1, GES.EditMode.EDIT_TRIM, GES.Edge.EDGE_END, 15))
self.assertTimelineTopology([
[ # Unique layer
(GES.TestClip, 0, 10),
(GES.TestClip, 10, 5),
]
])
self.assertEqual(group.props.start, 0)
self.assertEqual(group.props.duration, 15)
self.assertEqual(group1.props.start, 0)
self.assertEqual(group1.props.duration, 15)
def test_trim_end_past_max_duration(self): def test_trim_end_past_max_duration(self):
clip = self.append_clip() clip = self.append_clip()
max_duration = clip.props.duration max_duration = clip.props.duration