gst.bin
Module for [Bin] class
Types 3
#GstBin is an element that can contain other #GstElement, allowing them to be managed as a group. Pads from the child elements can be ghosted to the bin, see #GstGhostPad. This makes the bin look like any other elements and enables creation of higher-level abstraction elements.
A new #GstBin is created with [gst.bin.Bin.new_]. Use a #GstPipeline 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 [gst.bin.Bin.add]. You can remove elements with [gst.bin.Bin.remove].
An element can be retrieved from a bin with [gst.bin.Bin.getByName], using the elements name. [gst.bin.Bin.getByNameRecurseUp] 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 [gst.bin.Bin.iterateElements]. Various other iterators exist to retrieve the elements in a bin.
[gst.object.ObjectWrap.unref] is used to drop your reference to the bin.
The #GstBin::element-added signal is fired whenever a new element is added to the bin. Likewise the #GstBin::element-removed signal is fired whenever an element is removed from the bin.
A #GstBin internally intercepts every #GstMessage posted by its children and implements the following default behaviour for each of them:
- [gst.types.MessageType.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.types.MessageType.SegmentStart]: Just collected and never forwarded upwards.
The messages are used to decide when all elements have completed playback of their segment.
- [gst.types.MessageType.SegmentDone]: Is posted by #GstBin when all elements that posted
a SEGMENT_START have posted a SEGMENT_DONE.
- [gst.types.MessageType.DurationChanged]: Is posted by an element that detected a change
in the stream duration. 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.
Note also that there might be a discrepancy (due to internal buffering/queueing) between the stream being currently displayed and the returned duration query.
Applications might want to also query for duration (and changes) by listening to the [gst.types.MessageType.StreamStart] message, signaling the active start of a (new) stream.
- [gst.types.MessageType.ClockLost]: 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.types.MessageType.ClockProvide]: 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 to the application but is forwarded to the parent of the bin.
- OTHERS: posted upwards.
A #GstBin implements the following default behaviour for answering to a #GstQuery:
- [gst.types.QueryType.Duration]: The bin will forward the query to all sink
elements contained within and will return the maximum value. If no sinks are available in the bin, the query fails.
- [gst.types.QueryType.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 #GstBin will by default forward any event sent to it to all sink ( [gst.types.EventTypeFlags.Upstream] ) or source ( [gst.types.EventTypeFlags.Downstream] ) 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.
BinGidBuilder builder()Get builder for [gst.bin.Bin] Returns: New builder objectbool asyncHandling() @propertyGet `asyncHandling` property. Returns: If set to true, the bin will handle asynchronous state changes. This should be used only if the bin subclass is modifying the state of its children on its own.void asyncHandling(bool propval) @propertySet `asyncHandling` property. Params: propval = If set to true, the bin will handle asynchronous state changes. This should be used only if the bin subclass is modifying the state of its children o...bool messageForward() @propertyGet `messageForward` property. Returns: Forward all children messages, even those that would normally be filtered by the bin. This can be interesting when one wants to be notified of the EOS state ...void messageForward(bool propval) @propertySet `messageForward` property. Params: propval = Forward all children messages, even those that would normally be filtered by the bin. This can be interesting when one wants to be notified of the E...bool add(gst.element.Element element)Adds the given element to the bin. Sets the element's parent, and thus takes ownership of the element. An element can only be added to one bin.gst.pad.Pad findUnlinkedPad(gst.types.PadDirection direction)Recursively looks for elements with an unlinked pad of the given direction within the specified bin and returns an unlinked pad if one is found, or null otherwise. If a pad is found, the caller own...gst.element.Element getByInterface(gobject.types.GType iface)Looks for an element inside the bin that implements the given interface. If such an element is found, it returns the element. You can cast this element to the given interface afterwards. If you wa...gst.element.Element getByName(string name)Gets the element with the given name from a bin. This function recurses into child bins.gst.element.Element getByNameRecurseUp(string name)Gets the element with the given name from this bin. If the element is not found, a recursion is performed on the parent bin.gst.iterator.Iterator iterateAllByElementFactoryName(string factoryName)Looks for all elements inside the bin with the given element factory name. The function recurses inside child bins. The iterator will yield a series of #GstElement.gst.iterator.Iterator iterateAllByInterface(gobject.types.GType iface)Looks for all elements inside the bin that implements the given interface. You can safely cast all returned elements to the given interface. The function recurses inside child bins. The iterator wi...gst.iterator.Iterator iterateElements()Gets an iterator for the elements in this bin. Returns: a #GstIterator of #GstElementgst.iterator.Iterator iterateRecurse()Gets an iterator for the elements in this bin. This iterator recurses into GstBin children. Returns: a #GstIterator of #GstElementgst.iterator.Iterator iterateSinks()Gets an iterator for all elements in the bin that have the #GSTELEMENTFLAG_SINK flag set. Returns: a #GstIterator of #GstElementgst.iterator.Iterator iterateSorted()Gets an iterator for the elements in this bin in topologically sorted order. This means that the elements are returned from the most downstream elements (sinks) to the sources.gst.iterator.Iterator iterateSources()Gets an iterator for all elements in the bin that have the #GSTELEMENTFLAG_SOURCE flag set. Returns: a #GstIterator of #GstElementbool recalculateLatency()Queries bin for the current latency and reconfigures this latency on all the elements using a LATENCY event.bool remove(gst.element.Element element)Removes the element from the bin, unparenting it as well. Unparenting the element means that the element will be dereferenced, so if the bin holds the only reference to the element, the element wil...void setSuppressedFlags(gst.types.ElementFlags flags)Suppresses the given flags on the bin. #GstElementFlags of a child element are propagated when it is added to the bin. When suppressed flags are set, those specified flags will not be propagated to...bool syncChildrenStates()Synchronizes the state of every child of bin with the state of bin. See also [gst.element.Element.syncStateWithParent]. Returns: true if syncing the state was successful for all children, otherwise...gulong connectDeepElementAdded(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gst.bin.Bin)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gst.element.Element)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gst.bin.Bin)))
&& Parameters!T.length < 4)Connect to `DeepElementAdded` signal.gulong connectDeepElementRemoved(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gst.bin.Bin)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gst.element.Element)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gst.bin.Bin)))
&& Parameters!T.length < 4)Connect to `DeepElementRemoved` signal.gulong connectDoLatency(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gst.bin.Bin)))
&& Parameters!T.length < 2)Connect to `DoLatency` signal.gulong connectElementAdded(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gst.element.Element)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gst.bin.Bin)))
&& Parameters!T.length < 3)Connect to `ElementAdded` signal.gulong connectElementRemoved(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gst.element.Element)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gst.bin.Bin)))
&& Parameters!T.length < 3)Connect to `ElementRemoved` signal.T asyncHandling(bool propval)Set `asyncHandling` property. Params: propval = If set to true, the bin will handle asynchronous state changes. This should be used only if the bin subclass is modifying the state of its children o...T messageForward(bool propval)Set `messageForward` property. Params: propval = Forward all children messages, even those that would normally be filtered by the bin. This can be interesting when one wants to be notified of the E...