ges-track-object: Make possible to add a track already containing a gnlobject to a track

This commit is contained in:
Thibault Saunier 2012-04-17 18:42:41 -04:00
parent 299e186480
commit 7b0797c992
2 changed files with 28 additions and 24 deletions

View file

@ -766,6 +766,9 @@ ensure_gnl_object (GESTrackObject * object)
GST_DEBUG ("Calling virtual method");
/* 2. Fill in the GnlObject */
if (object->priv->gnlobject == NULL) {
/* call the create_gnl_object virtual method */
gnlobject = class->create_gnl_object (object);
@ -775,11 +778,9 @@ ensure_gnl_object (GESTrackObject * object)
goto done;
}
object->priv->gnlobject = gnlobject;
GST_DEBUG_OBJECT (object, "Got a valid GnlObject, now filling it in");
/* 2. Fill in the GnlObject */
if (gnlobject) {
GST_DEBUG ("Got a valid GnlObject, now filling it in");
object->priv->gnlobject = gnlobject;
if (object->priv->timelineobj)
res = ges_timeline_object_fill_track_object (object->priv->timelineobj,
@ -803,7 +804,6 @@ ensure_gnl_object (GESTrackObject * object)
/* Set some properties on the GnlObject */
g_object_set (object->priv->gnlobject,
"caps", ges_track_get_caps (object->priv->track),
"duration", object->priv->pending_duration,
"media-duration", object->priv->pending_duration,
"start", object->priv->pending_start,
@ -811,6 +811,10 @@ ensure_gnl_object (GESTrackObject * object)
"priority", object->priv->pending_priority,
"active", object->priv->pending_active, NULL);
if (object->priv->track != NULL)
g_object_set (object->priv->gnlobject,
"caps", ges_track_get_caps (object->priv->track), NULL);
/* We feed up the props_hashtable if possible */
if (class->get_props_hastable) {
props_hash = class->get_props_hastable (object);
@ -842,8 +846,16 @@ ges_track_object_set_track (GESTrackObject * object, GESTrack * track)
object->priv->track = track;
if (object->priv->track)
if (object->priv->track) {
/* If we already have a gnlobject, we just set its caps properly */
if (object->priv->gnlobject) {
g_object_set (object->priv->gnlobject,
"caps", ges_track_get_caps (object->priv->track), NULL);
return TRUE;
} else {
return ensure_gnl_object (object);
}
}
return TRUE;
}

View file

@ -456,14 +456,6 @@ ges_track_add_object (GESTrack * track, GESTrackObject * object)
return FALSE;
}
/* At this point, the track object shouldn't have any gnlobject since
* it hasn't been added to a track yet.
* FIXME : This check seems a bit obsolete */
if (G_UNLIKELY (ges_track_object_get_gnlobject (object) != NULL)) {
GST_ERROR ("TrackObject already controls a gnlobject !");
return FALSE;
}
if (G_UNLIKELY (!ges_track_object_set_track (object, track))) {
GST_ERROR ("Couldn't properly add the object to the Track");
return FALSE;