mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 04:51:09 +00:00
Use glib_result_from_gboolean! where applicable
This commit is contained in:
parent
f59e35d0a3
commit
a88918dd5f
2 changed files with 18 additions and 21 deletions
|
@ -54,13 +54,10 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
|
||||||
fn add_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError> {
|
fn add_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError> {
|
||||||
for e in elements {
|
for e in elements {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ret: bool = from_glib(ffi::gst_bin_add(
|
glib_result_from_gboolean!(
|
||||||
self.as_ref().to_glib_none().0,
|
ffi::gst_bin_add(self.as_ref().to_glib_none().0, e.as_ref().to_glib_none().0),
|
||||||
e.as_ref().to_glib_none().0,
|
"Failed to add elements"
|
||||||
));
|
)?;
|
||||||
if !ret {
|
|
||||||
return Err(glib_bool_error!("Failed to add elements"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,13 +67,13 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
|
||||||
fn remove_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError> {
|
fn remove_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError> {
|
||||||
for e in elements {
|
for e in elements {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ret: bool = from_glib(ffi::gst_bin_remove(
|
glib_result_from_gboolean!(
|
||||||
|
ffi::gst_bin_remove(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
e.as_ref().to_glib_none().0,
|
e.as_ref().to_glib_none().0,
|
||||||
));
|
),
|
||||||
if !ret {
|
"Failed to remove elements"
|
||||||
return Err(glib_bool_error!("Failed to remove elements"));
|
)?;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,13 @@ impl Element {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
for (e1, e2) in elements.iter().zip(elements.iter().skip(1)) {
|
for (e1, e2) in elements.iter().zip(elements.iter().skip(1)) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ret: bool = from_glib(ffi::gst_element_link(
|
glib_result_from_gboolean!(
|
||||||
|
ffi::gst_element_link(
|
||||||
e1.as_ref().to_glib_none().0,
|
e1.as_ref().to_glib_none().0,
|
||||||
e2.as_ref().to_glib_none().0,
|
e2.as_ref().to_glib_none().0,
|
||||||
));
|
),
|
||||||
if !ret {
|
"Failed to link elements"
|
||||||
return Err(glib_bool_error!("Failed to link elements"));
|
)?;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue