use BoolError for {Element,TypeFind,DeviceProvider}::register

This commit is contained in:
Thijs Vermeir 2018-11-04 14:37:41 +01:00
parent 6ae9cf2690
commit ba22a36cdb
2 changed files with 16 additions and 3 deletions

View file

@ -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

View file

@ -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")
}
}