GESTimeline: allow adding tracks after layers

This commit is contained in:
Brandon Lewis 2010-10-20 18:00:24 +01:00 committed by Edward Hervey
parent 170ec1e7ab
commit 9848c33e40

View file

@ -260,6 +260,14 @@ ges_timeline_save (GESTimeline * timeline, gchar * uri)
return FALSE; return FALSE;
} }
static void
add_object_to_track (GESTimelineObject * object, GESTrack * track)
{
if (!ges_timeline_object_create_track_objects (object, track)) {
GST_WARNING ("error creating track objects");
}
}
static void static void
add_object_to_tracks (GESTimeline * timeline, GESTimelineObject * object) add_object_to_tracks (GESTimeline * timeline, GESTimelineObject * object)
{ {
@ -270,12 +278,11 @@ add_object_to_tracks (GESTimeline * timeline, GESTimelineObject * object)
GESTrack *track = priv->track; GESTrack *track = priv->track;
GST_LOG ("Trying with track %p", track); GST_LOG ("Trying with track %p", track);
if (!ges_timeline_object_create_track_objects (object, track)) { add_object_to_track (object, track);
GST_WARNING ("error creating track objects");
}
} }
} }
static void static void
do_async_start (GESTimeline * timeline) do_async_start (GESTimeline * timeline)
{ {
@ -588,6 +595,7 @@ pad_added_cb (GESTrack * track, GstPad * pad, TrackPrivate * priv)
{ {
gchar *padname; gchar *padname;
GST_DEBUG ("track:%p, pad:%s:%s", track, GST_DEBUG_PAD_NAME (pad)); GST_DEBUG ("track:%p, pad:%s:%s", track, GST_DEBUG_PAD_NAME (pad));
if (G_UNLIKELY (priv->pad)) { if (G_UNLIKELY (priv->pad)) {
@ -652,6 +660,7 @@ gboolean
ges_timeline_add_track (GESTimeline * timeline, GESTrack * track) ges_timeline_add_track (GESTimeline * timeline, GESTrack * track)
{ {
TrackPrivate *priv; TrackPrivate *priv;
GList *tmp;
GST_DEBUG ("timeline:%p, track:%p", timeline, track); GST_DEBUG ("timeline:%p, track:%p", timeline, track);
@ -688,6 +697,21 @@ ges_timeline_add_track (GESTimeline * timeline, GESTrack * track)
/* emit 'track-added' */ /* emit 'track-added' */
g_signal_emit (timeline, ges_timeline_signals[TRACK_ADDED], 0, track); g_signal_emit (timeline, ges_timeline_signals[TRACK_ADDED], 0, track);
/* ensure that each existing timeline object has the opportunity to create a
* track object for this track*/
for (tmp = timeline->layers; tmp; tmp = tmp->next) {
GList *objects, *obj;
objects = ges_timeline_layer_get_objects (tmp->data);
for (obj = objects; obj; obj = obj->next) {
add_object_to_track (obj->data, track);
g_object_unref (obj->data);
obj->data = NULL;
}
g_list_free (objects);
}
return TRUE; return TRUE;
} }