TimelineObject: Implement _release_track_object()

This commit is contained in:
Edward Hervey 2009-08-07 16:39:45 +02:00
parent b10743ef9a
commit 246599e2f6
2 changed files with 45 additions and 4 deletions

View file

@ -17,9 +17,9 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "ges-internal.h"
#include "ges-timeline-object.h" #include "ges-timeline-object.h"
#include "ges.h" #include "ges.h"
#include "ges-internal.h"
/** /**
* GESTimelineObject * GESTimelineObject
@ -117,6 +117,9 @@ ges_timeline_object_create_track_object (GESTimelineObject * object,
GST_DEBUG GST_DEBUG
("Got a TrackObject : %p , setting the timeline object as its creator"); ("Got a TrackObject : %p , setting the timeline object as its creator");
ges_track_object_set_timeline_object (res, object); 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); GST_DEBUG ("Returning res:%p", res);
@ -124,6 +127,26 @@ ges_timeline_object_create_track_object (GESTimelineObject * object,
return res; 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 void
ges_timeline_object_set_layer (GESTimelineObject * object, ges_timeline_object_set_layer (GESTimelineObject * object,
GESTimelineLayer * layer) GESTimelineLayer * layer)
@ -156,3 +179,12 @@ ges_timeline_object_fill_track_object (GESTimelineObject * object,
return res; 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;
}

View file

@ -43,11 +43,17 @@ G_BEGIN_DECLS
#define GES_TIMELINE_OBJECT_GET_CLASS(obj) \ #define GES_TIMELINE_OBJECT_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TIMELINE_OBJECT, GESTimelineObjectClass)) (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TIMELINE_OBJECT, GESTimelineObjectClass))
typedef gboolean (*FillTrackObjectFunc) (GESTimelineObject * object,
GESTrackObject * trobject,
GstElement * gnlobj);
struct _GESTimelineObject { struct _GESTimelineObject {
GObject parent; GObject parent;
GESTimelineLayer * layer; /* The layer where this object is being used */ 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 */ /* start, inpoint, duration and fullduration are in nanoseconds */
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 */
@ -62,9 +68,8 @@ struct _GESTimelineObjectClass {
GESTrackObject* (*create_track_object) (GESTimelineObject * object, GESTrackObject* (*create_track_object) (GESTimelineObject * object,
GESTrack * track); GESTrack * track);
gboolean (*fill_track_object) (GESTimelineObject * object, /* FIXME : might need a release_track_object */
GESTrackObject * trobject, FillTrackObjectFunc fill_track_object;
GstElement * gnlobj);
}; };
GType ges_timeline_object_get_type (void); GType ges_timeline_object_get_type (void);
@ -79,6 +84,10 @@ GESTrackObject *
ges_timeline_object_create_track_object (GESTimelineObject * object, ges_timeline_object_create_track_object (GESTimelineObject * object,
GESTrack * track); GESTrack * track);
gboolean
ges_timeline_object_release_track_object (GESTimelineObject * object,
GESTrackObject * trackobject);
gboolean gboolean
ges_timeline_object_fill_track_object (GESTimelineObject * object, ges_timeline_object_fill_track_object (GESTimelineObject * object,
GESTrackObject * trackobj, GESTrackObject * trackobj,