TrackObject: Add 'valid' property, Make _set_track() return a bool

This commit is contained in:
Edward Hervey 2009-08-07 16:43:01 +02:00
parent 9f4f14722d
commit dc16b626c8
2 changed files with 15 additions and 6 deletions

View file

@ -229,9 +229,12 @@ ensure_gnl_object (GESTrackObject * object)
GESTrackObjectClass *class; GESTrackObjectClass *class;
gboolean res; gboolean res;
if (object->gnlobject) if (object->gnlobject && object->valid)
return TRUE; return TRUE;
/* 1. Create the GnlObject */
GST_DEBUG ("Creating GnlObject");
class = GES_TRACK_OBJECT_GET_CLASS (object); class = GES_TRACK_OBJECT_GET_CLASS (object);
if (G_UNLIKELY (class->create_gnl_object == NULL)) { if (G_UNLIKELY (class->create_gnl_object == NULL)) {
@ -250,6 +253,7 @@ ensure_gnl_object (GESTrackObject * object)
return FALSE; return FALSE;
} }
/* 2. Fill in the GnlObject */
if (res) { if (res) {
GST_DEBUG ("Got a valid GnlObject, now filling it in"); GST_DEBUG ("Got a valid GnlObject, now filling it in");
@ -258,19 +262,24 @@ ensure_gnl_object (GESTrackObject * object)
object->gnlobject); object->gnlobject);
} }
object->valid = res;
GST_DEBUG ("Returning res:%d", res); GST_DEBUG ("Returning res:%d", res);
return res; return res;
} }
void gboolean
ges_track_object_set_track (GESTrackObject * object, GESTrack * track) ges_track_object_set_track (GESTrackObject * object, GESTrack * track)
{ {
GST_DEBUG ("object:%p, track:%p", object, track); GST_DEBUG ("object:%p, track:%p", object, track);
object->track = track; object->track = track;
ensure_gnl_object (object); if (object->track)
return ensure_gnl_object (object);
return TRUE;
} }
void void

View file

@ -49,6 +49,8 @@ struct _GESTrackObject {
GESTimelineObject *timelineobj; /* The associated timeline object */ GESTimelineObject *timelineobj; /* The associated timeline object */
GESTrack *track; /* The associated Track */ GESTrack *track; /* The associated Track */
gboolean valid; /* TRUE if the contents of gnlobject are valid/usable */
/* Cached values of the gnlobject properties */ /* Cached values of the gnlobject properties */
guint64 start; /* position (in time) of the object in the layer */ guint64 start; /* position (in time) of the object in the layer */
guint64 inpoint; /* in-point */ guint64 inpoint; /* in-point */
@ -72,9 +74,7 @@ GType ges_track_object_get_type (void);
GESTrackObject* ges_track_object_new (GESTimelineObject *timelineobj, GESTrack *track); GESTrackObject* ges_track_object_new (GESTimelineObject *timelineobj, GESTrack *track);
/* gboolean ges_track_object_create_gnl_object (GESTrackObject * object); */ gboolean ges_track_object_set_track (GESTrackObject * object, GESTrack * track);
void ges_track_object_set_track (GESTrackObject * object, GESTrack * track);
void ges_track_object_set_timeline_object (GESTrackObject * object, GESTimelineObject * tlobject); void ges_track_object_set_timeline_object (GESTrackObject * object, GESTimelineObject * tlobject);
/* Private methods for GESTimelineObject's usage only */ /* Private methods for GESTimelineObject's usage only */