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 pub unsafe fn with_display(
16 display: uintptr_t,
17 ) -> Result<GLDisplayWayland, glib::error::BoolError> {
18 from_glib_full::<_, Option<GLDisplayWayland>>(
19 crate::ffi::gst_gl_display_wayland_new_with_display(display as gpointer),
20 )
21 .ok_or_else(|| glib::bool_error!("Failed to create new Wayland GL display"))
22 }
23}