mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
timeline: create auto-transitions during track-element-added
Any time a track element is added to a track, we need to check whether we need to create a new corresponding auto-transition. This simply moves the code from ges-clip.c to ges-timeline.c, where it is more appropriate. Moreover, it technically opens the possibility for creating auto-transitions for track elements in the timeline that have no corresponding clip. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
This commit is contained in:
parent
b00c01ded7
commit
a4cfa6d1e1
2 changed files with 14 additions and 4 deletions
|
@ -2610,9 +2610,5 @@ ges_clip_add_child_to_track (GESClip * clip, GESTrackElement * child,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (GES_IS_SOURCE (el))
|
||||
timeline_tree_create_transitions_for_track_element (timeline_get_tree
|
||||
(timeline), el, ges_timeline_find_auto_transition);
|
||||
|
||||
return el;
|
||||
}
|
||||
|
|
|
@ -181,6 +181,7 @@ typedef struct
|
|||
GESTrack *track;
|
||||
GstPad *pad; /* Pad from the track */
|
||||
GstPad *ghostpad;
|
||||
gulong track_element_added_sigid;
|
||||
|
||||
gulong probe_id;
|
||||
GstStream *stream;
|
||||
|
@ -1523,6 +1524,15 @@ clip_track_element_removed_cb (GESClip * clip,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
track_element_added_cb (GESTrack * track, GESTrackElement * element,
|
||||
GESTimeline * timeline)
|
||||
{
|
||||
if (GES_IS_SOURCE (element))
|
||||
timeline_tree_create_transitions_for_track_element (timeline->priv->tree,
|
||||
element, ges_timeline_find_auto_transition);
|
||||
}
|
||||
|
||||
/* returns TRUE if no errors in adding to tracks */
|
||||
static gboolean
|
||||
_add_clip_children_to_tracks (GESTimeline * timeline, GESClip * clip,
|
||||
|
@ -2281,6 +2291,8 @@ ges_timeline_add_track (GESTimeline * timeline, GESTrack * track)
|
|||
tr_priv = g_new0 (TrackPrivate, 1);
|
||||
tr_priv->timeline = timeline;
|
||||
tr_priv->track = track;
|
||||
tr_priv->track_element_added_sigid = g_signal_connect (track,
|
||||
"track-element-added", G_CALLBACK (track_element_added_cb), timeline);
|
||||
|
||||
update_stream_object (tr_priv);
|
||||
gst_stream_collection_add_stream (timeline->priv->stream_collection,
|
||||
|
@ -2399,6 +2411,8 @@ ges_timeline_remove_track (GESTimeline * timeline, GESTrack * track)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
g_signal_handler_disconnect (track, tr_priv->track_element_added_sigid);
|
||||
|
||||
/* set track state to NULL */
|
||||
gst_element_set_state (GST_ELEMENT (track), GST_STATE_NULL);
|
||||
|
||||
|
|
Loading…
Reference in a new issue