add create_element vmethod to GESTrackTransition

This commit is contained in:
Brandon Lewis 2010-06-18 12:55:30 +02:00 committed by Edward Hervey
parent 622f0d7718
commit 2146e4a9af
2 changed files with 32 additions and 12 deletions

View file

@ -31,6 +31,9 @@
G_DEFINE_TYPE (GESTrackTransition, ges_track_transition, GES_TYPE_TRACK_OBJECT);
GstElement *ges_track_transition_create_element (GESTrackTransition * self,
GESTrack * track);
static void
ges_track_transition_update_vcontroller (GESTrackTransition * self,
GstElement * gnlobj)
@ -418,11 +421,16 @@ create_audio_bin (GESTrackTransition * self)
static gboolean
ges_track_transition_create_gnl_object (GESTrackObject * object)
{
GESTrackTransition *self = GES_TRACK_TRANSITION (object);
GESTrackTransition *self;
GESTrackTransitionClass *klass;
GstElement *element;
gchar *name;
static gint tnum = 0;
gchar *name = g_strdup_printf ("transition-operation%d", tnum++);
self = GES_TRACK_TRANSITION (object);
klass = GES_TRACK_TRANSITION_GET_CLASS (object);
name = g_strdup_printf ("transition-operation%d", tnum++);
object->gnlobject = gst_element_factory_make ("gnloperation", name);
g_free (name);
@ -430,18 +438,27 @@ ges_track_transition_create_gnl_object (GESTrackObject * object)
g_signal_connect (G_OBJECT (object->gnlobject), "notify::duration",
G_CALLBACK (gnlobject_duration_cb), object);
if ((object->track->type) == GES_TRACK_TYPE_VIDEO) {
gst_bin_add (GST_BIN (object->gnlobject), create_video_bin (self));
return TRUE;
element = klass->create_element (self, object->track);
if (!GST_IS_ELEMENT (element))
return FALSE;
gst_bin_add (GST_BIN (object->gnlobject), element);
return TRUE;
}
GstElement *
ges_track_transition_create_element (GESTrackTransition * self,
GESTrack * track)
{
if ((track->type) == GES_TRACK_TYPE_VIDEO) {
return create_video_bin (self);
}
else if ((object->track->type) == GES_TRACK_TYPE_AUDIO) {
gst_bin_add (GST_BIN (object->gnlobject), create_audio_bin (self));
return TRUE;
else if ((track->type) == GES_TRACK_TYPE_AUDIO) {
return create_audio_bin (self);
}
return FALSE;
return gst_element_factory_make ("identity", "invalid-track-type");
}
static void
@ -456,6 +473,7 @@ ges_track_transition_class_init (GESTrackTransitionClass * klass)
object_class->finalize = ges_track_transition_finalize;
track_class->create_gnl_object = ges_track_transition_create_gnl_object;
klass->create_element = ges_track_transition_create_element;
}
static void

View file

@ -22,6 +22,7 @@
#define _GES_TRACK_TRANSITION
#include <glib-object.h>
#include <gst/gst.h>
#include <gst/controller/gstcontroller.h>
#include <gst/controller/gstinterpolationcontrolsource.h>
#include <ges/ges-types.h>
@ -47,7 +48,7 @@ G_BEGIN_DECLS
#define GES_TRACK_TRANSITION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_TRANSITION,\
GESTrackTransitionClass)
GESTrackTransitionClass))
/**
* GESTrackTransition:
@ -101,6 +102,7 @@ struct _GESTrackTransition
struct _GESTrackTransitionClass {
GESTrackObjectClass parent_class;
/* <public> */
GstElement* (*create_element) (GESTrackTransition *self, GESTrack *track);
};
GType ges_track_transition_get_type (void);