TimelineObject: Implement _release_track_object()
authorEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 7 Aug 2009 14:39:45 +0000 (16:39 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 7 Aug 2009 14:39:45 +0000 (16:39 +0200)
ges/ges-timeline-object.c
ges/ges-timeline-object.h

index 367f222ea0f7f8fda30af2ffd582c60ca37227db..ab23c7bab5d667dafdd148a6c35909eab1b565e8 100644 (file)
@@ -17,9 +17,9 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "ges-internal.h"
 #include "ges-timeline-object.h"
 #include "ges.h"
+#include "ges-internal.h"
 
 /**
  * GESTimelineObject
@@ -117,6 +117,9 @@ ges_timeline_object_create_track_object (GESTimelineObject * object,
     GST_DEBUG
         ("Got a TrackObject : %p , setting the timeline object as its creator");
     ges_track_object_set_timeline_object (res, object);
+
+    GST_DEBUG ("Adding TrackObject to the list of controlled track objects");
+    object->trackobjects = g_list_append (object->trackobjects, res);
   }
 
   GST_DEBUG ("Returning res:%p", res);
@@ -124,6 +127,26 @@ ges_timeline_object_create_track_object (GESTimelineObject * object,
   return res;
 }
 
+gboolean
+ges_timeline_object_release_track_object (GESTimelineObject * object,
+    GESTrackObject * trobj)
+{
+  GST_DEBUG ("object:%p, trackobject:%p", object, trobj);
+
+  if (!(g_list_find (object->trackobjects, trobj))) {
+    GST_WARNING ("TrackObject isn't controlled by this object");
+    return FALSE;
+  }
+
+  /* FIXME : Do we need to tell the subclasses ? If so, add a new virtual-method */
+
+  object->trackobjects = g_list_remove (object->trackobjects, trobj);
+
+  ges_track_object_set_timeline_object (trobj, NULL);
+
+  return TRUE;
+}
+
 void
 ges_timeline_object_set_layer (GESTimelineObject * object,
     GESTimelineLayer * layer)
@@ -156,3 +179,12 @@ ges_timeline_object_fill_track_object (GESTimelineObject * object,
 
   return res;
 }
+
+gboolean
+ges_timeline_object_fill_track_object_func (GESTimelineObject * object,
+    GESTrackObject * trackobj, GstElement * gnlobj)
+{
+  GST_WARNING ("No 'fill_track_object' implementation !");
+
+  return FALSE;
+}
index 3229f4056b0523f247a9b4d2caeb23542996e95d..3251b8f08d3be68bd28ef075cb29fcaa800a41f3 100644 (file)
@@ -43,11 +43,17 @@ G_BEGIN_DECLS
 #define GES_TIMELINE_OBJECT_GET_CLASS(obj) \
   (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TIMELINE_OBJECT, GESTimelineObjectClass))
 
+typedef gboolean (*FillTrackObjectFunc) (GESTimelineObject * object,
+                                        GESTrackObject * trobject,
+                                        GstElement * gnlobj);
+
 struct _GESTimelineObject {
   GObject parent;
 
   GESTimelineLayer * layer;    /* The layer where this object is being used */
 
+  GList *trackobjects; /* A list of TrackObject controlled by this TimelineObject */
+
   /* start, inpoint, duration and fullduration are in nanoseconds */
   guint64 start;       /* position (in time) of the object in the layer */
   guint64 inpoint;     /* in-point */
@@ -62,9 +68,8 @@ struct _GESTimelineObjectClass {
 
   GESTrackObject*      (*create_track_object)  (GESTimelineObject * object,
                                                 GESTrack * track);
-  gboolean             (*fill_track_object)    (GESTimelineObject * object,
-                                                GESTrackObject * trobject,
-                                                GstElement * gnlobj);
+  /* FIXME : might need a release_track_object */
+  FillTrackObjectFunc  fill_track_object;
 };
 
 GType ges_timeline_object_get_type (void);
@@ -79,6 +84,10 @@ GESTrackObject *
 ges_timeline_object_create_track_object (GESTimelineObject * object,
                                         GESTrack * track);
 
+gboolean
+ges_timeline_object_release_track_object (GESTimelineObject * object,
+                                         GESTrackObject * trackobject);
+
 gboolean
 ges_timeline_object_fill_track_object (GESTimelineObject * object,
                                       GESTrackObject * trackobj,