Struct gstreamer_base::FlowCombiner
source · 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.
GLib type: Shared boxed type with reference counted clone semantics.
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(ptr: &*mut GstFlowCombiner) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GstFlowCombiner) -> &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 for FlowCombiner
impl PartialEq for FlowCombiner
source§impl PartialOrd for FlowCombiner
impl PartialOrd for FlowCombiner
source§impl StaticType for FlowCombiner
impl StaticType for FlowCombiner
source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for FlowCombiner
impl StructuralPartialEq for FlowCombiner
Auto Trait Implementations§
impl Freeze for FlowCombiner
impl RefUnwindSafe for FlowCombiner
impl !Send for FlowCombiner
impl !Sync for FlowCombiner
impl Unpin for FlowCombiner
impl UnwindSafe for FlowCombiner
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *const GList) -> Vec<T>
unsafe fn from_glib_container_as_vec(_: *const GList) -> Vec<T>
unsafe fn from_glib_full_as_vec(_: *const GList) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *const GPtrArray) -> Vec<T>
unsafe fn from_glib_container_as_vec(_: *const GPtrArray) -> Vec<T>
unsafe fn from_glib_full_as_vec(_: *const GPtrArray) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *const GSList) -> Vec<T>
unsafe fn from_glib_container_as_vec(_: *const GSList) -> Vec<T>
unsafe fn from_glib_full_as_vec(_: *const GSList) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *mut GList) -> Vec<T>
unsafe fn from_glib_container_as_vec(ptr: *mut GList) -> Vec<T>
unsafe fn from_glib_full_as_vec(ptr: *mut GList) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *mut GPtrArray) -> Vec<T>
unsafe fn from_glib_container_as_vec(ptr: *mut GPtrArray) -> Vec<T>
unsafe fn from_glib_full_as_vec(ptr: *mut GPtrArray) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *mut GSList) -> Vec<T>
unsafe fn from_glib_container_as_vec(ptr: *mut GSList) -> Vec<T>
unsafe fn from_glib_full_as_vec(ptr: *mut GSList) -> Vec<T>
source§impl<T> IntoClosureReturnValue for T
impl<T> IntoClosureReturnValue for T
fn into_closure_return_value(self) -> Option<Value>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more