smartmixer: Give a unique name to each compositor instances

This commit is contained in:
Thibault Saunier 2017-08-10 15:05:09 -04:00
parent 3a04a1f76b
commit a8b7180918
2 changed files with 24 additions and 14 deletions

View file

@ -228,6 +228,28 @@ ges_smart_mixer_finalize (GObject * object)
G_OBJECT_CLASS (ges_smart_mixer_parent_class)->finalize (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 static void
ges_smart_mixer_class_init (GESSmartMixerClass * klass) 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->dispose = ges_smart_mixer_dispose;
object_class->finalize = ges_smart_mixer_finalize; object_class->finalize = ges_smart_mixer_finalize;
object_class->constructed = ges_smart_mixer_constructed;
} }
static void static void
ges_smart_mixer_init (GESSmartMixer * self) ges_smart_mixer_init (GESSmartMixer * self)
{ {
GstPad *pad;
g_mutex_init (&self->lock); 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, self->pads_infos = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) destroy_pad); NULL, (GDestroyNotify) destroy_pad);
} }

View file

@ -2745,7 +2745,7 @@ _deactivate_stack (NleComposition * comp, gboolean flush_downstream)
{ {
GstPad *ptarget; GstPad *ptarget;
GST_INFO_OBJECT (comp, "Deactivating current stack (flushing downstream: %d", GST_INFO_OBJECT (comp, "Deactivating current stack (flushing downstream: %d)",
flush_downstream); flush_downstream);
_set_current_bin_to_ready (comp, flush_downstream); _set_current_bin_to_ready (comp, flush_downstream);