Gst.Pipeline

g GObject.GInterface GObject.GInterface Gst.ChildProxy Gst.ChildProxy GObject.GInterface->Gst.ChildProxy GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Bin Gst.Bin Gst.Pipeline Gst.Pipeline Gst.Bin->Gst.Pipeline Gst.ChildProxy->Gst.Bin Gst.Element Gst.Element Gst.Element->Gst.Bin Gst.Object->Gst.Element

Subclasses:

None

Methods

Inherited:

Gst.Bin (18), Gst.Element (81), Gst.Object (27), GObject.Object (37), Gst.ChildProxy (9)

Structs:

Gst.ElementClass (10), GObject.ObjectClass (5)

class

new (name)

auto_clock ()

get_auto_flush_bus ()

get_bus ()

get_delay ()

get_latency ()

get_pipeline_clock ()

set_auto_flush_bus (auto_flush)

set_delay (delay)

set_latency (latency)

use_clock (clock)

Virtual Methods

Inherited:

Gst.Bin (8), Gst.Element (16), Gst.Object (1), GObject.Object (7), Gst.ChildProxy (5)

Properties

Inherited:

Gst.Bin (2), Gst.Object (2)

Name

Type

Flags

Short Description

auto-flush-bus

bool

r/w

Whether to automatically flush the pipeline’s bus when going from READY into None state

delay

int

r/w

Expected delay needed for elements to spin up to PLAYING in nanoseconds

latency

int

r/w

Latency to configure on the pipeline

Signals

Inherited:

Gst.Bin (5), Gst.Element (3), Gst.Object (1), GObject.Object (1), Gst.ChildProxy (2)

Fields

Inherited:

Gst.Bin (5), Gst.Element (3), Gst.Object (1), GObject.Object (1), Gst.ChildProxy (2)

Name

Type

Access

Description

bin

Gst.Bin

r

delay

int

r

Extra delay added to base_time to compensate for computing delays when setting elements to PLAYING.

fixed_clock

Gst.Clock

r

The fixed clock of the pipeline, used when Gst.PipelineFlags.FIXED_CLOCK is set.

stream_time

int

r

The stream time of the pipeline. A better name for this property would be the running_time, the total time spent in the PLAYING state without being flushed. (deprecated, use the start_time on Gst.Element).

Class Details

class Gst.Pipeline(**kwargs)
Bases:

Gst.Bin

Abstract:

No

Structure:

Gst.PipelineClass

A Gst.Pipeline is a special Gst.Bin used as the toplevel container for the filter graph. The Gst.Pipeline will manage the selection and distribution of a global Gst.Clock as well as provide a Gst.Bus to the application.

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 Gst.Element objects (if not otherwise referenced).

Elements are added and removed from the pipeline using the Gst.Bin methods like Gst.Bin.add() and Gst.Bin.remove() (see Gst.Bin).

Before changing the state of the Gst.Pipeline (see Gst.Element) a Gst.Bus should be retrieved with Gst.Pipeline.get_bus(). This Gst.Bus should then be used to receive Gst.Message from the elements in the pipeline. Listening to the Gst.Bus is necessary for retrieving error messages from the Gst.Pipeline and otherwise the Gst.Pipeline might stop without any indication, why. Furthermore, the Gst.Pipeline posts messages even if nobody listens on the Gst.Bus, which will pile up and use up memory.

By default, a Gst.Pipeline will automatically flush the pending Gst.Bus messages when going to the None state to ensure that no circular references exist when no messages are read from the Gst.Bus. This behaviour can be changed with Gst.Pipeline.set_auto_flush_bus().

When the Gst.Pipeline 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.StateChangeReturn.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 Gst.SystemClock 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 Gst.Pipeline maintains a running time for the elements. The running 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 running 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. The effect is that the running time (as the difference between the clock time and the base time) will count how much time was spent in the PLAYING state. This default behaviour can be changed with the Gst.Element.set_start_time() method.

classmethod new(name)[source]
Parameters:

name (str or None) – name of new pipeline

Returns:

newly created Gst.Pipeline

MT safe.

Return type:

Gst.Element

Create a new pipeline with the given name.

auto_clock()[source]

Let self 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.

get_auto_flush_bus()[source]
Returns:

whether the pipeline will automatically flush its bus when going from READY to None state or not.

MT safe.

Return type:

bool

Check if self will automatically flush messages when going to the None state.

get_bus()[source]
Returns:

a Gst.Bus, unref after usage.

MT safe.

Return type:

Gst.Bus

Gets the Gst.Bus of self. The bus allows applications to receive Gst.Message packets.

get_delay()[source]
Returns:

The configured delay.

MT safe.

Return type:

int

Get the configured delay (see Gst.Pipeline.set_delay()).

get_latency()[source]
Returns:

Latency to configure on the pipeline or Gst.CLOCK_TIME_NONE

Return type:

int

Gets the latency that should be configured on the pipeline. See Gst.Pipeline.set_latency().

New in version 1.6.

get_pipeline_clock()[source]
Returns:

a Gst.Clock, unref after usage.

Return type:

Gst.Clock

Gets the current clock used by self.

Unlike Gst.Element.get_clock(), this function will always return a clock, even if the pipeline is not in the PLAYING state.

New in version 1.6.

set_auto_flush_bus(auto_flush)[source]
Parameters:

auto_flush (bool) – whether or not to automatically flush the bus when the pipeline goes from READY to None state

Usually, when a pipeline goes from READY to None 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.

set_delay(delay)[source]
Parameters:

delay (int) – the 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.

set_latency(latency)[source]
Parameters:

latency (int) – latency to configure

Sets the latency that should be configured on the pipeline. Setting Gst.CLOCK_TIME_NONE will restore the default behaviour of using the minimum latency from the LATENCY query. Setting this is usually not required and the pipeline will figure out an appropriate latency automatically.

Setting a too low latency, especially lower than the minimum latency from the LATENCY query, will most likely cause the pipeline to fail.

New in version 1.6.

use_clock(clock)[source]
Parameters:

clock (Gst.Clock or None) – the clock to use

Force self 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 None all clocking will be disabled which will make the pipeline run as fast as possible.

MT safe.

Property Details

Gst.Pipeline.props.auto_flush_bus
Name:

auto-flush-bus

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether or not to automatically flush all messages on the pipeline’s bus when going from READY to None state. Please see Gst.Pipeline.set_auto_flush_bus() for more information on this option.

Gst.Pipeline.props.delay
Name:

delay

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The expected delay needed for elements to spin up to the PLAYING state expressed in nanoseconds. see Gst.Pipeline.set_delay() for more information on this option.

Gst.Pipeline.props.latency
Name:

latency

Type:

int

Default Value:

18446744073709551615

Flags:

READABLE, WRITABLE

Latency to configure on the pipeline. See Gst.Pipeline.set_latency().

New in version 1.6.