mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-28 19:10:34 +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;
|
||||
|
||||
impl GLDisplayEGL {
|
||||
pub unsafe fn new_with_egl_display(display: uintptr_t) -> Option<GLDisplayEGL> {
|
||||
from_glib_full(gst_gl_sys::gst_gl_display_egl_new_with_egl_display(
|
||||
pub unsafe fn 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,
|
||||
))
|
||||
));
|
||||
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 {
|
||||
|
|
|
@ -13,9 +13,15 @@ use libc::uintptr_t;
|
|||
use GLDisplayX11;
|
||||
|
||||
impl GLDisplayX11 {
|
||||
pub unsafe fn new_with_display(display: uintptr_t) -> Option<GLDisplayX11> {
|
||||
from_glib_full(gst_gl_sys::gst_gl_display_x11_new_with_display(
|
||||
pub unsafe fn 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,
|
||||
))
|
||||
));
|
||||
match result {
|
||||
Some(d) => Ok(d),
|
||||
None => Err(glib_bool_error!("Failed to create new X11 GL display")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue