From a8b7180918a5efd43a6ecadcbee42ca75609dbed Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 10 Aug 2017 15:05:09 -0400 Subject: [PATCH] smartmixer: Give a unique name to each compositor instances --- ges/ges-smart-video-mixer.c | 36 +++++++++++++++++++++++------------- plugins/nle/nlecomposition.c | 2 +- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/ges/ges-smart-video-mixer.c b/ges/ges-smart-video-mixer.c index b28e1a4eb7..c2d9f2e451 100644 --- a/ges/ges-smart-video-mixer.c +++ b/ges/ges-smart-video-mixer.c @@ -228,6 +228,28 @@ ges_smart_mixer_finalize (GObject * object) G_OBJECT_CLASS (ges_smart_mixer_parent_class)->finalize (object); } +static void +ges_smart_mixer_constructed (GObject * obj) +{ + GstPad *pad; + + GESSmartMixer *self = GES_SMART_MIXER (obj); + gchar *cname = g_strdup_printf ("%s-compositor", GST_OBJECT_NAME (self)); + + self->mixer = + gst_element_factory_create (ges_get_compositor_factory (), cname); + g_free (cname); + g_object_set (self->mixer, "background", 1, NULL); + gst_bin_add (GST_BIN (self), self->mixer); + + pad = gst_element_get_static_pad (self->mixer, "src"); + self->srcpad = gst_ghost_pad_new ("src", pad); + gst_pad_set_active (self->srcpad, TRUE); + gst_object_unref (pad); + gst_element_add_pad (GST_ELEMENT (self), self->srcpad); +} + + static void ges_smart_mixer_class_init (GESSmartMixerClass * klass) { @@ -249,25 +271,13 @@ ges_smart_mixer_class_init (GESSmartMixerClass * klass) object_class->dispose = ges_smart_mixer_dispose; object_class->finalize = ges_smart_mixer_finalize; + object_class->constructed = ges_smart_mixer_constructed; } static void ges_smart_mixer_init (GESSmartMixer * self) { - GstPad *pad; g_mutex_init (&self->lock); - - self->mixer = gst_element_factory_create (ges_get_compositor_factory (), - "smart-mixer-mixer"); - g_object_set (self->mixer, "background", 1, NULL); - gst_bin_add (GST_BIN (self), self->mixer); - - pad = gst_element_get_static_pad (self->mixer, "src"); - self->srcpad = gst_ghost_pad_new ("src", pad); - gst_pad_set_active (self->srcpad, TRUE); - gst_object_unref (pad); - gst_element_add_pad (GST_ELEMENT (self), self->srcpad); - self->pads_infos = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) destroy_pad); } diff --git a/plugins/nle/nlecomposition.c b/plugins/nle/nlecomposition.c index b042f2caf8..cf83313937 100644 --- a/plugins/nle/nlecomposition.c +++ b/plugins/nle/nlecomposition.c @@ -2745,7 +2745,7 @@ _deactivate_stack (NleComposition * comp, gboolean flush_downstream) { GstPad *ptarget; - GST_INFO_OBJECT (comp, "Deactivating current stack (flushing downstream: %d", + GST_INFO_OBJECT (comp, "Deactivating current stack (flushing downstream: %d)", flush_downstream); _set_current_bin_to_ready (comp, flush_downstream);