ges: Expand track background duration equal to timeline duration

This commit is contained in:
Thibault Saunier 2011-12-16 09:52:35 +01:00
parent ffd196d06a
commit ef96f26e8a

View file

@ -75,6 +75,9 @@ static void
sort_track_objects_cb (GESTrackObject * child,
GParamSpec * arg G_GNUC_UNUSED, GESTrack * track);
static void timeline_duration_cb (GESTimeline * timeline,
GParamSpec * arg G_GNUC_UNUSED, GESTrack * track);
static void
ges_track_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
@ -149,8 +152,7 @@ ges_track_constructed (GObject * object)
GESTrackPrivate *priv = self->priv;
if ((priv->background = gst_element_factory_make ("gnlsource", "background"))) {
g_object_set (G_OBJECT (self->priv->background), "expandable", TRUE,
"priority", G_MAXINT, NULL);
g_object_set (priv->background, "priority", G_MAXUINT, NULL);
switch (self->type) {
case GES_TRACK_TYPE_VIDEO:
@ -367,6 +369,14 @@ ges_track_set_timeline (GESTrack * track, GESTimeline * timeline)
{
GST_DEBUG ("track:%p, timeline:%p", track, timeline);
if (track->priv->timeline)
g_signal_handlers_disconnect_by_func (track,
timeline_duration_cb, track->priv->timeline);
if (timeline)
g_signal_connect (G_OBJECT (timeline), "notify::duration",
G_CALLBACK (timeline_duration_cb), track);
track->priv->timeline = timeline;
}
@ -627,6 +637,20 @@ sort_track_objects_cb (GESTrackObject * child,
(GCompareFunc) objects_start_compare);
}
static void
timeline_duration_cb (GESTimeline * timeline,
GParamSpec * arg G_GNUC_UNUSED, GESTrack * track)
{
guint64 duration;
g_object_get (timeline, "duration", &duration, NULL);
g_object_set (GES_TRACK (track)->priv->background, "duration", duration,
NULL);
GST_DEBUG_OBJECT (track, "Updating background duration to %" GST_TIME_FORMAT,
GST_TIME_ARGS (duration));
}
/**
* ges_track_get_caps:
* @track: a #GESTrack