mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
ges-track-object: Make possible to add a track already containing a gnlobject to a track
This commit is contained in:
parent
299e186480
commit
7b0797c992
2 changed files with 28 additions and 24 deletions
|
@ -766,20 +766,21 @@ ensure_gnl_object (GESTrackObject * object)
|
|||
|
||||
GST_DEBUG ("Calling virtual method");
|
||||
|
||||
/* call the create_gnl_object virtual method */
|
||||
gnlobject = class->create_gnl_object (object);
|
||||
|
||||
if (G_UNLIKELY (gnlobject == NULL)) {
|
||||
GST_ERROR
|
||||
("'create_gnl_object' implementation returned TRUE but no GnlObject is available");
|
||||
goto done;
|
||||
}
|
||||
|
||||
object->priv->gnlobject = gnlobject;
|
||||
|
||||
/* 2. Fill in the GnlObject */
|
||||
if (gnlobject) {
|
||||
GST_DEBUG ("Got a valid GnlObject, now filling it in");
|
||||
if (object->priv->gnlobject == NULL) {
|
||||
|
||||
/* call the create_gnl_object virtual method */
|
||||
gnlobject = class->create_gnl_object (object);
|
||||
|
||||
if (G_UNLIKELY (gnlobject == NULL)) {
|
||||
GST_ERROR
|
||||
("'create_gnl_object' implementation returned TRUE but no GnlObject is available");
|
||||
goto done;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (object, "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)
|
||||
return ensure_gnl_object (object);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue