gtkglsink: expose the created display and context correctly

1. Propagate the GstGLDisplay we create
2. Add the created GstGLContext to the propagated GstGLDisplay

Otherwise with multi-branch GL pipelines involving gtkglsink, things
will fall apart and errors will be genarated somewhere.
This commit is contained in:
Matthew Waters 2017-09-01 15:00:12 +10:00
parent b41dd59061
commit 03e96f3ceb
4 changed files with 14 additions and 3 deletions

View file

@ -166,6 +166,9 @@ gst_gtk_gl_sink_start (GstBaseSink * bsink)
if (!gtk_sink->display || !gtk_sink->context || !gtk_sink->gtk_context)
return FALSE;
gst_gl_element_propagate_display_context (GST_ELEMENT (bsink),
gtk_sink->display);
return TRUE;
}

View file

@ -515,12 +515,16 @@ gtk_gst_gl_widget_init_winsys (GtkGstGLWidget * gst_widget)
return FALSE;
}
GST_OBJECT_LOCK (priv->display);
if (!gst_gl_display_create_context (priv->display, priv->other_context,
&priv->context, &error)) {
g_clear_error (&error);
GST_OBJECT_UNLOCK (priv->display);
GTK_GST_BASE_WIDGET_UNLOCK (gst_widget);
return FALSE;
}
gst_gl_display_add_context (priv->display, priv->context);
GST_OBJECT_UNLOCK (priv->display);
GTK_GST_BASE_WIDGET_UNLOCK (gst_widget);
return TRUE;

View file

@ -218,8 +218,9 @@ gst_gl_context_query (GstElement * element)
/* 4) Create a context by itself and post a GST_MESSAGE_HAVE_CONTEXT
* message.
*/
static void
gst_gl_display_context_propagate (GstElement * element, GstGLDisplay * display)
void
gst_gl_element_propagate_display_context (GstElement * element,
GstGLDisplay * display)
{
GstContext *context;
GstMessage *msg;
@ -295,7 +296,7 @@ gst_gl_ensure_element_data (gpointer element, GstGLDisplay ** display_ptr,
*display_ptr = display;
gst_gl_display_context_propagate (element, display);
gst_gl_element_propagate_display_context (element, display);
get_gl_context:
if (*other_context_ptr)

View file

@ -41,6 +41,9 @@ GST_EXPORT
gboolean gst_gl_query_local_gl_context (GstElement * element, GstPadDirection direction,
GstGLContext ** context_ptr);
GST_EXPORT
void gst_gl_element_propagate_display_context (GstElement * element, GstGLDisplay * display);
GST_EXPORT
gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
guint plane);