org.gstreamer
Class Bin

java.lang.Object
  extended by org.gstreamer.lowlevel.NativeValue
      extended by org.gstreamer.lowlevel.Handle
          extended by org.gstreamer.lowlevel.NativeObject
              extended by org.gstreamer.lowlevel.RefCountedObject
                  extended by org.gstreamer.GObject
                      extended by org.gstreamer.GstObject
                          extended by org.gstreamer.Element
                              extended by org.gstreamer.Bin
Direct Known Subclasses:
DecodeBin, Pipeline, RGBDataAppSink, RGBDataFileSink, RGBDataSink

public class Bin
extends Element

Base class and element that can contain other elements. Bin is an element that can contain other Elements, 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.


Nested Class Summary
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
 
Nested classes/interfaces inherited from class org.gstreamer.Element
Element.HANDOFF, Element.NO_MORE_PADS, Element.PAD_ADDED, Element.PAD_REMOVED
 
Nested classes/interfaces inherited from class org.gstreamer.GObject
GObject.GCallback
 
Nested classes/interfaces inherited from class org.gstreamer.lowlevel.NativeObject
NativeObject.Initializer
 
Field Summary
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
           
 
Fields inherited from class org.gstreamer.lowlevel.NativeObject
defaultInit, ownsHandle
 
Constructor Summary
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.
 
Method Summary
 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.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.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>
T
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 Elements contained in the Bin.
 java.util.List<Element> getElementsRecursive()
          Retrieve a list of the Elements 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 Elements contained in the Bin.
 java.util.List<Element> getSources()
          Retrieve a list of the source Elements contained in the Bin.
 boolean remove(Element element)
          Removes a Element from this Bin
 void removeMany(Element... elements)
          Removes an array of Element objects from this Bin
 
Methods inherited from class org.gstreamer.Element
addPad, connect, connect, connect, connect, disconnect, disconnect, disconnect, disconnect, getBaseTime, getBus, getClock, getFactory, getPad, getPads, getRequestPad, getSinkPads, getSrcPads, getState, getState, getState, getState, getStaticPad, link, link, linkMany, linkPads, linkPadsFiltered, makeRawElement, postMessage, releaseRequestPad, removePad, sendEvent, setCaps, setState, syncStateWithParent, unlink, unlinkMany, unlinkPads
 
Methods inherited from class org.gstreamer.GstObject
addListenerProxy, getName, getParent, initializer, initializer, objectFor, objectFor, ref, removeListenerProxy, setName, steal, toString, unref
 
Methods inherited from class org.gstreamer.GObject
addCallback, connect, connect, connect, disconnect, disconnect, disposeNativeHandle, g_signal_connect, get, getPointer, getPropertyDefaultValue, getPropertyMaximumValue, getPropertyMinimumValue, invalidate, objectFor, removeCallback, set
 
Methods inherited from class org.gstreamer.lowlevel.NativeObject
classFor, disown, dispose, equals, finalize, getNativeAddress, handle, hashCode, initializer, instanceFor, isDisposed, nativeValue, objectFor, objectFor
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG_GRAPH_SHOW_MEDIA_TYPE

public static final int DEBUG_GRAPH_SHOW_MEDIA_TYPE
See Also:
Constant Field Values

DEBUG_GRAPH_SHOW_CAPS_DETAILS

public static final int DEBUG_GRAPH_SHOW_CAPS_DETAILS
See Also:
Constant Field Values

DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS

public static final int DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS
See Also:
Constant Field Values

DEBUG_GRAPH_SHOW_STATES

public static final int DEBUG_GRAPH_SHOW_STATES
See Also:
Constant Field Values

DEBUG_GRAPH_SHOW_ALL

public static final int DEBUG_GRAPH_SHOW_ALL
See Also:
Constant Field Values
Constructor Detail

Bin

public Bin(NativeObject.Initializer init)

Bin

public Bin()
Creates a new Bin with a unique name.


Bin

public Bin(java.lang.String name)
Creates a new Bin with the given name.

Parameters:
name - The Name to assign to the new Bin
Method Detail

add

public boolean add(Element element)
Adds an Element to this Bin.

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.

Parameters:
element - The Element to add to this Bin.
Returns:
true if the element was successfully added, false if the Bin will not accept the element.

addMany

public void addMany(Element... elements)
Adds an array of Element objects to this Bin

Parameters:
elements - The array of Element to add to this Bin
See Also:
add(Element)

remove

public boolean remove(Element element)
Removes a Element from this Bin

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.

Parameters:
element - The Element to remove
Returns:
true if the element was successfully removed

removeMany

public void removeMany(Element... elements)
Removes an array of Element objects from this Bin

Parameters:
elements - The list Element to remove

getElements

public java.util.List<Element> getElements()
Retrieve a list of the Elements contained in the Bin.

Returns:
The List of Elements.

getElementsSorted

public java.util.List<Element> getElementsSorted()
Gets an a list of 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.

Returns:
The List of Elements.

getElementsRecursive

public java.util.List<Element> getElementsRecursive()
Retrieve a list of the Elements contained in the Bin and its Bin children. This differs from getElements() as it will also return Elements that are in any Bin elements contained in this Bin, also recursing down those Bins.

Returns:
The List of Elements.

getSinks

public java.util.List<Element> getSinks()
Retrieve a list of the sink Elements contained in the Bin.

Returns:
The List of sink Elements.

getSources

public java.util.List<Element> getSources()
Retrieve a list of the source Elements contained in the Bin.

Returns:
The List of source Elements.

getElementByName

public Element getElementByName(java.lang.String name)
Gets the Element with the given name from the bin. This function recurses into child bins.

Parameters:
name - The name of the Element to find.
Returns:
The Element if found, else null.

getElementByNameRecurseUp

public Element getElementByNameRecurseUp(java.lang.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.

Parameters:
name - The name of the Element to find.
Returns:
The Element if found, else null.

getElementByInterface

public <T extends Element> T getElementByInterface(java.lang.Class<T> iface)
Looks for an element inside the bin that implements the given interface. If such an element is found, it returns the element.

Parameters:
iface - The class of the Element to search for.
Returns:
The Element that implements the interface.

debugToDotFile

public void debugToDotFile(int details,
                           java.lang.String fileName)
Calls debugToDotFile(int, String, boolean) without timestamping


debugToDotFile

public 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. This file can be processed with graphviz to get an image. e.g. dot -Tpng -oimage.png graph_lowlevel.dot The function is only active if gstreamer is configured with "--gst-enable-gst-debug" and the environment variable GST_DEBUG_DUMP_DOT_DIR is set to a basepath (e.g. /tmp).

Parameters:
details - to show in the graph, e.g. DEBUG_GRAPH_SHOW_ALL
fileName - 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.

connect

public void connect(Bin.ELEMENT_ADDED listener)
Add a listener for the element-added signal on this Bin

Parameters:
listener - The listener to be called when an Element is added.

connect

public void connect(Bin.ELEMENT_REMOVED listener)
Add a listener for the element-removed signal on this Bin

Parameters:
listener - The listener to be called when an Element is removed.

disconnect

public void disconnect(Bin.ELEMENT_ADDED listener)
Disconnect the listener for the element-added signal

Parameters:
listener - The listener that was registered to receive the signal.

disconnect

public void disconnect(Bin.ELEMENT_REMOVED listener)
Disconnect the listener for the element-removed signal

Parameters:
listener - The listener that was registered to receive the signal.


Copyright © 2010. All Rights Reserved.