1// Copyright (C) 2018 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 gst_gl::GLDisplayType;
11use libc::uintptr_t;
12
13use crate::{ffi, GLDisplayEGL};
14
15impl GLDisplayEGL {
16 #[doc(alias = "gst_gl_display_egl_new_with_egl_display")]
17 #[doc(alias = "new_with_egl_display")]
18 pub unsafe fn with_egl_display(
19 display: uintptr_t,
20 ) -> Result<GLDisplayEGL, glib::error::BoolError> {
21 from_glib_full::<_, Option<GLDisplayEGL>>(ffi::gst_gl_display_egl_new_with_egl_display(
22 display as gpointer,
23 ))
24 .ok_or_else(|| glib::bool_error!("Failed to create new EGL GL display"))
25 }
26
27 #[doc(alias = "gst_gl_display_egl_get_from_native")]
28 #[doc(alias = "get_from_native")]
29 pub unsafe fn from_native(display_type: GLDisplayType, display: uintptr_t) -> gpointer {
30 ffi::gst_gl_display_egl_get_from_native(type_:display_type.into_glib(), display)
31 }
32}
33