move create_element virtual method up to TimelineSource class

This commit is contained in:
Brandon Lewis 2010-06-30 15:40:31 +02:00 committed by Edward Hervey
parent 0da3bc58a7
commit 71df7618e0
2 changed files with 28 additions and 2 deletions

View file

@ -64,7 +64,29 @@ ges_track_source_finalize (GObject * object)
static gboolean static gboolean
ges_track_source_create_gnl_object (GESTrackObject * object) ges_track_source_create_gnl_object (GESTrackObject * object)
{ {
object->gnlobject = gst_element_factory_make ("gnlsource", NULL); GESTrackSourceClass *klass = NULL;
GESTrackSource *self = NULL;
GstElement *child = NULL;
GstElement *gnlobject;
self = GES_TRACK_SOURCE (object);
klass = GES_TRACK_SOURCE_GET_CLASS (self);
gnlobject = gst_element_factory_make ("gnlsource", NULL);
if (klass->create_element) {
child = klass->create_element (self);
if (G_UNLIKELY (!child)) {
GST_ERROR ("create_element returned NULL");
return TRUE;
}
gst_bin_add (GST_BIN (gnlobject), child);
self->element = child;
}
object->gnlobject = gnlobject;
return TRUE; return TRUE;
} }
@ -81,6 +103,7 @@ ges_track_source_class_init (GESTrackSourceClass * klass)
object_class->finalize = ges_track_source_finalize; object_class->finalize = ges_track_source_finalize;
track_class->create_gnl_object = ges_track_source_create_gnl_object; track_class->create_gnl_object = ges_track_source_create_gnl_object;
klass->create_element = NULL;
} }
static void static void

View file

@ -22,6 +22,7 @@
#define _GES_TRACK_SOURCE #define _GES_TRACK_SOURCE
#include <glib-object.h> #include <glib-object.h>
#include <gst/gst.h>
#include <ges/ges-types.h> #include <ges/ges-types.h>
#include <ges/ges-track-object.h> #include <ges/ges-track-object.h>
@ -53,8 +54,9 @@ G_BEGIN_DECLS
*/ */
struct _GESTrackSource { struct _GESTrackSource {
/* <public> */
GESTrackObject parent; GESTrackObject parent;
GstElement *element;
/* <public> */
}; };
/** /**
@ -67,6 +69,7 @@ struct _GESTrackSource {
struct _GESTrackSourceClass { struct _GESTrackSourceClass {
GESTrackObjectClass parent_class; GESTrackObjectClass parent_class;
GstElement *(*create_element) (GESTrackSource *);
}; };
GType ges_track_source_get_type (void); GType ges_track_source_get_type (void);