From 2f49b935df5d4ab3d2c4ba5a6da5be8885f57ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 2 Apr 2019 13:33:08 +0200 Subject: [PATCH] Add GLDisplayWayland in gstreamer-gl-sys --- Gir_GstGL.toml | 13 +++++++ gir-files/GstGL-1.0.gir | 69 ++++++++++++++++++++++++++++++++++- gir-files/fix.sh | 16 ++++++-- gstreamer-gl-sys/Cargo.toml | 1 + gstreamer-gl-sys/src/lib.rs | 56 ++++++++++++++++++++++++++++ gstreamer-gl-sys/tests/abi.rs | 4 ++ 6 files changed, 153 insertions(+), 6 deletions(-) diff --git a/Gir_GstGL.toml b/Gir_GstGL.toml index 373af03dc..a797810fe 100644 --- a/Gir_GstGL.toml +++ b/Gir_GstGL.toml @@ -58,3 +58,16 @@ cfg_condition = "feature = \"x11\"" name = "GstGL.GLDisplayX11Class" status = "generate" cfg_condition = "feature = \"x11\"" + +[[object]] +name = "GstGL.GLDisplayWayland" +status = "generate" +cfg_condition = "feature = \"wayland\"" + [[object.function]] + pattern = ".*" + cfg_condition = "feature = \"wayland\"" + +[[object]] +name = "GstGL.GLDisplayWaylandClass" +status = "generate" +cfg_condition = "feature = \"wayland\"" diff --git a/gir-files/GstGL-1.0.gir b/gir-files/GstGL-1.0.gir index 241b3674c..51ed9016f 100644 --- a/gir-files/GstGL-1.0.gir +++ b/gir-files/GstGL-1.0.gir @@ -2656,8 +2656,73 @@ through the provided API any display type - - + + the contents of a #GstGLDisplayWayland are private and should only be accessed +through the provided API + + Create a new #GstGLDisplayWayland from the wayland display name. See wl_display_connect() +for details on what is a valid name. + + a new #GstGLDisplayWayland or %NULL + + + + + a display name + + + + + + Creates a new display connection from a wl_display Display. + + a new #GstGLDisplayWayland + + + + + an existing, wayland display + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + the contents of a #GstGLDisplayX11 are private and should only be accessed through the provided API diff --git a/gir-files/fix.sh b/gir-files/fix.sh index e4f1e45f0..e22ae4343 100755 --- a/gir-files/fix.sh +++ b/gir-files/fix.sh @@ -27,11 +27,19 @@ xmlstarlet ed --pf --inplace \ --value GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS \ GstGL-1.0.gir -# Remove GstDisplayWayland +# replace wayland structures to gpointers xmlstarlet ed --pf --inplace \ - --delete '//_:class[@name="GLDisplayWayland"]' \ - --delete '//_:record[@name="GLDisplayWaylandClass"]' \ - GstGL-1.0.gir + --update '//*[@c:type="wl_display*"]/@c:type' \ + --value gpointer \ + --update '//*[@c:type="wl_registry*"]/@c:type' \ + --value gpointer \ + --update '//*[@c:type="wl_compositor*"]/@c:type' \ + --value gpointer \ + --update '//*[@c:type="wl_subcompositor*"]/@c:type' \ + --value gpointer \ + --update '//*[@c:type="wl_shell*"]/@c:type' \ + --value gpointer \ + GstGL-1.0.gir # Change X11's Display* and xcb_connection_t* pointers to gpointer xmlstarlet ed --pf --inplace \ diff --git a/gstreamer-gl-sys/Cargo.toml b/gstreamer-gl-sys/Cargo.toml index d095568e3..2171ffd3c 100644 --- a/gstreamer-gl-sys/Cargo.toml +++ b/gstreamer-gl-sys/Cargo.toml @@ -27,6 +27,7 @@ tempdir = "0.3" dox = [] egl = [] x11 = [] +wayland = [] [lib] name = "gstreamer_gl_sys" diff --git a/gstreamer-gl-sys/src/lib.rs b/gstreamer-gl-sys/src/lib.rs index 15b54a527..97aec259c 100644 --- a/gstreamer-gl-sys/src/lib.rs +++ b/gstreamer-gl-sys/src/lib.rs @@ -549,6 +549,24 @@ impl ::std::fmt::Debug for GstGLDisplayPrivate { } } +#[cfg(any(feature = "wayland", feature = "dox"))] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstGLDisplayWaylandClass { + pub object_class: GstGLDisplayClass, + pub _padding: [gpointer; 4], +} + +#[cfg(any(feature = "wayland", feature = "dox"))] +impl ::std::fmt::Debug for GstGLDisplayWaylandClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstGLDisplayWaylandClass @ {:?}", self as *const _)) + .field("object_class", &self.object_class) + .field("_padding", &self._padding) + .finish() + } +} + #[cfg(any(feature = "x11", feature = "dox"))] #[repr(C)] #[derive(Copy, Clone)] @@ -1172,6 +1190,34 @@ impl ::std::fmt::Debug for GstGLDisplayEGL { } } +#[cfg(any(feature = "wayland", feature = "dox"))] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstGLDisplayWayland { + pub parent: GstGLDisplay, + pub display: gpointer, + pub registry: gpointer, + pub compositor: gpointer, + pub subcompositor: gpointer, + pub shell: gpointer, + pub foreign_display: gboolean, + pub _padding: [gpointer; 4], +} + +#[cfg(any(feature = "wayland", feature = "dox"))] +impl ::std::fmt::Debug for GstGLDisplayWayland { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstGLDisplayWayland @ {:?}", self as *const _)) + .field("parent", &self.parent) + .field("display", &self.display) + .field("registry", &self.registry) + .field("compositor", &self.compositor) + .field("subcompositor", &self.subcompositor) + .field("shell", &self.shell) + .finish() + } +} + #[cfg(any(feature = "x11", feature = "dox"))] #[repr(C)] #[derive(Copy, Clone)] @@ -1667,6 +1713,16 @@ extern "C" { #[cfg(any(feature = "egl", feature = "dox"))] pub fn gst_gl_display_egl_get_from_native(type_: GstGLDisplayType, display: uintptr_t) -> gpointer; + //========================================================================= + // GstGLDisplayWayland + //========================================================================= + #[cfg(any(feature = "wayland", feature = "dox"))] + pub fn gst_gl_display_wayland_get_type() -> GType; + #[cfg(any(feature = "wayland", feature = "dox"))] + pub fn gst_gl_display_wayland_new(name: *const c_char) -> *mut GstGLDisplayWayland; + #[cfg(any(feature = "wayland", feature = "dox"))] + pub fn gst_gl_display_wayland_new_with_display(display: gpointer) -> *mut GstGLDisplayWayland; + //========================================================================= // GstGLDisplayX11 //========================================================================= diff --git a/gstreamer-gl-sys/tests/abi.rs b/gstreamer-gl-sys/tests/abi.rs index 625e3b7b7..f5f03752d 100644 --- a/gstreamer-gl-sys/tests/abi.rs +++ b/gstreamer-gl-sys/tests/abi.rs @@ -266,6 +266,10 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[ #[cfg(any(feature = "egl", feature = "dox"))] ("GstGLDisplayEGLClass", Layout {size: size_of::(), alignment: align_of::()}), ("GstGLDisplayType", Layout {size: size_of::(), alignment: align_of::()}), + #[cfg(any(feature = "wayland", feature = "dox"))] + ("GstGLDisplayWayland", Layout {size: size_of::(), alignment: align_of::()}), + #[cfg(any(feature = "wayland", feature = "dox"))] + ("GstGLDisplayWaylandClass", Layout {size: size_of::(), alignment: align_of::()}), #[cfg(any(feature = "x11", feature = "dox"))] ("GstGLDisplayX11", Layout {size: size_of::(), alignment: align_of::()}), #[cfg(any(feature = "x11", feature = "dox"))]