pipeline: connect tracks when added, not only on state change.

+ ghost track src pad before calling track added so that
  pipeline has a pad to link.
+ Remove silly comment.
This commit is contained in:
Mathieu Duponchelle 2014-10-28 18:36:55 +01:00 committed by Thibault Saunier
parent ac906a9143
commit ee2b3f7d24
2 changed files with 25 additions and 3 deletions

View file

@ -200,6 +200,18 @@ ges_pipeline_set_property (GObject * object, guint property_id,
}
}
static void
_timeline_track_added_cb (GESTimeline *timeline, GESTrack *track, GESPipeline *pipeline)
{
_link_track (pipeline, track);
}
static void
_timeline_track_removed_cb (GESTimeline *timeline, GESTrack *track, GESPipeline *pipeline)
{
_unlink_track (pipeline, track);
}
static void
ges_pipeline_dispose (GObject * object)
{
@ -227,6 +239,13 @@ ges_pipeline_dispose (GObject * object)
self->priv->profile = NULL;
}
if (self->priv->timeline) {
g_signal_handlers_disconnect_by_func (self->priv->timeline,
_timeline_track_added_cb, self);
g_signal_handlers_disconnect_by_func (self->priv->timeline,
_timeline_track_removed_cb, self);
}
G_OBJECT_CLASS (ges_pipeline_parent_class)->dispose (object);
}
@ -804,7 +823,6 @@ _unlink_track (GESPipeline * self, GESTrack * track)
gst_object_unref (chain->playsinkpad);
}
/* Unlike/remove tee */
peer = gst_element_get_static_pad (chain->tee, "sink");
gst_pad_unlink (pad, peer);
gst_object_unref (peer);
@ -846,6 +864,10 @@ ges_pipeline_set_timeline (GESPipeline * pipeline, GESTimeline * timeline)
}
pipeline->priv->timeline = timeline;
g_signal_connect (timeline, "track-added",
G_CALLBACK (_timeline_track_added_cb), pipeline);
g_signal_connect (timeline, "track-removed",
G_CALLBACK (_timeline_track_removed_cb), pipeline);
/* FIXME Check if we should rollback if we can't sync state */
gst_element_sync_state_with_parent (GST_ELEMENT (timeline));

View file

@ -2801,6 +2801,8 @@ ges_timeline_add_track (GESTimeline * timeline, GESTrack * track)
GST_DEBUG ("Done adding track, emitting 'track-added' signal");
_ghost_track_srcpad (tr_priv);
/* emit 'track-added' */
g_signal_emit (timeline, ges_timeline_signals[TRACK_ADDED], 0, track);
@ -2826,8 +2828,6 @@ ges_timeline_add_track (GESTimeline * timeline, GESTrack * track)
g_list_free (objects);
}
_ghost_track_srcpad (tr_priv);
/* FIXME Check if we should rollback if we can't sync state */
gst_element_sync_state_with_parent (GST_ELEMENT (track));
g_object_set (track, "message-forward", TRUE, NULL);