From 0687fdc2a8b2320ed5ade690ff59f2d3b823cf6e 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:04:48 +0200 Subject: [PATCH] Add GLDisplayX11 in gstreamer-gl-sys --- Gir_GstGL.toml | 13 +++++++ gir-files/GstGL-1.0.gir | 63 ++++++++++++++++++++++++++++++- gir-files/fix.sh | 14 +++++-- gstreamer-gl-sys/Cargo.toml | 1 + gstreamer-gl-sys/build.rs | 2 +- gstreamer-gl-sys/src/lib.rs | 51 ++++++++++++++++++++++++- gstreamer-gl-sys/tests/abi.rs | 6 ++- gstreamer-gl-sys/tests/constant.c | 2 +- gstreamer-gl-sys/tests/layout.c | 2 +- 9 files changed, 143 insertions(+), 11 deletions(-) diff --git a/Gir_GstGL.toml b/Gir_GstGL.toml index f7b622cf3..373af03dc 100644 --- a/Gir_GstGL.toml +++ b/Gir_GstGL.toml @@ -45,3 +45,16 @@ cfg_condition = "feature = \"egl\"" #[[object]] #name = "GstGL.GL_COLOR_CONVERT_VIDEO_CAPS" #status = "manual" + +[[object]] +name = "GstGL.GLDisplayX11" +status = "generate" +cfg_condition = "feature = \"x11\"" + [[object.function]] + pattern = ".*" + cfg_condition = "feature = \"x11\"" + +[[object]] +name = "GstGL.GLDisplayX11Class" +status = "generate" +cfg_condition = "feature = \"x11\"" diff --git a/gir-files/GstGL-1.0.gir b/gir-files/GstGL-1.0.gir index a306bd44c..241b3674c 100644 --- a/gir-files/GstGL-1.0.gir +++ b/gir-files/GstGL-1.0.gir @@ -2658,8 +2658,67 @@ through the provided API - - + + the contents of a #GstGLDisplayX11 are private and should only be accessed +through the provided API + + Create a new #GstGLDisplayX11 from the x11 display name. See XOpenDisplay() +for details on what is a valid name. + + a new #GstGLDisplayX11 or %NULL + + + + + a display name + + + + + + Creates a new display connection from a X11 Display. + + a new #GstGLDisplayX11 + + + + + an existing, x11 display + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #GstGLFilter helps to implement simple OpenGL filter elements taking a single input and producing a single output with a #GstGLFramebuffer diff --git a/gir-files/fix.sh b/gir-files/fix.sh index d87481540..e4f1e45f0 100755 --- a/gir-files/fix.sh +++ b/gir-files/fix.sh @@ -33,11 +33,17 @@ xmlstarlet ed --pf --inplace \ --delete '//_:record[@name="GLDisplayWaylandClass"]' \ GstGL-1.0.gir -# Remove GstDisplayX11 +# Change X11's Display* and xcb_connection_t* pointers to gpointer xmlstarlet ed --pf --inplace \ - --delete '//_:class[@name="GLDisplayX11"]' \ - --delete '//_:record[@name="GLDisplayX11Class"]' \ - GstGL-1.0.gir + --insert '//_:type[@c:type="Display*"]' \ + --type attr --name 'name' --value 'gpointer' \ + --insert '//_:type[@c:type="xcb_connection_t*"]' \ + --type attr --name 'name' --value 'gpointer' \ + --update '//*[@c:type="Display*"]/@c:type' \ + --value gpointer \ + --update '//*[@c:type="xcb_connection_t*"]/@c:type' \ + --value gpointer \ + GstGL-1.0.gir # Remove GstMemoryEGL xmlstarlet ed --pf --inplace \ diff --git a/gstreamer-gl-sys/Cargo.toml b/gstreamer-gl-sys/Cargo.toml index fe66617db..d095568e3 100644 --- a/gstreamer-gl-sys/Cargo.toml +++ b/gstreamer-gl-sys/Cargo.toml @@ -26,6 +26,7 @@ tempdir = "0.3" [features] dox = [] egl = [] +x11 = [] [lib] name = "gstreamer_gl_sys" diff --git a/gstreamer-gl-sys/build.rs b/gstreamer-gl-sys/build.rs index 1375dd4c8..90b0b3bb8 100644 --- a/gstreamer-gl-sys/build.rs +++ b/gstreamer-gl-sys/build.rs @@ -1,4 +1,4 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 16d8c2d) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT diff --git a/gstreamer-gl-sys/src/lib.rs b/gstreamer-gl-sys/src/lib.rs index 6d8d5df0d..15b54a527 100644 --- a/gstreamer-gl-sys/src/lib.rs +++ b/gstreamer-gl-sys/src/lib.rs @@ -1,4 +1,4 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 16d8c2d) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT @@ -549,6 +549,24 @@ impl ::std::fmt::Debug for GstGLDisplayPrivate { } } +#[cfg(any(feature = "x11", feature = "dox"))] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstGLDisplayX11Class { + pub object_class: GstGLDisplayClass, + pub _padding: [gpointer; 4], +} + +#[cfg(any(feature = "x11", feature = "dox"))] +impl ::std::fmt::Debug for GstGLDisplayX11Class { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstGLDisplayX11Class @ {:?}", self as *const _)) + .field("object_class", &self.object_class) + .field("_padding", &self._padding) + .finish() + } +} + #[repr(C)] #[derive(Copy, Clone)] pub struct GstGLFilterClass { @@ -1154,6 +1172,27 @@ impl ::std::fmt::Debug for GstGLDisplayEGL { } } +#[cfg(any(feature = "x11", feature = "dox"))] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstGLDisplayX11 { + pub parent: GstGLDisplay, + pub name: *mut c_char, + pub display: gpointer, + pub xcb_connection: gpointer, + pub foreign_display: gboolean, + pub _padding: [gpointer; 4], +} + +#[cfg(any(feature = "x11", feature = "dox"))] +impl ::std::fmt::Debug for GstGLDisplayX11 { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstGLDisplayX11 @ {:?}", self as *const _)) + .field("parent", &self.parent) + .finish() + } +} + #[repr(C)] #[derive(Copy, Clone)] pub struct GstGLFilter { @@ -1628,6 +1667,16 @@ extern "C" { #[cfg(any(feature = "egl", feature = "dox"))] pub fn gst_gl_display_egl_get_from_native(type_: GstGLDisplayType, display: uintptr_t) -> gpointer; + //========================================================================= + // GstGLDisplayX11 + //========================================================================= + #[cfg(any(feature = "x11", feature = "dox"))] + pub fn gst_gl_display_x11_get_type() -> GType; + #[cfg(any(feature = "x11", feature = "dox"))] + pub fn gst_gl_display_x11_new(name: *const c_char) -> *mut GstGLDisplayX11; + #[cfg(any(feature = "x11", feature = "dox"))] + pub fn gst_gl_display_x11_new_with_display(display: gpointer) -> *mut GstGLDisplayX11; + //========================================================================= // GstGLFilter //========================================================================= diff --git a/gstreamer-gl-sys/tests/abi.rs b/gstreamer-gl-sys/tests/abi.rs index 59c6485e7..625e3b7b7 100644 --- a/gstreamer-gl-sys/tests/abi.rs +++ b/gstreamer-gl-sys/tests/abi.rs @@ -1,4 +1,4 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 16d8c2d) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT @@ -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 = "x11", feature = "dox"))] + ("GstGLDisplayX11", Layout {size: size_of::(), alignment: align_of::()}), + #[cfg(any(feature = "x11", feature = "dox"))] + ("GstGLDisplayX11Class", Layout {size: size_of::(), alignment: align_of::()}), ("GstGLFilter", Layout {size: size_of::(), alignment: align_of::()}), ("GstGLFilterClass", Layout {size: size_of::(), alignment: align_of::()}), ("GstGLFormat", Layout {size: size_of::(), alignment: align_of::()}), diff --git a/gstreamer-gl-sys/tests/constant.c b/gstreamer-gl-sys/tests/constant.c index 1f56d09f2..90bea9ffb 100644 --- a/gstreamer-gl-sys/tests/constant.c +++ b/gstreamer-gl-sys/tests/constant.c @@ -1,4 +1,4 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 16d8c2d) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT diff --git a/gstreamer-gl-sys/tests/layout.c b/gstreamer-gl-sys/tests/layout.c index 49a9860fc..6dae36c9a 100644 --- a/gstreamer-gl-sys/tests/layout.c +++ b/gstreamer-gl-sys/tests/layout.c @@ -1,4 +1,4 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 16d8c2d) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT