Struct gstreamer::Bin [−]
pub struct Bin(_, _);
Bin
is an element that can contain other Element
, allowing them to be
managed as a group.
Pads from the child elements can be ghosted to the bin, see GhostPad
.
This makes the bin look like any other elements and enables creation of
higher-level abstraction elements.
A new Bin
is created with Bin::new
. Use a Pipeline
instead if you
want to create a toplevel bin because a normal bin doesn't have a bus or
handle clock distribution of its own.
After the bin has been created you will typically add elements to it with
BinExt::add
. You can remove elements with BinExt::remove
.
An element can be retrieved from a bin with BinExt::get_by_name
, using the
elements name. BinExt::get_by_name_recurse_up
is mainly used for internal
purposes and will query the parent bins when the element is not found in the
current bin.
An iterator of elements in a bin can be retrieved with
BinExt::iterate_elements
. Various other iterators exist to retrieve the
elements in a bin.
GstObjectExt::unref
is used to drop your reference to the bin.
The Bin::element-added
signal is fired whenever a new element is added to
the bin. Likewise the Bin::element-removed
signal is fired whenever an
element is removed from the bin.
Notes
A Bin
internally intercepts every Message
posted by its children and
implements the following default behaviour for each of them:
-
GST_MESSAGE_EOS: This message is only posted by sinks in the PLAYING state. If all sinks posted the EOS message, this bin will post and EOS message upwards.
-
GST_MESSAGE_SEGMENT_START: Just collected and never forwarded upwards. The messages are used to decide when all elements have completed playback of their segment.
-
GST_MESSAGE_SEGMENT_DONE: Is posted by
Bin
when all elements that posted a SEGMENT_START have posted a SEGMENT_DONE. -
GST_MESSAGE_DURATION_CHANGED: Is posted by an element that detected a change in the stream duration. The default bin behaviour is to clear any cached duration values so that the next duration query will perform a full duration recalculation. The duration change is posted to the application so that it can refetch the new duration with a duration query. Note that these messages can be posted before the bin is prerolled, in which case the duration query might fail.
-
GST_MESSAGE_CLOCK_LOST: This message is posted by an element when it can no longer provide a clock. The default bin behaviour is to check if the lost clock was the one provided by the bin. If so and the bin is currently in the PLAYING state, the message is forwarded to the bin parent. This message is also generated when a clock provider is removed from the bin. If this message is received by the application, it should PAUSE the pipeline and set it back to PLAYING to force a new clock distribution.
-
GST_MESSAGE_CLOCK_PROVIDE: This message is generated when an element can provide a clock. This mostly happens when a new clock provider is added to the bin. The default behaviour of the bin is to mark the currently selected clock as dirty, which will perform a clock recalculation the next time the bin is asked to provide a clock. This message is never sent tot the application but is forwarded to the parent of the bin.
-
OTHERS: posted upwards.
A Bin
implements the following default behaviour for answering to a
Query
:
-
GST_QUERY_DURATION:If the query has been asked before with the same format and the bin is a toplevel bin (ie. has no parent), use the cached previous value. If no previous value was cached, the query is sent to all sink elements in the bin and the MAXIMUM of all values is returned. If the bin is a toplevel bin the value is cached. If no sinks are available in the bin, the query fails.
-
GST_QUERY_POSITION:The query is sent to all sink elements in the bin and the MAXIMUM of all values is returned. If no sinks are available in the bin, the query fails.
-
OTHERS:the query is forwarded to all sink elements, the result of the first sink that answers the query successfully is returned. If no sink is in the bin, the query fails.
A Bin
will by default forward any event sent to it to all sink
(EventTypeFlags::Downstream
) or source (EventTypeFlags::Upstream
) elements
depending on the event type.
If all the elements return true
, the bin will also return true
, else false
is returned. If no elements of the required type are in the bin, the event
handler will return true
.
Implements
BinExt
, ElementExt
, GstObjectExt
, glib::object::ObjectExt
, ChildProxyExt
Methods
impl Bin
[src]
impl Bin
Trait Implementations
impl Clone for Bin
impl Clone for Bin
fn clone(&self) -> Bin
fn clone(&self) -> Bin
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Hash for Bin
impl Hash for Bin
fn hash<__H: Hasher>(&self, state: &mut __H)
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for Bin
impl Ord for Bin
fn cmp(&self, other: &Bin) -> Ordering
fn cmp(&self, other: &Bin) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl StaticType for Bin
impl StaticType for Bin
fn static_type() -> Type
fn static_type() -> Type
Returns the type identifier of Self
.
impl<T: IsA<Object>> PartialEq<T> for Bin
impl<T: IsA<Object>> PartialEq<T> for Bin
fn eq(&self, other: &T) -> bool
fn eq(&self, other: &T) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for Bin
impl Eq for Bin
impl<T: IsA<Object>> PartialOrd<T> for Bin
impl<T: IsA<Object>> PartialOrd<T> for Bin
fn partial_cmp(&self, other: &T) -> Option<Ordering>
fn partial_cmp(&self, other: &T) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for Bin
impl Debug for Bin
impl IsA<Element> for Bin
impl IsA<Element> for Bin
impl IsA<Object> for Bin
impl IsA<Object> for Bin
impl IsA<ChildProxy> for Bin
impl IsA<ChildProxy> for Bin
impl IsA<Object> for Bin
impl IsA<Object> for Bin
impl Send for Bin
[src]
impl Send for Bin
impl Sync for Bin
[src]
impl Sync for Bin
impl IsA<Bin> for Pipeline
impl IsA<Bin> for Pipeline