mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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:
parent
b41dd59061
commit
03e96f3ceb
4 changed files with 14 additions and 3 deletions
|
@ -166,6 +166,9 @@ gst_gtk_gl_sink_start (GstBaseSink * bsink)
|
||||||
if (!gtk_sink->display || !gtk_sink->context || !gtk_sink->gtk_context)
|
if (!gtk_sink->display || !gtk_sink->context || !gtk_sink->gtk_context)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
gst_gl_element_propagate_display_context (GST_ELEMENT (bsink),
|
||||||
|
gtk_sink->display);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -515,12 +515,16 @@ gtk_gst_gl_widget_init_winsys (GtkGstGLWidget * gst_widget)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (priv->display);
|
||||||
if (!gst_gl_display_create_context (priv->display, priv->other_context,
|
if (!gst_gl_display_create_context (priv->display, priv->other_context,
|
||||||
&priv->context, &error)) {
|
&priv->context, &error)) {
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
|
GST_OBJECT_UNLOCK (priv->display);
|
||||||
GTK_GST_BASE_WIDGET_UNLOCK (gst_widget);
|
GTK_GST_BASE_WIDGET_UNLOCK (gst_widget);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
gst_gl_display_add_context (priv->display, priv->context);
|
||||||
|
GST_OBJECT_UNLOCK (priv->display);
|
||||||
|
|
||||||
GTK_GST_BASE_WIDGET_UNLOCK (gst_widget);
|
GTK_GST_BASE_WIDGET_UNLOCK (gst_widget);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -218,8 +218,9 @@ gst_gl_context_query (GstElement * element)
|
||||||
/* 4) Create a context by itself and post a GST_MESSAGE_HAVE_CONTEXT
|
/* 4) Create a context by itself and post a GST_MESSAGE_HAVE_CONTEXT
|
||||||
* message.
|
* message.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
gst_gl_display_context_propagate (GstElement * element, GstGLDisplay * display)
|
gst_gl_element_propagate_display_context (GstElement * element,
|
||||||
|
GstGLDisplay * display)
|
||||||
{
|
{
|
||||||
GstContext *context;
|
GstContext *context;
|
||||||
GstMessage *msg;
|
GstMessage *msg;
|
||||||
|
@ -295,7 +296,7 @@ gst_gl_ensure_element_data (gpointer element, GstGLDisplay ** display_ptr,
|
||||||
|
|
||||||
*display_ptr = display;
|
*display_ptr = display;
|
||||||
|
|
||||||
gst_gl_display_context_propagate (element, display);
|
gst_gl_element_propagate_display_context (element, display);
|
||||||
|
|
||||||
get_gl_context:
|
get_gl_context:
|
||||||
if (*other_context_ptr)
|
if (*other_context_ptr)
|
||||||
|
|
|
@ -41,6 +41,9 @@ GST_EXPORT
|
||||||
gboolean gst_gl_query_local_gl_context (GstElement * element, GstPadDirection direction,
|
gboolean gst_gl_query_local_gl_context (GstElement * element, GstPadDirection direction,
|
||||||
GstGLContext ** context_ptr);
|
GstGLContext ** context_ptr);
|
||||||
|
|
||||||
|
GST_EXPORT
|
||||||
|
void gst_gl_element_propagate_display_context (GstElement * element, GstGLDisplay * display);
|
||||||
|
|
||||||
GST_EXPORT
|
GST_EXPORT
|
||||||
gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
|
gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
|
||||||
guint plane);
|
guint plane);
|
||||||
|
|
Loading…
Reference in a new issue