gstreamer_gl_x11/gl_display_x11.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::GLDisplayX11;
13
14impl GLDisplayX11 {
15 /// Creates a new display connection from a X11 Display.
16 /// ## `display`
17 /// an existing, x11 display
18 ///
19 /// # Returns
20 ///
21 /// a new [`GLDisplayX11`][crate::GLDisplayX11]
22 pub unsafe fn with_display(display: uintptr_t) -> Result<GLDisplayX11, glib::error::BoolError> {
23 from_glib_full::<_, Option<GLDisplayX11>>(crate::ffi::gst_gl_display_x11_new_with_display(
24 display as gpointer,
25 ))
26 .ok_or_else(|| glib::bool_error!("Failed to create new X11 GL display"))
27 }
28}