diff --git a/gstreamer-gl/src/gl_display_egl.rs b/gstreamer-gl/src/gl_display_egl.rs index 9e2e4543a..565169509 100644 --- a/gstreamer-gl/src/gl_display_egl.rs +++ b/gstreamer-gl/src/gl_display_egl.rs @@ -14,10 +14,16 @@ use GLDisplayEGL; use GLDisplayType; impl GLDisplayEGL { - pub unsafe fn new_with_egl_display(display: uintptr_t) -> Option { - 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 { + 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 { diff --git a/gstreamer-gl/src/gl_display_x11.rs b/gstreamer-gl/src/gl_display_x11.rs index 46cf41aa1..554a50cdd 100644 --- a/gstreamer-gl/src/gl_display_x11.rs +++ b/gstreamer-gl/src/gl_display_x11.rs @@ -13,9 +13,15 @@ use libc::uintptr_t; use GLDisplayX11; impl GLDisplayX11 { - pub unsafe fn new_with_display(display: uintptr_t) -> Option { - from_glib_full(gst_gl_sys::gst_gl_display_x11_new_with_display( + pub unsafe fn new_with_display( + display: uintptr_t, + ) -> Result { + 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")), + } } }