public class Bin extends Element
Element
s, 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(String)
. 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
add(Element)
. Elements can be removed with remove(Element)
An element can be retrieved from a bin with getElementByName(String)
.
A list of elements contained in a bin can be retrieved with getElements()
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.
Modifier and Type | Class and Description |
---|---|
static interface |
Bin.DO_LATENCY
Signal emitted when an
Element has latency |
static interface |
Bin.ELEMENT_ADDED
Signal emitted when an
Element is added to this Bin |
static interface |
Bin.ELEMENT_REMOVED
Signal emitted when an
Element is removed from this Bin |
Element.NO_MORE_PADS, Element.PAD_ADDED, Element.PAD_REMOVED
GObject.GCallback
NativeObject.Initializer
Modifier and Type | Field and Description |
---|---|
static int |
DEBUG_GRAPH_SHOW_ALL |
static int |
DEBUG_GRAPH_SHOW_CAPS_DETAILS |
static int |
DEBUG_GRAPH_SHOW_MEDIA_TYPE |
static int |
DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS |
static int |
DEBUG_GRAPH_SHOW_STATES |
defaultInit, ownsHandle
Constructor and Description |
---|
Bin()
Creates a new Bin with a unique name.
|
Bin(NativeObject.Initializer init) |
Bin(java.lang.String name)
Creates a new Bin with the given name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Element element)
Adds an Element to this Bin.
|
void |
addMany(Element... elements)
Adds an array of Element objects to this Bin
|
void |
connect(Bin.DO_LATENCY listener)
Add a listener for the
do-latency signal on this Bin |
void |
connect(Bin.ELEMENT_ADDED listener)
Add a listener for the
element-added signal on this Bin |
void |
connect(Bin.ELEMENT_REMOVED listener)
Add a listener for the
element-removed signal on this Bin |
void |
debugToDotFile(int details,
java.lang.String fileName)
Calls
debugToDotFile(int, String, boolean) without timestamping |
void |
debugToDotFile(int details,
java.lang.String fileName,
boolean timestampFileName)
To aid debugging applications one can use this method to write out the whole
network of gstreamer elements that form the pipeline into an dot file.
|
void |
disconnect(Bin.DO_LATENCY listener)
Disconnect the listener for the
do-latency signal |
void |
disconnect(Bin.ELEMENT_ADDED listener)
Disconnect the listener for the
element-added signal |
void |
disconnect(Bin.ELEMENT_REMOVED listener)
Disconnect the listener for the
element-removed signal |
<T extends Element> |
getElementByInterface(java.lang.Class<T> iface)
Looks for an element inside the bin that implements the given
interface.
|
Element |
getElementByName(java.lang.String name)
Gets the
Element with the given name from the bin. |
Element |
getElementByNameRecurseUp(java.lang.String name)
Gets the element with the given name from this bin.
|
java.util.List<Element> |
getElements()
Retrieve a list of the
Element s contained in the Bin. |
java.util.List<Element> |
getElementsRecursive()
Retrieve a list of the
Element s contained in the Bin and its Bin children. |
java.util.List<Element> |
getElementsSorted()
Gets an a list of the elements in this bin in topologically
sorted order.
|
java.util.List<Element> |
getSinks()
Retrieve a list of the sink
Element s contained in the Bin. |
java.util.List<Element> |
getSources()
Retrieve a list of the source
Element s contained in the Bin. |
static Bin |
launch(java.lang.String binDecription,
boolean ghostUnlinkedPads)
Creates a bin from a text bin description.
|
boolean |
remove(Element element)
Removes a Element from this Bin
|
void |
removeMany(Element... elements)
Removes an array of
Element objects from this Bin |
addPad, connect, connect, connect, disconnect, disconnect, disconnect, getBaseTime, getBus, getClock, getFactory, getPad, getPads, getRequestPad, getSinkPads, getSrcPads, getStartTime, getState, getState, getState, getState, getStaticPad, isPlaying, link, link, linkMany, linkPads, linkPadsFiltered, makeRawElement, pause, play, postMessage, ready, releaseRequestPad, removePad, sendEvent, setBaseTime, setCaps, setLockedState, setStartTime, setState, stop, syncStateWithParent, unlink, unlinkMany, unlinkPads
addListenerProxy, getName, getParent, initializer, initializer, ref, removeListenerProxy, setName, steal, toString, unref
addCallback, connect, connect, connect, disconnect, disconnect, disposeNativeHandle, emit, emit, g_signal_connect, get, getPointer, getPropertyDefaultValue, getPropertyMaximumValue, getPropertyMinimumValue, getType, invalidate, objectForX, removeCallback, set
classFor, disown, dispose, equals, finalize, getNativeAddress, handle, hashCode, initializer, instanceFor, isDisposed, nativeValue, objectFor, objectFor, objectFor, objectFor
public static final int DEBUG_GRAPH_SHOW_MEDIA_TYPE
public static final int DEBUG_GRAPH_SHOW_CAPS_DETAILS
public static final int DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS
public static final int DEBUG_GRAPH_SHOW_STATES
public static final int DEBUG_GRAPH_SHOW_ALL
public Bin(NativeObject.Initializer init)
public Bin()
public Bin(java.lang.String name)
name
- The Name to assign to the new Binpublic static Bin launch(java.lang.String binDecription, boolean ghostUnlinkedPads)
binDecription
- the command line describing the binghostUnlinkedPads
- whether to create ghost pads for the bin from any unlinked padspublic boolean add(Element element)
Sets the element's parent, and thus takes ownership of the element. An element can only be added to one bin.
If the element's pads are linked to other pads, the pads will be unlinked before the element is added to the bin.
element
- The Element
to add to this Bin.public void addMany(Element... elements)
elements
- The array of Element
to add to this Binadd(Element)
public boolean remove(Element element)
Removes the element from the bin, unparenting it as well. If the element's pads are linked to other pads, the pads will be unlinked before the element is removed from the bin.
element
- The Element
to removepublic void removeMany(Element... elements)
Element
objects from this Binelements
- The list Element
to removepublic java.util.List<Element> getElements()
Element
s contained in the Bin.Element
s.public java.util.List<Element> getElementsSorted()
Element
s.public java.util.List<Element> getElementsRecursive()
Element
s contained in the Bin and its Bin children.
This differs from getElements()
as it will also return Element
s
that are in any Bin elements contained in this Bin, also recursing down those Bins.Element
s.public java.util.List<Element> getSinks()
Element
s contained in the Bin.Element
s.public java.util.List<Element> getSources()
Element
s contained in the Bin.Element
s.public Element getElementByName(java.lang.String name)
Element
with the given name from the bin. This
function recurses into child bins.public Element getElementByNameRecurseUp(java.lang.String name)
public <T extends Element> T getElementByInterface(java.lang.Class<T> iface)
public void debugToDotFile(int details, java.lang.String fileName)
debugToDotFile(int, String, boolean)
without timestampingpublic void debugToDotFile(int details, java.lang.String fileName, boolean timestampFileName)
details
- to show in the graph, e.g. DEBUG_GRAPH_SHOW_ALLfileName
- output base filename (e.g. "myplayer")timestampFileName
- if true it adds the current timestamp
to the filename, so that it can be used to take multiple snapshots.public void connect(Bin.ELEMENT_ADDED listener)
element-added
signal on this Binlistener
- The listener to be called when an Element
is added.public void disconnect(Bin.ELEMENT_ADDED listener)
element-added
signallistener
- The listener that was registered to receive the signal.public void connect(Bin.ELEMENT_REMOVED listener)
element-removed
signal on this Binlistener
- The listener to be called when an Element
is removed.public void disconnect(Bin.ELEMENT_REMOVED listener)
element-removed
signallistener
- The listener that was registered to receive the signal.public void connect(Bin.DO_LATENCY listener)
do-latency
signal on this Binlistener
- The listener to be called when an Element
is removed.public void disconnect(Bin.DO_LATENCY listener)
do-latency
signallistener
- The listener that was registered to receive the signal.