From 7e25aaeccc6334343ea5b179a3347d32444b5b8c Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sat, 30 Mar 2013 19:02:52 +0100 Subject: [PATCH] track: Implement infrastructure for mixing --- ges/ges-track.c | 28 ++++++++++++++++++++++++++++ ges/ges-track.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/ges/ges-track.c b/ges/ges-track.c index 913bb9bc76..0c5168b32f 100644 --- a/ges/ges-track.c +++ b/ges/ges-track.c @@ -517,6 +517,8 @@ ges_track_class_init (GESTrackClass * klass) g_signal_new ("track-element-removed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1, GES_TYPE_TRACK_ELEMENT); + + klass->get_mixing_element = NULL; } static void @@ -542,6 +544,32 @@ ges_track_init (GESTrack * self) if (!gst_bin_add (GST_BIN (self), self->priv->composition)) GST_ERROR ("Couldn't add composition to bin !"); + + if (GES_TRACK_GET_CLASS (self)->get_mixing_element) { + GstElement *gnlobject; + GstElement *mixer = GES_TRACK_GET_CLASS (self)->get_mixing_element (self); + + if (mixer == NULL) { + GST_WARNING_OBJECT (self, "Got no element fron get_mixing_element"); + + return; + } + + gnlobject = gst_element_factory_make ("gnloperation", "mixing-operation"); + if (!gst_bin_add (GST_BIN (gnlobject), mixer)) { + GST_WARNING_OBJECT (self, "Could not add the mixer to our composition"); + + return; + } + g_object_set (gnlobject, "start", GST_CLOCK_TIME_NONE, "duration", + GST_CLOCK_TIME_NONE, "prioirity", 0, NULL); + + if (!gst_bin_add (GST_BIN (self->priv->composition), gnlobject)) { + GST_WARNING_OBJECT (self, "Could not add the mixer to our composition"); + + return; + } + } } /** diff --git a/ges/ges-track.h b/ges/ges-track.h index 5a04c0849a..da833afe91 100644 --- a/ges/ges-track.h +++ b/ges/ges-track.h @@ -75,6 +75,8 @@ struct _GESTrackClass /*< private >*/ GstBinClass parent_class; + GstElement * (*get_mixing_element) (GESTrack *track); + /* Padding for API extension */ gpointer _ges_reserved[GES_PADDING]; };