gstreamer_gl_x11/
gl_display_x11.rs

1// Copyright (C) 2019 Víctor Jáquez <[email protected]>
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::GLDisplayX11;
13
14impl GLDisplayX11 {
15    pub unsafe fn with_display(display: uintptr_t) -> Result<GLDisplayX11, glib::error::BoolError> {
16        from_glib_full::<_, Option<GLDisplayX11>>(crate::ffi::gst_gl_display_x11_new_with_display(
17            display as gpointer,
18        ))
19        .ok_or_else(|| glib::bool_error!("Failed to create new X11 GL display"))
20    }
21}