From 2f88e2ae16818f0ace3643fc1e2b5b500b7a5dd5 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 27 Sep 2018 16:37:28 +1000 Subject: [PATCH] glmixerbin: add gloverlaycompositor to each input stream Flattens the overlay compositions into the stream before the mixer will mix them. https://bugzilla.gnome.org/show_bug.cgi?id=759867 --- ext/gl/gstglmixerbin.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ext/gl/gstglmixerbin.c b/ext/gl/gstglmixerbin.c index 866b4b3f0f..47a390d2a0 100644 --- a/ext/gl/gstglmixerbin.c +++ b/ext/gl/gstglmixerbin.c @@ -68,6 +68,7 @@ struct input_chain GstGhostPad *ghost_pad; GstElement *upload; GstElement *in_convert; + GstElement *in_overlay; GstPad *mixer_pad; }; @@ -91,6 +92,12 @@ _free_input_chain (struct input_chain *chain) chain->in_convert = NULL; } + if (chain->in_overlay) { + gst_element_set_state (chain->in_overlay, GST_STATE_NULL); + gst_bin_remove (GST_BIN (chain->self), chain->in_overlay); + chain->in_overlay = NULL; + } + if (chain->mixer_pad) { gst_element_release_request_pad (chain->self->mixer, chain->mixer_pad); gst_object_unref (chain->mixer_pad); @@ -291,16 +298,21 @@ _create_input_chain (GstGLMixerBin * self, struct input_chain *chain, chain->upload = gst_element_factory_make ("glupload", NULL); chain->in_convert = gst_element_factory_make ("glcolorconvert", NULL); + chain->in_overlay = gst_element_factory_make ("gloverlaycompositor", NULL); res &= gst_bin_add (GST_BIN (self), chain->in_convert); + res &= gst_bin_add (GST_BIN (self), chain->in_overlay); res &= gst_bin_add (GST_BIN (self), chain->upload); - pad = gst_element_get_static_pad (chain->in_convert, "src"); + pad = gst_element_get_static_pad (chain->in_overlay, "src"); if (gst_pad_link (pad, mixer_pad) != GST_PAD_LINK_OK) { gst_object_unref (pad); return FALSE; } gst_object_unref (pad); + res &= + gst_element_link_pads (chain->in_convert, "src", chain->in_overlay, + "sink"); res &= gst_element_link_pads (chain->upload, "src", chain->in_convert, "sink"); @@ -332,6 +344,7 @@ _create_input_chain (GstGLMixerBin * self, struct input_chain *chain, gst_element_sync_state_with_parent (chain->upload); gst_element_sync_state_with_parent (chain->in_convert); + gst_element_sync_state_with_parent (chain->in_overlay); return TRUE; }