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 # better manual function
ignore = true ignore = true
[[object.function]]
name = "register"
[object.function.return]
bool_return_is_error = "Failed to register element factory"
[[object]] [[object]]
name = "Gst.ElementFactory" name = "Gst.ElementFactory"
status = "generate" status = "generate"
@ -487,6 +492,11 @@ status = "generate"
[object.function.return] [object.function.return]
bool_return_is_error = "Failed to start" 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]] [[object.function]]
name = "get_metadata" name = "get_metadata"
# better manual function # better manual function

View file

@ -12,6 +12,7 @@ use Plugin;
use TypeFindFactory; use TypeFindFactory;
use TypeFindProbability; use TypeFindProbability;
use glib;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use std::marker::PhantomData; use std::marker::PhantomData;
@ -46,7 +47,7 @@ impl<'a> TypeFind<'a> {
extensions: R, extensions: R,
possible_caps: S, possible_caps: S,
func: F, func: F,
) -> bool ) -> Result<(), glib::error::BoolError>
where where
F: Fn(&mut TypeFind) + Send + Sync + 'static, F: Fn(&mut TypeFind) + Send + Sync + 'static,
{ {
@ -58,7 +59,7 @@ impl<'a> TypeFind<'a> {
Box::new(Box::new(func)); Box::new(Box::new(func));
let func = Box::into_raw(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, plugin.to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,
rank, rank,
@ -67,7 +68,9 @@ impl<'a> TypeFind<'a> {
possible_caps.to_glib_none().0, possible_caps.to_glib_none().0,
func as *mut _, func as *mut _,
Some(type_find_closure_drop), Some(type_find_closure_drop),
)) );
glib::error::BoolError::from_glib(res, "Failed to register typefind factory")
} }
} }