Pipeline

Description A GstPipeline is a special GstBin used as the toplevel container for the filter graph. The GstPipeline will manage the selection and distribution of a global GstClock as well as provide a GstBus to the application. It will also implement a default behavour for managing seek events (see gst_element_seek()). gst_pipeline_new() is used to create a pipeline. when you are done with the pipeline, use gst_object_unref() to free its resources including all added GstElement objects (if not otherwise referenced). Elements are added and removed from the pipeline using the GstBin methods like gst_bin_add() and gst_bin_remove() (see GstBin). Before changing the state of the GstPipeline (see GstElement) a GstBus can be retrieved with gst_pipeline_get_bus(). This bus can then be used to receive GstMessage from the elements in the pipeline. By default, a GstPipeline will automatically flush the pending GstBus messages when going to the NULL state to ensure that no circular references exist when no messages are read from the GstBus. This behaviour can be changed with gst_pipeline_set_auto_flush_bus(). When the GstPipeline performs the PAUSED to PLAYING state change it will select a clock for the elements. The clock selection algorithm will by default select a clock provided by an element that is most upstream (closest to the source). For live pipelines (ones that return GST_STATE_CHANGE_NO_PREROLL from the gst_element_set_state() call) this will select the clock provided by the live source. For normal pipelines this will select a clock provided by the sinks (most likely the audio sink). If no element provides a clock, a default GstSystemClock is used. The clock selection can be controlled with the gst_pipeline_use_clock() method, which will enforce a given clock on the pipeline. With gst_pipeline_auto_clock() the default clock selection algorithm can be restored. A GstPipeline maintains a stream time for the elements. The stream time is defined as the difference between the current clock time and the base time. When the pipeline goes to READY or a flushing seek is performed on it, the stream time is reset to 0. When the pipeline is set from PLAYING to PAUSED, the current clock time is sampled and used to configure the base time for the elements when the pipeline is set to PLAYING again. This default behaviour can be changed with the gst_pipeline_set_new_stream_time() method. When sending a flushing seek event to a GstPipeline (see gst_element_seek()), it will make sure that the pipeline is properly PAUSED and resumed as well as set the new stream time to 0 when the seek succeeded. Last reviewed on 2006-03-12 (0.10.5)

Constructors

this
this(GstPipeline* gstPipeline)

Sets our main struct and passes it to the parent class

this
this(string name)

Create a new pipeline with the given name.

Members

Functions

autoClock
void autoClock()

Let pipeline select a clock automatically. This is the default behaviour. Use this function if you previous forced a fixed clock with gst_pipeline_use_clock() and want to restore the default pipeline clock selection algorithm. MT safe.

getAutoFlushBus
int getAutoFlushBus()

Check if pipeline will automatically flush messages when going to the NULL state.

getBus
Bus getBus()

Gets the GstBus of pipeline.

getClock
Clock getClock()

Gets the current clock used by pipeline.

getDelay
GstClockTime getDelay()

Get the configured delay (see gst_pipeline_set_delay()).

getLastStreamTime
GstClockTime getLastStreamTime()

Gets the last stream time of pipeline. If the pipeline is PLAYING, the returned time is the stream time used to configure the element's base time in the PAUSED->PLAYING state. If the pipeline is PAUSED, the returned time is the stream time when the pipeline was paused. This function returns GST_CLOCK_TIME_NONE if the pipeline was configured to not handle the management of the element's base time (see gst_pipeline_set_new_stream_time()).

getPipelineStruct
GstPipeline* getPipelineStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setAutoFlushBus
void setAutoFlushBus(int autoFlush)

Usually, when a pipeline goes from READY to NULL state, it automatically flushes all pending messages on the bus, which is done for refcounting purposes, to break circular references. This means that applications that update state using (async) bus messages (e.g. do certain things when a pipeline goes from PAUSED to READY) might not get to see messages when the pipeline is shut down, because they might be flushed before they can be dispatched in the main thread. This behaviour can be disabled using this function. It is important that all messages on the bus are handled when the automatic flushing is disabled else memory leaks will be introduced. MT safe.

setClock
int setClock(Clock clock)

Set the clock for pipeline. The clock will be distributed to all the elements managed by the pipeline.

setDelay
void setDelay(GstClockTime delay)

Set the expected delay needed for all elements to perform the PAUSED to PLAYING state change. delay will be added to the base time of the elements so that they wait an additional delay amount of time before starting to process buffers and cannot be GST_CLOCK_TIME_NONE. This option is used for tuning purposes and should normally not be used. MT safe.

setNewStreamTime
void setNewStreamTime(GstClockTime time)

Set the new stream time of pipeline to time. The stream time is used to set the base time on the elements (see gst_element_set_base_time()) in the PAUSED->PLAYING state transition. Setting time to GST_CLOCK_TIME_NONE will disable the pipeline's management of element base time. The application will then be responsible for performing base time distribution. This is sometimes useful if you want to synchronize capture from multiple pipelines, and you can also ensure that the pipelines have the same clock. MT safe.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
useClock
void useClock(Clock clock)

Force pipeline to use the given clock. The pipeline will always use the given clock even if new clock providers are added to this pipeline. If clock is NULL all clocking will be disabled which will make the pipeline run as fast as possible. MT safe.

Variables

gstPipeline
GstPipeline* gstPipeline;

the main Gtk struct

Inherited Members

From Bin

gstBin
GstBin* gstBin;

the main Gtk struct

getBinStruct
GstBin* getBinStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
connectedSignals
int[string] connectedSignals;
onElementAddedListeners
void delegate(Element, Bin)[] onElementAddedListeners;
Undocumented in source.
addOnElementAdded
void addOnElementAdded(void delegate(Element, Bin) dlg, ConnectFlags connectFlags)

Will be emitted after the element was added to the bin.

callBackElementAdded
void callBackElementAdded(GstBin* binStruct, GstElement* element, Bin _bin)
Undocumented in source. Be warned that the author may not have intended to support it.
onElementRemovedListeners
void delegate(Element, Bin)[] onElementRemovedListeners;
Undocumented in source.
addOnElementRemoved
void addOnElementRemoved(void delegate(Element, Bin) dlg, ConnectFlags connectFlags)

Will be emitted after the element was removed from the bin.

callBackElementRemoved
void callBackElementRemoved(GstBin* binStruct, GstElement* element, Bin _bin)
Undocumented in source. Be warned that the author may not have intended to support it.
add
int add(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. If the element's pads are linked to other pads, the pads will be unlinked before the element is added to the bin. MT safe.

remove
int remove(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 will be freed in the process of removing it from the bin. If you want the element to still exist after removing, you need to call gst_object_ref() before removing it from the bin. If the element's pads are linked to other pads, the pads will be unlinked before the element is removed from the bin. MT safe.

getByName
Element getByName(string name)

Gets the element with the given name from a bin. This function recurses into child bins. Returns NULL if no element with the given name is found in the bin. MT safe. Caller owns returned reference.

getByNameRecurseUp
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.

getByInterface
Element getByInterface(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 want all elements that implement the interface, use gst_bin_iterate_all_by_interface(). This function recurses into child bins. MT safe. Caller owns returned reference.

iterateElements
Iterator iterateElements()

Gets an iterator for the elements in this bin. Each element yielded by the iterator will have its refcount increased, so unref after use. MT safe. Caller owns returned value.

iterateRecurse
Iterator iterateRecurse()

Gets an iterator for the elements in this bin. This iterator recurses into GstBin children. Each element yielded by the iterator will have its refcount increased, so unref after use. MT safe. Caller owns returned value.

iterateSinks
Iterator iterateSinks()

Gets an iterator for all elements in the bin that have the GST_ELEMENT_IS_SINK flag set. Each element yielded by the iterator will have its refcount increased, so unref after use. MT safe. Caller owns returned value.

iterateSorted
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. This function is used internally to perform the state changes of the bin elements. Each element yielded by the iterator will have its refcount increased, so unref after use. MT safe. Caller owns returned value.

iterateSources
Iterator iterateSources()

Gets an iterator for all elements in the bin that have no sinkpads and have the GST_ELEMENT_IS_SINK flag unset. Each element yielded by the iterator will have its refcount increased, so unref after use. MT safe. Caller owns returned value.

iterateAllByInterface
Iterator iterateAllByInterface(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 will yield a series of GstElement that should be unreffed after use. Each element yielded by the iterator will have its refcount increased, so unref after use. MT safe. Caller owns returned value.

findUnconnectedPad
Pad findUnconnectedPad(GstPadDirection direction)

Recursively looks for elements with an unconnected pad of the given direction within the specified bin and returns an unconnected pad if one is found, or NULL otherwise. If a pad is found, the caller owns a reference to it and should use gst_object_unref() on the pad when it is not needed any longer.

Meta