Add GLDisplayWayland in gstreamer-gl

This commit is contained in:
Víctor Manuel Jáquez Leal 2019-04-02 16:50:52 +02:00
parent 72aa5aed88
commit b99c582a88
8 changed files with 147 additions and 6 deletions

View file

@ -198,6 +198,12 @@ status = "generate"
final_type = true final_type = true
cfg_condition = "feature = \"x11\"" cfg_condition = "feature = \"x11\""
[[object]]
name = "GstGL.GLDisplayWayland"
status = "generate"
final_type = true
cfg_condition = "feature = \"wayland\""
[[object]] [[object]]
name = "GstGL.GLWindow" name = "GstGL.GLWindow"
status = "generate" status = "generate"

View file

@ -2656,8 +2656,73 @@ through the provided API</doc>
<doc xml:space="preserve">any display type</doc> <doc xml:space="preserve">any display type</doc>
</member> </member>
</bitfield> </bitfield>
<class name="GLDisplayWayland" c:symbol-prefix="gl_display_wayland" c:type="GstGLDisplayWayland" parent="GLDisplay" glib:type-name="GstGLDisplayWayland" glib:get-type="gst_gl_display_wayland_get_type" glib:type-struct="GLDisplayWaylandClass">
<doc xml:space="preserve">the contents of a #GstGLDisplayWayland are private and should only be accessed
through the provided API</doc>
<constructor name="new" c:identifier="gst_gl_display_wayland_new">
<doc xml:space="preserve">Create a new #GstGLDisplayWayland from the wayland display name. See wl_display_connect()
for details on what is a valid name.</doc>
<return-value transfer-ownership="full">
<doc xml:space="preserve">a new #GstGLDisplayWayland or %NULL</doc>
<type name="GLDisplayWayland" c:type="GstGLDisplayWayland*"/>
</return-value>
<parameters>
<parameter name="name" transfer-ownership="none" nullable="1" allow-none="1">
<doc xml:space="preserve">a display name</doc>
<type name="utf8" c:type="const gchar*"/>
</parameter>
</parameters>
</constructor>
<constructor name="new_with_display" c:identifier="gst_gl_display_wayland_new_with_display">
<doc xml:space="preserve">Creates a new display connection from a wl_display Display.</doc>
<return-value transfer-ownership="full">
<doc xml:space="preserve">a new #GstGLDisplayWayland</doc>
<type name="GLDisplayWayland" c:type="GstGLDisplayWayland*"/>
</return-value>
<parameters>
<parameter name="display" transfer-ownership="none" nullable="1" allow-none="1">
<doc xml:space="preserve">an existing, wayland display</doc>
<type name="gpointer" c:type="gpointer"/>
</parameter>
</parameters>
</constructor>
<field name="parent">
<type name="GLDisplay" c:type="GstGLDisplay"/>
</field>
<field name="display">
<type name="gpointer" c:type="gpointer"/>
</field>
<field name="registry">
<type name="gpointer" c:type="gpointer"/>
</field>
<field name="compositor">
<type name="gpointer" c:type="gpointer"/>
</field>
<field name="subcompositor">
<type name="gpointer" c:type="gpointer"/>
</field>
<field name="shell">
<type name="gpointer" c:type="gpointer"/>
</field>
<field name="foreign_display" readable="0" private="1">
<type name="gboolean" c:type="gboolean"/>
</field>
<field name="_padding" readable="0" private="1">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</class>
<record name="GLDisplayWaylandClass" c:type="GstGLDisplayWaylandClass" glib:is-gtype-struct-for="GLDisplayWayland">
<field name="object_class">
<type name="GLDisplayClass" c:type="GstGLDisplayClass"/>
</field>
<field name="_padding">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</record>
<class name="GLDisplayX11" c:symbol-prefix="gl_display_x11" c:type="GstGLDisplayX11" parent="GLDisplay" glib:type-name="GstGLDisplayX11" glib:get-type="gst_gl_display_x11_get_type" glib:type-struct="GLDisplayX11Class"> <class name="GLDisplayX11" c:symbol-prefix="gl_display_x11" c:type="GstGLDisplayX11" parent="GLDisplay" glib:type-name="GstGLDisplayX11" glib:get-type="gst_gl_display_x11_get_type" glib:type-struct="GLDisplayX11Class">
<doc xml:space="preserve">the contents of a #GstGLDisplayX11 are private and should only be accessed <doc xml:space="preserve">the contents of a #GstGLDisplayX11 are private and should only be accessed
through the provided API</doc> through the provided API</doc>

View file

@ -27,10 +27,18 @@ xmlstarlet ed --pf --inplace \
--value GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS \ --value GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS \
GstGL-1.0.gir GstGL-1.0.gir
# Remove GstDisplayWayland # replace wayland structures to gpointers
xmlstarlet ed --pf --inplace \ xmlstarlet ed --pf --inplace \
--delete '//_:class[@name="GLDisplayWayland"]' \ --update '//*[@c:type="wl_display*"]/@c:type' \
--delete '//_:record[@name="GLDisplayWaylandClass"]' \ --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 GstGL-1.0.gir
# Change X11's Display* and xcb_connection_t* pointers to gpointer # Change X11's Display* and xcb_connection_t* pointers to gpointer

View file

@ -38,5 +38,6 @@ default = []
dox = ["gstreamer-gl-sys/dox", "glib/dox", "gstreamer/dox", "gstreamer-base/dox"] dox = ["gstreamer-gl-sys/dox", "glib/dox", "gstreamer/dox", "gstreamer-base/dox"]
egl = ["gstreamer-gl-sys/egl"] egl = ["gstreamer-gl-sys/egl"]
x11 = ["gstreamer-gl-sys/x11"] x11 = ["gstreamer-gl-sys/x11"]
wayland = ["gstreamer-gl-sys/wayland"]
embed-lgpl-docs = ["rustdoc-stripper"] embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"] purge-lgpl-docs = ["rustdoc-stripper"]

View file

@ -0,0 +1,33 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use GLDisplay;
use ffi;
use glib::translate::*;
use gst;
glib_wrapper! {
pub struct GLDisplayWayland(Object<ffi::GstGLDisplayWayland, ffi::GstGLDisplayWaylandClass, GLDisplayWaylandClass>) @extends GLDisplay, gst::Object;
match fn {
get_type => || ffi::gst_gl_display_wayland_get_type(),
}
}
impl GLDisplayWayland {
pub fn new<'a, P: Into<Option<&'a str>>>(name: P) -> GLDisplayWayland {
assert_initialized_main_thread!();
let name = name.into();
unsafe {
from_glib_full(ffi::gst_gl_display_wayland_new(name.to_glib_none().0))
}
}
//pub fn new_with_display(display: /*Unimplemented*/Option<Fundamental: Pointer>) -> GLDisplayWayland {
// unsafe { TODO: call ffi::gst_gl_display_wayland_new_with_display() }
//}
}
unsafe impl Send for GLDisplayWayland {}
unsafe impl Sync for GLDisplayWayland {}

View file

@ -22,6 +22,11 @@ mod gl_display_egl;
#[cfg(any(feature = "egl", feature = "dox"))] #[cfg(any(feature = "egl", feature = "dox"))]
pub use self::gl_display_egl::{GLDisplayEGL, GLDisplayEGLClass}; pub use self::gl_display_egl::{GLDisplayEGL, GLDisplayEGLClass};
#[cfg(any(feature = "wayland", feature = "dox"))]
mod gl_display_wayland;
#[cfg(any(feature = "wayland", feature = "dox"))]
pub use self::gl_display_wayland::{GLDisplayWayland, GLDisplayWaylandClass};
#[cfg(any(feature = "x11", feature = "dox"))] #[cfg(any(feature = "x11", feature = "dox"))]
mod gl_display_x11; mod gl_display_x11;
#[cfg(any(feature = "x11", feature = "dox"))] #[cfg(any(feature = "x11", feature = "dox"))]

View file

@ -0,0 +1,21 @@
// Copyright (C) 2019 Víctor Jáquez <vjaquez@igalia.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use glib::translate::*;
use glib_ffi::gpointer;
use libc::uintptr_t;
use GLDisplayWayland;
impl GLDisplayWayland {
pub unsafe fn new_with_display(display: uintptr_t) -> Option<GLDisplayWayland> {
from_glib_full(ffi::gst_gl_display_wayland_new_with_display(
display as gpointer,
))
}
}

View file

@ -55,6 +55,8 @@ mod gl_display;
pub use gl_display::GL_DISPLAY_CONTEXT_TYPE; pub use gl_display::GL_DISPLAY_CONTEXT_TYPE;
#[cfg(any(feature = "egl", feature = "dox"))] #[cfg(any(feature = "egl", feature = "dox"))]
mod gl_display_egl; mod gl_display_egl;
#[cfg(any(feature = "wayland", feature = "dox"))]
mod gl_display_wayland;
#[cfg(any(feature = "x11", feature = "dox"))] #[cfg(any(feature = "x11", feature = "dox"))]
mod gl_display_x11; mod gl_display_x11;
mod gl_video_frame; mod gl_video_frame;