layer: don't set timeline when moving clip

If a clip is moving we should not unset its timeline when it is removed
from the layer. Logic has been moved to ges_timeline_add_clip and
ges_timeline_remove_clip.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
This commit is contained in:
Henry Wilkes 2020-04-23 17:30:17 +01:00
parent 343e8581f2
commit 36223e25b9
2 changed files with 5 additions and 6 deletions

View file

@ -508,10 +508,8 @@ ges_layer_remove_clip_internal (GESLayer * layer, GESClip * clip,
/* inform the clip it's no longer in a layer */
ges_clip_set_layer (clip, NULL);
/* so neither in a timeline */
if (timeline) {
if (timeline)
ges_timeline_remove_clip (timeline, clip);
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (clip), NULL);
}
for (tmp = GES_CONTAINER_CHILDREN (clip); tmp; tmp = tmp->next)
ges_track_element_set_layer_active (tmp->data, TRUE);
@ -780,9 +778,6 @@ ges_layer_add_clip (GESLayer * layer, GESClip * clip)
ges_layer_resync_priorities (layer);
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (clip),
layer->timeline);
/* FIXME: ideally we would only emit if we are going to return TRUE.
* However, for backward-compatibility, we ensure the "clip-added"
* signal is released before the clip's "child-added" signal, which is

View file

@ -1681,6 +1681,8 @@ ges_timeline_add_clip (GESTimeline * timeline, GESClip * clip)
/* TODO: extend with GError ** argument, which is accepted by
* ges_clip_add_child_to_track */
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (clip), timeline);
/* We make sure not to be connected twice */
g_signal_handlers_disconnect_by_func (clip, clip_track_element_added_cb,
timeline);
@ -1748,6 +1750,8 @@ ges_timeline_remove_clip (GESTimeline * timeline, GESClip * clip)
g_signal_handlers_disconnect_by_func (clip, clip_track_element_removed_cb,
timeline);
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (clip), NULL);
GST_DEBUG ("Done");
}