[gtk/matthiasc/for-master] media: Cleanups
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] media: Cleanups
- Date: Sat, 15 May 2021 13:01:57 +0000 (UTC)
commit 37413ffa51ac51d490f7062568e8c6f63f104bf4
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 15 08:32:17 2021 -0400
media: Cleanups
Reshuffle some of the heavily ifdefed code for
getting a GL context from gstreamer.
modules/media/gtkgstsink.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/modules/media/gtkgstsink.c b/modules/media/gtkgstsink.c
index 273df334c5..bb6e520542 100644
--- a/modules/media/gtkgstsink.c
+++ b/modules/media/gtkgstsink.c
@@ -361,33 +361,36 @@ gtk_gst_sink_initialize_gl (GtkGstSink *self)
#ifdef HAVE_GST_X11_SUPPORT
if (GDK_IS_X11_DISPLAY (display))
{
- GstGLPlatform platform;
+ GstGLPlatform platform = GST_GL_PLATFORM_NONE;
GstGLAPI gl_api;
guintptr gl_handle;
- gpointer display_ptr;
+ gpointer display_ptr = NULL;
-#if GST_GL_HAVE_PLATFORM_EGL
+ gl_api = gst_gl_context_get_current_gl_api (platform, NULL, NULL);
+ gl_handle = gst_gl_context_get_current_gl_context (platform);
+
+#ifdef GST_GL_HAVE_PLATFORM_EGL
display_ptr = gdk_x11_display_get_egl_display (display);
if (display_ptr)
{
- GST_DEBUG_OBJECT (self, "got EGL on X11!");
+ GST_DEBUG_OBJECT (self, "Using EGL on X11");
+
platform = GST_GL_PLATFORM_EGL;
self->gst_display = GST_GL_DISPLAY (gst_gl_display_egl_new_with_egl_display (display_ptr));
}
+ else
#endif
-#if GST_GL_HAVE_PLATFORM_GLX
- if (!self->gst_display)
+#ifdef GST_GL_HAVE_PLATFORM_GLX
{
- GST_DEBUG_OBJECT (self, "got GLX on X11!");
+ GST_DEBUG_OBJECT (self, "Using GLX on X11");
+
platform = GST_GL_PLATFORM_GLX;
display_ptr = gdk_x11_display_get_xdisplay (display);
self->gst_display = GST_GL_DISPLAY (gst_gl_display_x11_new_with_display (display_ptr));
}
#endif
- gl_api = gst_gl_context_get_current_gl_api (platform, NULL, NULL);
- gl_handle = gst_gl_context_get_current_gl_context (platform);
- if (gl_handle)
+ if (self->gst_display && gl_handle)
{
self->gst_app_context = gst_gl_context_new_wrapped (self->gst_display, gl_handle, platform,
gl_api);
}
@@ -402,11 +405,11 @@ gtk_gst_sink_initialize_gl (GtkGstSink *self)
#ifdef HAVE_GST_WAYLAND_SUPPORT
if (GDK_IS_WAYLAND_DISPLAY (display))
{
- GstGLPlatform platform = GST_GL_PLATFORM_GLX;
+ GstGLPlatform platform;
GstGLAPI gl_api;
guintptr gl_handle;
- GST_DEBUG_OBJECT (self, "got EGL on Wayland!");
+ GST_DEBUG_OBJECT (self, "Using EGL on Wayland");
platform = GST_GL_PLATFORM_EGL;
gl_api = gst_gl_context_get_current_gl_api (platform, NULL, NULL);
@@ -422,7 +425,7 @@ gtk_gst_sink_initialize_gl (GtkGstSink *self)
}
else
{
- GST_ERROR_OBJECT (self, "Failed to get handle from GdkGLContext, not using Wayland EGL");
+ GST_ERROR_OBJECT (self, "Failed to get handle from GdkGLContext");
return;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]