From 16a1a6d4c55e5ece72286bcdf8fa706e5c744d64 Mon Sep 17 00:00:00 2001 From: Jayson Reis Date: Thu, 22 Jun 2023 18:48:46 +0200 Subject: [PATCH] gtk4: Make winegl code compilable Part-of: --- video/gtk4/src/sink/imp.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index 399e48a7..ff3cf270 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -894,7 +894,7 @@ impl PaintableSink { } unsafe { - let gst_gl_display = + let gst_display = if let Some(display) = gst_gl::GLDisplay::with_type(gst_gl::GLDisplayType::WIN32) { display } else { @@ -902,10 +902,10 @@ impl PaintableSink { return None; }; - gst_gl_display.filter_gl_api(gl_api); + gst_display.filter_gl_api(gl_api); let wrapped_context = - gst_gl::GLContext::new_wrapped(&gst_gl_display, gl_ctx, platform, gl_api); + gst_gl::GLContext::new_wrapped(&gst_display, gl_ctx, platform, gl_api); let wrapped_context = match wrapped_context { None => { gst::error!(CAT, imp: self, "Failed to create wrapped GL context"); @@ -914,7 +914,7 @@ impl PaintableSink { Some(wrapped_context) => wrapped_context, }; - Some((gst_gl_display, wrapped_context)) + Some((gst_display, wrapped_context)) } } @@ -947,18 +947,19 @@ impl PaintableSink { let egl_display = d.egl_display().unwrap().as_ptr(); // TODO: On the binary distribution of GStreamer for Windows, this symbol is not there - let gst_gl_display = gst_gl_egl::ffi::gst_gl_display_egl_from_gl_display(egl_display); - if gst_gl_display.is_null() { + let gst_display = + gst_gl_egl::ffi::gst_gl_display_egl_from_gl_display(egl_display.cast()); + if gst_display.is_null() { gst::error!(CAT, imp: self, "Failed to get EGL display"); return None; } - let gst_gl_display: gst_gl::GLDisplay = - from_glib_full(gst_gl_display as *mut gst_gl::ffi::GstGLDisplay); + let gst_display = + gst_gl::GLDisplay::from_glib_full(gst_display as *mut gst_gl::ffi::GstGLDisplay); - gst_gl_display.filter_gl_api(gl_api); + gst_display.filter_gl_api(gl_api); let wrapped_context = - gst_gl::GLContext::new_wrapped(&gst_gl_display, gl_ctx, platform, gl_api); + gst_gl::GLContext::new_wrapped(&gst_display, gl_ctx, platform, gl_api); let wrapped_context = match wrapped_context { None => { @@ -968,7 +969,7 @@ impl PaintableSink { Some(wrapped_context) => wrapped_context, }; - Some((gst_gl_display, wrapped_context)) + Some((gst_display, wrapped_context)) } } }