mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
flow_combiner: Add a UniqueFlowCombiner wrapper
This implements Send/Sync and for allowing this safely it provides no reference counting and requires a mutable reference for all mutable operations.
This commit is contained in:
parent
6ed4f95ad0
commit
90c86e0031
1 changed files with 47 additions and 0 deletions
|
@ -13,6 +13,7 @@ use gobject_ffi;
|
|||
use gst;
|
||||
|
||||
glib_wrapper! {
|
||||
#[derive(Debug)]
|
||||
pub struct FlowCombiner(Shared<ffi::GstFlowCombiner>);
|
||||
|
||||
match fn {
|
||||
|
@ -85,3 +86,49 @@ impl Default for FlowCombiner {
|
|||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct UniqueFlowCombiner(FlowCombiner);
|
||||
|
||||
unsafe impl Sync for UniqueFlowCombiner {}
|
||||
unsafe impl Send for UniqueFlowCombiner {}
|
||||
|
||||
impl UniqueFlowCombiner {
|
||||
pub fn new() -> UniqueFlowCombiner {
|
||||
UniqueFlowCombiner(FlowCombiner::new())
|
||||
}
|
||||
|
||||
pub fn add_pad<P: IsA<gst::Pad>>(&mut self, pad: &P) {
|
||||
self.0.add_pad(pad);
|
||||
}
|
||||
|
||||
pub fn clear(&self) {
|
||||
self.0.clear();
|
||||
}
|
||||
|
||||
pub fn remove_pad<P: IsA<gst::Pad>>(&mut self, pad: &P) {
|
||||
self.0.remove_pad(pad);
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
self.0.reset();
|
||||
}
|
||||
|
||||
pub fn update_flow(&mut self, fret: gst::FlowReturn) -> gst::FlowReturn {
|
||||
self.0.update_flow(fret)
|
||||
}
|
||||
|
||||
pub fn update_pad_flow<P: IsA<gst::Pad>>(
|
||||
&mut self,
|
||||
pad: &P,
|
||||
fret: gst::FlowReturn,
|
||||
) -> gst::FlowReturn {
|
||||
self.0.update_pad_flow(pad, fret)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for UniqueFlowCombiner {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue