mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 00:11:59 +02:00
sink: Support EGL under x11 with GTK 4.4+
This commit is contained in:
@@ -32,8 +32,13 @@
|
|||||||
|
|
||||||
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
|
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
|
||||||
#include <gdk/x11/gdkx.h>
|
#include <gdk/x11/gdkx.h>
|
||||||
|
#if GST_GL_HAVE_PLATFORM_EGL
|
||||||
|
#include <gst/gl/egl/gstgldisplay_egl.h>
|
||||||
|
#endif
|
||||||
|
#if GST_GL_HAVE_PLATFORM_GLX
|
||||||
#include <gst/gl/x11/gstgldisplay_x11.h>
|
#include <gst/gl/x11/gstgldisplay_x11.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND)
|
#if GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND)
|
||||||
#include <gdk/wayland/gdkwayland.h>
|
#include <gdk/wayland/gdkwayland.h>
|
||||||
@@ -852,27 +857,23 @@ _get_gl_context (GtkClapperGLWidget * clapper_widget)
|
|||||||
gdk_gl_context_make_current (priv->gdk_context);
|
gdk_gl_context_make_current (priv->gdk_context);
|
||||||
|
|
||||||
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
|
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
|
||||||
if (GST_IS_GL_DISPLAY_X11 (priv->display)) {
|
|
||||||
#if GST_GL_HAVE_PLATFORM_GLX
|
|
||||||
if (!gl_handle) {
|
|
||||||
platform = GST_GL_PLATFORM_GLX;
|
|
||||||
gl_handle = gst_gl_context_get_current_gl_context (platform);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
#if GST_GL_HAVE_PLATFORM_EGL
|
||||||
if (!gl_handle) {
|
if (GST_IS_GL_DISPLAY_EGL (priv->display)) {
|
||||||
platform = GST_GL_PLATFORM_EGL;
|
platform = GST_GL_PLATFORM_EGL;
|
||||||
gl_handle = gst_gl_context_get_current_gl_context (platform);
|
gl_handle = gst_gl_context_get_current_gl_context (platform);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if GST_GL_HAVE_PLATFORM_GLX
|
||||||
if (gl_handle) {
|
if (!gl_handle && GST_IS_GL_DISPLAY_X11 (priv->display)) {
|
||||||
gl_api = _get_current_gl_api (platform);
|
platform = GST_GL_PLATFORM_GLX;
|
||||||
priv->other_context =
|
gl_handle = gst_gl_context_get_current_gl_context (platform);
|
||||||
gst_gl_context_new_wrapped (priv->display, gl_handle,
|
}
|
||||||
platform, gl_api);
|
#endif
|
||||||
}
|
if (gl_handle) {
|
||||||
|
gl_api = _get_current_gl_api (platform);
|
||||||
|
priv->other_context =
|
||||||
|
gst_gl_context_new_wrapped (priv->display, gl_handle,
|
||||||
|
platform, gl_api);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if GST_GL_HAVE_WINDOW_WAYLAND && GST_GL_HAVE_PLATFORM_EGL && defined (GDK_WINDOWING_WAYLAND)
|
#if GST_GL_HAVE_WINDOW_WAYLAND && GST_GL_HAVE_PLATFORM_EGL && defined (GDK_WINDOWING_WAYLAND)
|
||||||
@@ -999,9 +1000,20 @@ gtk_clapper_gl_widget_init (GtkClapperGLWidget * clapper_widget)
|
|||||||
|
|
||||||
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
|
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
|
||||||
if (GDK_IS_X11_DISPLAY (display)) {
|
if (GDK_IS_X11_DISPLAY (display)) {
|
||||||
priv->display = (GstGLDisplay *)
|
gpointer display_ptr;
|
||||||
gst_gl_display_x11_new_with_display (gdk_x11_display_get_xdisplay
|
#if GST_GL_HAVE_PLATFORM_EGL && GTK_CHECK_VERSION(4,4,0)
|
||||||
(display));
|
display_ptr = gdk_x11_display_get_egl_display (display);
|
||||||
|
if (display_ptr)
|
||||||
|
priv->display = (GstGLDisplay *)
|
||||||
|
gst_gl_display_egl_new_with_egl_display (display_ptr);
|
||||||
|
#endif
|
||||||
|
#if GST_GL_HAVE_PLATFORM_GLX
|
||||||
|
if (!priv->display) {
|
||||||
|
display_ptr = gdk_x11_display_get_xdisplay (display);
|
||||||
|
priv->display = (GstGLDisplay *)
|
||||||
|
gst_gl_display_x11_new_with_display (display_ptr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND)
|
#if GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND)
|
||||||
|
13
lib/gst/clapper/meson.build
vendored
13
lib/gst/clapper/meson.build
vendored
@@ -40,10 +40,13 @@ if not gtk4_dep.version().version_compare('>=4.0.0')
|
|||||||
error('GTK4 version on this system is too old')
|
error('GTK4 version on this system is too old')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if gst_gl_have_window_x11 and gst_gl_have_platform_glx
|
if gst_gl_have_window_x11 and (gst_gl_have_platform_egl or gst_gl_have_platform_glx)
|
||||||
gtk_x11_dep = dependency('gtk4-x11', required : false)
|
gtk_x11_dep = dependency('gtk4-x11', required : false)
|
||||||
if gtk_x11_dep.found()
|
if gtk_x11_dep.found()
|
||||||
gtk_deps += [gtk_x11_dep, gstglx11_dep]
|
gtk_deps += gtk_x11_dep
|
||||||
|
if gst_gl_have_platform_glx
|
||||||
|
gtk_deps += gstglx11_dep
|
||||||
|
endif
|
||||||
have_gtk_gl_windowing = true
|
have_gtk_gl_windowing = true
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -51,11 +54,15 @@ endif
|
|||||||
if gst_gl_have_window_wayland and gst_gl_have_platform_egl
|
if gst_gl_have_window_wayland and gst_gl_have_platform_egl
|
||||||
gtk_wayland_dep = dependency('gtk4-wayland', required : false)
|
gtk_wayland_dep = dependency('gtk4-wayland', required : false)
|
||||||
if gtk_wayland_dep.found()
|
if gtk_wayland_dep.found()
|
||||||
gtk_deps += [gtk_wayland_dep, gstglegl_dep, gstglwayland_dep]
|
gtk_deps += [gtk_wayland_dep, gstglwayland_dep]
|
||||||
have_gtk_gl_windowing = true
|
have_gtk_gl_windowing = true
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if gst_gl_have_platform_egl
|
||||||
|
gtk_deps += gstglegl_dep
|
||||||
|
endif
|
||||||
|
|
||||||
if not have_gtk_gl_windowing
|
if not have_gtk_gl_windowing
|
||||||
error('GTK4 widget requires GL windowing')
|
error('GTK4 widget requires GL windowing')
|
||||||
endif
|
endif
|
||||||
|
Reference in New Issue
Block a user