From ba22a36cdb3a9d1800ccc5d5a9fb2022a42ec5cb Mon Sep 17 00:00:00 2001 From: Thijs Vermeir Date: Sun, 4 Nov 2018 14:37:41 +0100 Subject: [PATCH] use BoolError for {Element,TypeFind,DeviceProvider}::register --- Gir_Gst.toml | 10 ++++++++++ gstreamer/src/typefind.rs | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Gir_Gst.toml b/Gir_Gst.toml index 63bdab883..da8411f59 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -459,6 +459,11 @@ status = "generate" # better manual function ignore = true + [[object.function]] + name = "register" + [object.function.return] + bool_return_is_error = "Failed to register element factory" + [[object]] name = "Gst.ElementFactory" status = "generate" @@ -487,6 +492,11 @@ status = "generate" [object.function.return] bool_return_is_error = "Failed to start" + [[object.function]] + name = "register" + [object.function.return] + bool_return_is_error = "Failed to register device provider factory" + [[object.function]] name = "get_metadata" # better manual function diff --git a/gstreamer/src/typefind.rs b/gstreamer/src/typefind.rs index 9b40aa9ad..26d6c0e18 100644 --- a/gstreamer/src/typefind.rs +++ b/gstreamer/src/typefind.rs @@ -12,6 +12,7 @@ use Plugin; use TypeFindFactory; use TypeFindProbability; +use glib; use glib::translate::*; use glib_ffi; use std::marker::PhantomData; @@ -46,7 +47,7 @@ impl<'a> TypeFind<'a> { extensions: R, possible_caps: S, func: F, - ) -> bool + ) -> Result<(), glib::error::BoolError> where F: Fn(&mut TypeFind) + Send + Sync + 'static, { @@ -58,7 +59,7 @@ impl<'a> TypeFind<'a> { Box::new(Box::new(func)); let func = Box::into_raw(func); - from_glib(ffi::gst_type_find_register( + let res = ffi::gst_type_find_register( plugin.to_glib_none().0, name.to_glib_none().0, rank, @@ -67,7 +68,9 @@ impl<'a> TypeFind<'a> { possible_caps.to_glib_none().0, func as *mut _, Some(type_find_closure_drop), - )) + ); + + glib::error::BoolError::from_glib(res, "Failed to register typefind factory") } }