[−]Struct gstreamer_base::FlowCombiner
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 FlowCombiner::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 FlowCombiner::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 FlowCombiner::update_flow
function.
Methods
impl FlowCombiner
[src]
pub fn new() -> FlowCombiner
[src]
pub fn add_pad<P: IsA<Pad>>(&self, pad: &P)
[src]
pub fn clear(&self)
[src]
Removes all pads from a FlowCombiner
and resets it to its initial state.
pub fn remove_pad<P: IsA<Pad>>(&self, pad: &P)
[src]
pub fn reset(&self)
[src]
Reset flow combiner and all pads to their initial state without removing pads.
pub fn update_flow<FRet: Into<FlowReturn>>(
&self,
fret: FRet
) -> Result<FlowSuccess, FlowError>
[src]
&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
pub fn update_pad_flow<P: IsA<Pad>, FRet: Into<FlowReturn>>(
&self,
pad: &P,
fret: FRet
) -> Result<FlowSuccess, FlowError>
[src]
&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
impl Clone for FlowCombiner
fn clone(&self) -> FlowCombiner
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FlowCombiner
[src]
impl Default for FlowCombiner
[src]
impl Eq for FlowCombiner
[src]
impl Hash for FlowCombiner
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for FlowCombiner
[src]
fn cmp(&self, other: &FlowCombiner) -> Ordering
[src]
#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<FlowCombiner> for FlowCombiner
[src]
fn eq(&self, other: &FlowCombiner) -> bool
[src]
fn ne(&self, other: &FlowCombiner) -> bool
[src]
impl PartialOrd<FlowCombiner> for FlowCombiner
[src]
fn partial_cmp(&self, other: &FlowCombiner) -> Option<Ordering>
[src]
fn lt(&self, other: &FlowCombiner) -> bool
[src]
fn le(&self, other: &FlowCombiner) -> bool
[src]
fn gt(&self, other: &FlowCombiner) -> bool
[src]
fn ge(&self, other: &FlowCombiner) -> bool
[src]
impl StaticType for FlowCombiner
fn static_type() -> Type
impl StructuralEq for FlowCombiner
[src]
impl StructuralPartialEq for FlowCombiner
[src]
Auto Trait Implementations
impl RefUnwindSafe for FlowCombiner
impl !Send for FlowCombiner
impl !Sync for FlowCombiner
impl Unpin for FlowCombiner
impl UnwindSafe for FlowCombiner
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
[src]
t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_container_from_slice(
_t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
[src]
_t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_full_from_slice(_t: &[T]) -> *const GList
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
[src]
t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_container_from_slice(
_t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
[src]
_t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_full_from_slice(_t: &[T]) -> *const GPtrArray
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GArray
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
[src]
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
[src]
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GList
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GPtrArray
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToValue for T where
T: SetValue + ?Sized,
[src]
T: SetValue + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,