Commit db3fe694 authored by JohanGoversTech's avatar JohanGoversTech Committed by Sebastian Dröge

Change return type of add_probe to support removing (#116)

* Change return type of add_probe to support 0 PadProbeId

* use from_glib for the conversion of the PadProbeId
parent f4d57a66
......@@ -102,7 +102,7 @@ impl Drop for StreamLock {
}
pub trait PadExtManual {
fn add_probe<F>(&self, mask: PadProbeType, func: F) -> PadProbeId
fn add_probe<F>(&self, mask: PadProbeType, func: F) -> Option<PadProbeId>
where
F: Fn(&Pad, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static;
fn remove_probe(&self, id: PadProbeId);
......@@ -225,7 +225,7 @@ pub trait PadExtManual {
}
impl<O: IsA<Pad>> PadExtManual for O {
fn add_probe<F>(&self, mask: PadProbeType, func: F) -> PadProbeId
fn add_probe<F>(&self, mask: PadProbeType, func: F) -> Option<PadProbeId>
where
F: Fn(&Pad, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static,
{
......@@ -241,7 +241,11 @@ impl<O: IsA<Pad>> PadExtManual for O {
Some(destroy_closure),
);
from_glib(id)
if id == 0 {
None
} else {
Some(from_glib(id))
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment