Merge pull request #256 from Rafostar/gl-win

plugin: Add GL support for Windows OS
This commit is contained in:
Rafał Dzięgiel
2022-05-13 16:34:26 +02:00
committed by GitHub
3 changed files with 51 additions and 2 deletions

View File

@@ -38,10 +38,14 @@
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_GLX
#include <gst/gl/x11/gstgldisplay_x11.h>
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_EGL
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_EGL || GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32_EGL
#include <gst/gl/egl/gstgldisplay_egl.h>
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32
#include <gdk/win32/gdkwin32.h>
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_MACOS
#include <gdk/macos/gdkmacos.h>
#endif
@@ -155,6 +159,24 @@ retrieve_gl_context_on_main (GstClapperGLBaseImporter *self)
#endif
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32
if (GDK_IS_WIN32_DISPLAY (gdk_display)) {
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32_EGL
gpointer display_ptr = gdk_win32_display_get_egl_display (gdk_display);
if (display_ptr) {
self->gst_display = (GstGLDisplay *)
gst_gl_display_egl_new_with_egl_display (display_ptr);
}
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32_WGL
if (!self->gst_display) {
self->gst_display =
gst_gl_display_new_with_type (GST_GL_DISPLAY_TYPE_WIN32);
}
}
#endif
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_MACOS
if (GDK_IS_MACOS_DISPLAY (gdk_display)) {
self->gst_display =
@@ -176,7 +198,8 @@ retrieve_gl_context_on_main (GstClapperGLBaseImporter *self)
}
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_EGL
if (GST_IS_GL_DISPLAY_EGL (self->gst_display)) {
if (GST_IS_GL_DISPLAY_EGL (self->gst_display)
&& GDK_IS_X11_DISPLAY (gdk_display)) {
platform = GST_GL_PLATFORM_EGL;
GST_INFO_OBJECT (self, "Using EGL on x11");
goto have_display;
@@ -189,6 +212,21 @@ retrieve_gl_context_on_main (GstClapperGLBaseImporter *self)
goto have_display;
}
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32_EGL
if (GST_IS_GL_DISPLAY_EGL (self->gst_display)
&& GDK_IS_WIN32_DISPLAY (gdk_display)) {
platform = GST_GL_PLATFORM_EGL;
GST_INFO_OBJECT (self, "Using EGL on Win32");
goto have_display;
}
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32_WGL
if (gst_gl_display_get_handle_type (self->gst_display) == GST_GL_DISPLAY_TYPE_WIN32) {
platform = GST_GL_PLATFORM_WGL;
GST_INFO_OBJECT (self, "Using WGL on Win32");
goto have_display;
}
#endif
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_MACOS
if (gst_gl_display_get_handle_type (self->gst_display) == GST_GL_DISPLAY_TYPE_COCOA) {
platform = GST_GL_PLATFORM_CGL;

View File

@@ -41,6 +41,9 @@ G_BEGIN_DECLS
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11 (GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11))
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_GLX (GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11 && GST_GL_HAVE_PLATFORM_GLX)
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_EGL (GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11 && GST_GL_HAVE_PLATFORM_EGL)
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32 (GST_GL_HAVE_WINDOW_WIN32 && defined (GDK_WINDOWING_WIN32))
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32_WGL (GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32 && GST_GL_HAVE_PLATFORM_WGL)
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32_EGL (GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WIN32 && GST_GL_HAVE_PLATFORM_EGL)
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_MACOS (GST_GL_HAVE_WINDOW_COCOA && defined (GDK_WINDOWING_MACOS) && GST_GL_HAVE_PLATFORM_CGL)
typedef struct _GstClapperGLBaseImporter GstClapperGLBaseImporter;

View File

@@ -46,6 +46,14 @@ if gst_gl_have_window_wayland and gst_gl_have_platform_egl
endif
endif
if gst_gl_have_window_win32 and (gst_gl_have_platform_egl or gst_gl_have_platform_wgl)
gtk_win32_dep = dependency('gtk4-win32', required: false)
if gtk_win32_dep.found()
gst_plugin_gl_base_deps += gtk_win32_dep
have_gtk_gl_windowing = true
endif
endif
if gst_gl_have_window_cocoa and gst_gl_have_platform_cgl
gtk_macos_dep = dependency('gtk4-macos', required: false)
if gtk_macos_dep.found()