gboolean gst_gl_ensure_display (gpointer element, GstGLDisplay ** display_ptr) { GstGLDisplay *display; g_return_val_if_fail (element != NULL, FALSE); g_return_val_if_fail (display_ptr != NULL, FALSE); /* 1) Check if the element already has a context of the specific * type. */ display = *display_ptr; if (gst_gl_display_found (element, display)) return TRUE; gst_gl_display_context_prepare (element, display_ptr); /* Neighbour found and it updated the display */ if (gst_gl_display_found (element, *display_ptr)) return TRUE; /* If no neighboor, or application not interested, use system default */ display = gst_gl_display_new (); *display_ptr = display; gst_gl_display_context_propagate (element, display); return display != NULL; }
/** * gst_gl_ensure_element_data: * @element: the #GstElement running the query * @display_ptr: (inout): the resulting #GstGLDisplay * @other_context_ptr: (inout): the resulting #GstGLContext * * Perform the steps necessary for retrieving a #GstGLDisplay and (optionally) * an application provided #GstGLContext from the surrounding elements or from * the application using the #GstContext mechanism. * * If the contents of @display_ptr or @other_context_ptr are not %NULL, then no * #GstContext query is necessary for #GstGLDisplay or #GstGLContext retrieval * or is performed. * * This performs #GstContext queries (if necessary) for a winsys display * connection with %GST_GL_DISPLAY_CONTEXT_TYPE, "gst.x11.display.handle", and * "GstWaylandDisplayHandleContextType" stopping after the first successful * retrieval. * * This also performs a #GstContext query (if necessary) for an optional * application provided #GstGLContext using the name "gst.gl.app_context". * The returned #GstGLContext will be shared with a GStreamer created OpenGL context. * * Returns: whether a #GstGLDisplay exists in @display_ptr */ gboolean gst_gl_ensure_element_data (gpointer element, GstGLDisplay ** display_ptr, GstGLContext ** other_context_ptr) { GstGLDisplay *display; g_return_val_if_fail (element != NULL, FALSE); g_return_val_if_fail (display_ptr != NULL, FALSE); g_return_val_if_fail (other_context_ptr != NULL, FALSE); /* 1) Check if the element already has a context of the specific * type. */ display = *display_ptr; if (gst_gl_display_found (element, display)) goto done; gst_gl_display_context_query (element, display_ptr); /* Neighbour found and it updated the display */ if (gst_gl_display_found (element, *display_ptr)) goto get_gl_context; /* If no neighboor, or application not interested, use system default */ display = gst_gl_display_new (); *display_ptr = display; gst_gl_element_propagate_display_context (element, display); get_gl_context: if (*other_context_ptr) goto done; gst_gl_context_query (element); done: return *display_ptr != NULL; }