Struct gstreamer_base::FlowCombiner
source · #[repr(transparent)]pub struct FlowCombiner { /* private fields */ }
Expand description
Utility struct to help handling gst::FlowReturn
combination. Useful for
gst::Element
s that have multiple source pads and need to combine
the different gst::FlowReturn
for those pads.
FlowCombiner
works by using the last gst::FlowReturn
for all gst::Pad
it has in its list and computes the combined return value and provides
it to the caller.
To add a new pad to the FlowCombiner
use add_pad()
.
The new gst::Pad
is stored with a default value of gst::FlowReturn::Ok
.
In case you want a gst::Pad
to be removed, use remove_pad()
.
Please be aware that this struct isn’t thread safe as its designed to be used by demuxers, those usually will have a single thread operating it.
These functions will take refs on the passed gst::Pad
s.
Aside from reducing the user’s code size, the main advantage of using this
helper struct is to follow the standard rules for gst::FlowReturn
combination.
These rules are:
gst::FlowReturn::Eos
: only if all returns are EOS toogst::FlowReturn::NotLinked
: only if all returns are NOT_LINKED toogst::FlowReturn::Error
or below: if at least one returns an error returngst::FlowReturn::NotNegotiated
: if at least one returns a not-negotiated returngst::FlowReturn::Flushing
: if at least one returns flushinggst::FlowReturn::Ok
: otherwise
gst::FlowReturn::Error
or below, GST_FLOW_NOT_NEGOTIATED and GST_FLOW_FLUSHING are
returned immediately from the update_flow()
function.
Implementations§
source§impl FlowCombiner
impl FlowCombiner
sourcepub fn as_ptr(&self) -> *mut GstFlowCombiner
pub fn as_ptr(&self) -> *mut GstFlowCombiner
Return the inner pointer to the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow<'a>(
ptr: *const *const GstFlowCombiner
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const GstFlowCombiner ) -> &'a Self
Borrows the underlying C value.
source§impl FlowCombiner
impl FlowCombiner
sourcepub fn clear(&self)
pub fn clear(&self)
Removes all pads from a FlowCombiner
and resets it to its initial state.
sourcepub fn remove_pad<P: IsA<Pad>>(&self, pad: &P)
pub fn remove_pad<P: IsA<Pad>>(&self, pad: &P)
sourcepub fn reset(&self)
pub fn reset(&self)
Reset flow combiner and all pads to their initial state without removing pads.
sourcepub fn update_flow<FRet: Into<FlowReturn>>(
&self,
fret: FRet
) -> Result<FlowSuccess, FlowError>
pub fn update_flow<FRet: Into<FlowReturn>>( &self, fret: FRet ) -> Result<FlowSuccess, FlowError>
Computes the combined flow return for the pads in it.
The gst::FlowReturn
parameter should be the last flow return update for a pad
in this FlowCombiner
. It will use this value to be able to shortcut some
combinations and avoid looking over all pads again. e.g. The last combined
return is the same as the latest obtained gst::FlowReturn
.
fret
the latest gst::FlowReturn
received for a pad in this FlowCombiner
Returns
The combined gst::FlowReturn
sourcepub fn update_pad_flow<P: IsA<Pad>, FRet: Into<FlowReturn>>(
&self,
pad: &P,
fret: FRet
) -> Result<FlowSuccess, FlowError>
pub fn update_pad_flow<P: IsA<Pad>, FRet: Into<FlowReturn>>( &self, pad: &P, fret: FRet ) -> Result<FlowSuccess, FlowError>
Sets the provided pad’s last flow return to provided value and computes the combined flow return for the pads in it.
The gst::FlowReturn
parameter should be the last flow return update for a pad
in this FlowCombiner
. It will use this value to be able to shortcut some
combinations and avoid looking over all pads again. e.g. The last combined
return is the same as the latest obtained gst::FlowReturn
.
pad
the gst::Pad
whose gst::FlowReturn
to update
fret
the latest gst::FlowReturn
received for a pad in this FlowCombiner
Returns
The combined gst::FlowReturn
Trait Implementations§
source§impl Clone for FlowCombiner
impl Clone for FlowCombiner
source§impl Debug for FlowCombiner
impl Debug for FlowCombiner
source§impl Default for FlowCombiner
impl Default for FlowCombiner
source§impl From<FlowCombiner> for Value
impl From<FlowCombiner> for Value
source§fn from(s: FlowCombiner) -> Self
fn from(s: FlowCombiner) -> Self
source§impl HasParamSpec for FlowCombiner
impl HasParamSpec for FlowCombiner
type ParamSpec = ParamSpecBoxed
§type SetValue = FlowCombiner
type SetValue = FlowCombiner
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, FlowCombiner>
fn param_spec_builder() -> Self::BuilderFn
source§impl Hash for FlowCombiner
impl Hash for FlowCombiner
source§impl Ord for FlowCombiner
impl Ord for FlowCombiner
source§fn cmp(&self, other: &FlowCombiner) -> Ordering
fn cmp(&self, other: &FlowCombiner) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<FlowCombiner> for FlowCombiner
impl PartialEq<FlowCombiner> for FlowCombiner
source§fn eq(&self, other: &FlowCombiner) -> bool
fn eq(&self, other: &FlowCombiner) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<FlowCombiner> for FlowCombiner
impl PartialOrd<FlowCombiner> for FlowCombiner
source§fn partial_cmp(&self, other: &FlowCombiner) -> Option<Ordering>
fn partial_cmp(&self, other: &FlowCombiner) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for FlowCombiner
impl StaticType for FlowCombiner
source§fn static_type() -> Type
fn static_type() -> Type
Self
.