gstreamer_gl_wayland/
gl_display_wayland.rs

1// Copyright (C) 2019 Víctor Jáquez <vjaquez@igalia.com>
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9use glib::{ffi::gpointer, translate::*};
10use libc::uintptr_t;
11
12use crate::GLDisplayWayland;
13
14impl GLDisplayWayland {
15    /// Creates a new display connection from a wl_display Display.
16    /// ## `display`
17    /// an existing, wayland display
18    ///
19    /// # Returns
20    ///
21    /// a new [`GLDisplayWayland`][crate::GLDisplayWayland]
22    pub unsafe fn with_display(
23        display: uintptr_t,
24    ) -> Result<GLDisplayWayland, glib::error::BoolError> {
25        from_glib_full::<_, Option<GLDisplayWayland>>(
26            crate::ffi::gst_gl_display_wayland_new_with_display(display as gpointer),
27        )
28        .ok_or_else(|| glib::bool_error!("Failed to create new Wayland GL display"))
29    }
30}