mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +00:00
gstreamer-gl/{egl,x11}: Change functions from returning Option to Result
Partial work for: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
This commit is contained in:
parent
a7090b2a03
commit
e4adef3ba7
2 changed files with 18 additions and 6 deletions
|
@ -14,10 +14,16 @@ use GLDisplayEGL;
|
||||||
use GLDisplayType;
|
use GLDisplayType;
|
||||||
|
|
||||||
impl GLDisplayEGL {
|
impl GLDisplayEGL {
|
||||||
pub unsafe fn new_with_egl_display(display: uintptr_t) -> Option<GLDisplayEGL> {
|
pub unsafe fn new_with_egl_display(
|
||||||
from_glib_full(gst_gl_sys::gst_gl_display_egl_new_with_egl_display(
|
display: uintptr_t,
|
||||||
|
) -> Result<GLDisplayEGL, glib::error::BoolError> {
|
||||||
|
let result = from_glib_full(gst_gl_sys::gst_gl_display_egl_new_with_egl_display(
|
||||||
display as gpointer,
|
display as gpointer,
|
||||||
))
|
));
|
||||||
|
match result {
|
||||||
|
Some(d) => Ok(d),
|
||||||
|
None => Err(glib_bool_error!("Failed to create new EGL GL display")),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn get_from_native(display_type: GLDisplayType, display: uintptr_t) -> gpointer {
|
pub unsafe fn get_from_native(display_type: GLDisplayType, display: uintptr_t) -> gpointer {
|
||||||
|
|
|
@ -13,9 +13,15 @@ use libc::uintptr_t;
|
||||||
use GLDisplayX11;
|
use GLDisplayX11;
|
||||||
|
|
||||||
impl GLDisplayX11 {
|
impl GLDisplayX11 {
|
||||||
pub unsafe fn new_with_display(display: uintptr_t) -> Option<GLDisplayX11> {
|
pub unsafe fn new_with_display(
|
||||||
from_glib_full(gst_gl_sys::gst_gl_display_x11_new_with_display(
|
display: uintptr_t,
|
||||||
|
) -> Result<GLDisplayX11, glib::error::BoolError> {
|
||||||
|
let result = from_glib_full(gst_gl_sys::gst_gl_display_x11_new_with_display(
|
||||||
display as gpointer,
|
display as gpointer,
|
||||||
))
|
));
|
||||||
|
match result {
|
||||||
|
Some(d) => Ok(d),
|
||||||
|
None => Err(glib_bool_error!("Failed to create new X11 GL display")),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue