From 9b92261c423fc3eb816a3c1d5cbff20311cb0112 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Sat, 28 Oct 2023 10:31:11 +0200 Subject: [PATCH] gl: Provide raw `handle()` getter function on `GLDisplay` Having access to the raw handle is useful when sharing the display and context with an existing application. Part-of: --- gstreamer-gl/Gir.toml | 2 +- gstreamer-gl/src/gl_display.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gstreamer-gl/Gir.toml b/gstreamer-gl/Gir.toml index f3c184a62..95fab72e3 100644 --- a/gstreamer-gl/Gir.toml +++ b/gstreamer-gl/Gir.toml @@ -346,7 +346,7 @@ status = "generate" [[object.function]] name = "get_handle" # return handle - ignore = true + manual = true [[object.function]] name = "get_gl_context_for_thread" diff --git a/gstreamer-gl/src/gl_display.rs b/gstreamer-gl/src/gl_display.rs index edcb8ff35..714be5f47 100644 --- a/gstreamer-gl/src/gl_display.rs +++ b/gstreamer-gl/src/gl_display.rs @@ -9,6 +9,12 @@ mod sealed { } pub trait GLDisplayExtManual: sealed::Sealed + IsA + 'static { + #[doc(alias = "gst_gl_display_get_handle")] + #[doc(alias = "get_handle")] + fn handle(&self) -> usize { + unsafe { ffi::gst_gl_display_get_handle(self.as_ref().to_glib_none().0) } + } + #[cfg(feature = "v1_24")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[doc(alias = "gst_gl_display_ensure_context")]