mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-05 17:19:42 +00:00
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
This commit is contained in:
parent
f4d57a6652
commit
db3fe69415
1 changed files with 7 additions and 3 deletions
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue