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
This commit is contained in:
Matthew Waters 2018-09-27 16:37:28 +10:00
parent b37c08ecb5
commit 2f88e2ae16

View file

@ -68,6 +68,7 @@ struct input_chain
GstGhostPad *ghost_pad; GstGhostPad *ghost_pad;
GstElement *upload; GstElement *upload;
GstElement *in_convert; GstElement *in_convert;
GstElement *in_overlay;
GstPad *mixer_pad; GstPad *mixer_pad;
}; };
@ -91,6 +92,12 @@ _free_input_chain (struct input_chain *chain)
chain->in_convert = NULL; 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) { if (chain->mixer_pad) {
gst_element_release_request_pad (chain->self->mixer, chain->mixer_pad); gst_element_release_request_pad (chain->self->mixer, chain->mixer_pad);
gst_object_unref (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->upload = gst_element_factory_make ("glupload", NULL);
chain->in_convert = gst_element_factory_make ("glcolorconvert", 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_convert);
res &= gst_bin_add (GST_BIN (self), chain->in_overlay);
res &= gst_bin_add (GST_BIN (self), chain->upload); 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) { if (gst_pad_link (pad, mixer_pad) != GST_PAD_LINK_OK) {
gst_object_unref (pad); gst_object_unref (pad);
return FALSE; return FALSE;
} }
gst_object_unref (pad); gst_object_unref (pad);
res &=
gst_element_link_pads (chain->in_convert, "src", chain->in_overlay,
"sink");
res &= res &=
gst_element_link_pads (chain->upload, "src", chain->in_convert, "sink"); 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->upload);
gst_element_sync_state_with_parent (chain->in_convert); gst_element_sync_state_with_parent (chain->in_convert);
gst_element_sync_state_with_parent (chain->in_overlay);
return TRUE; return TRUE;
} }