clip: only allow children with the same timeline

Refuse the addition of children whose timeline is neither NULL nor the
clip's timeline.
This commit is contained in:
Henry Wilkes 2020-03-10 11:53:09 +00:00
parent cd9cba55c0
commit d03e0fa8c5
2 changed files with 15 additions and 0 deletions

View file

@ -486,6 +486,15 @@ _add_child (GESContainer * container, GESTimelineElement * element)
g_return_val_if_fail (GES_IS_TRACK_ELEMENT (element), FALSE);
if (element->timeline
&& element->timeline != GES_TIMELINE_ELEMENT_TIMELINE (container)) {
GST_WARNING_OBJECT (container, "Can not add the child %" GES_FORMAT
" because its timeline is %" GST_PTR_FORMAT " rather than the "
"clip's timeline %" GST_PTR_FORMAT, GES_ARGS (element),
element->timeline, GES_TIMELINE_ELEMENT_TIMELINE (container));
return FALSE;
}
/* NOTE: notifies are currently frozen by ges_container_add */
_get_priority_range (container, &min_prio, &max_prio);
if (ELEMENT_FLAG_IS_SET (element, GES_TRACK_ELEMENT_IS_CORE)) {

View file

@ -588,6 +588,12 @@ GST_START_TEST (test_clip_find_track_element)
fail_unless (ges_timeline_add_track (timeline, track1));
fail_unless (ges_timeline_add_track (timeline, track2));
/* need to register the clip with the timeline */
/* FIXME: we should make the clip part of a layer, but the current
* default select-tracks-for-object signal is broken for multiple
* tracks. In fact, we should be using this signal in this test */
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (clip), timeline);
effect = GES_TRACK_ELEMENT (ges_effect_new ("identity"));
fail_unless (ges_track_add_element (track, effect));
fail_unless (ges_container_add (GES_CONTAINER (clip),