## GstPipeline GstPipeline — Top-level bin with clocking and bus management functionality. |

## Functions

GstElement * | gst_pipeline_new ()
GstBus * | gst_pipeline_get_bus ()
gboolean | gst_pipeline_set_clock ()
GstClock * | gst_pipeline_get_pipeline_clock ()
GstClock * | gst_pipeline_get_clock ()
void | gst_pipeline_use_clock ()
void | gst_pipeline_auto_clock ()
void | gst_pipeline_set_auto_flush_bus ()
gboolean | gst_pipeline_get_auto_flush_bus ()
void | gst_pipeline_set_delay ()
GstClockTime | gst_pipeline_get_delay ()
void | gst_pipeline_set_latency ()
GstClockTime | gst_pipeline_get_latency ()

## Properties

gboolean | auto-flush-bus | Read / Write
guint64 | delay | Read / Write
guint64 | latency | Read / Write

## Types and Values

struct | GstPipeline
enum | GstPipelineFlags

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBin
                        ╰── GstPipeline

## Implemented Interfaces

GstPipeline implements GstChildProxy.

## Includes

    #include <gst/gst.h>

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

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

## Functions

### gst_pipeline_new ()

    GstElement *
    gst_pipeline_new (const gchar *name);

Create a new pipeline with the given name.

#### Parameters

name | name of new pipeline. | [allow-none]

#### Returns

newly created GstPipeline

MT safe.

[transfer floating]

### gst_pipeline_get_bus ()

    GstBus *
    gst_pipeline_get_bus (GstPipeline *pipeline);

Gets the GstBus of `pipeline` . The bus allows applications to receive GstMessage packets.

#### Parameters

pipeline | a GstPipeline |

#### Returns

a GstBus, unref after usage.

MT safe.

[transfer full]

### gst_pipeline_set_clock ()

    gboolean
    gst_pipeline_set_clock (GstPipeline *pipeline,
                            GstClock *clock);

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

[skip]

#### Parameters

pipeline | a GstPipeline |
clock | the clock to set. | [transfer none]

#### Returns

`TRUE` if the clock could be set on the pipeline. `FALSE` if some element did not accept the clock.

MT safe.

### gst_pipeline_get_pipeline_clock ()

    GstClock *
    gst_pipeline_get_pipeline_clock (GstPipeline *pipeline);

Gets the current clock used by `pipeline` .

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

#### Parameters

pipeline | a GstPipeline |

#### Returns

a GstClock, unref after usage.

[transfer full]

Since: 1.6

### gst_pipeline_get_clock ()

    GstClock *
    gst_pipeline_get_clock (GstPipeline *pipeline);

Gets the current clock used by `pipeline` . Users of object oriented languages should use `gst_pipeline_get_pipeline_clock()` to avoid confusion with `gst_element_get_clock()` which has a different behavior.

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

[skip]

#### Parameters

pipeline | a GstPipeline |

#### Returns

a GstClock, unref after usage.

[transfer full]

### gst_pipeline_use_clock ()

    void
    gst_pipeline_use_clock (GstPipeline *pipeline,
                            GstClock *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.

#### Parameters

pipeline | a GstPipeline |
clock | the clock to use. | [transfer none][allow-none]

### gst_pipeline_auto_clock ()

    void
    gst_pipeline_auto_clock (GstPipeline *pipeline);

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.

#### Parameters

pipeline | a GstPipeline |

### gst_pipeline_set_auto_flush_bus ()

    void
    gst_pipeline_set_auto_flush_bus (GstPipeline *pipeline,
                                     gboolean auto_flush);

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.

#### Parameters

pipeline | a GstPipeline |
auto_flush | whether or not to automatically flush the bus when the pipeline goes from READY to NULL state |

### gst_pipeline_get_auto_flush_bus ()

    gboolean
    gst_pipeline_get_auto_flush_bus (GstPipeline *pipeline);

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

#### Parameters

pipeline | a GstPipeline |

#### Returns

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

MT safe.

### gst_pipeline_set_delay ()

    void
    gst_pipeline_set_delay (GstPipeline *pipeline,
                            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.

#### Parameters

pipeline | a GstPipeline |
delay | the delay |

### gst_pipeline_get_delay ()

    GstClockTime
    gst_pipeline_get_delay (GstPipeline *pipeline);

Get the configured delay (see `gst_pipeline_set_delay()`).

#### Parameters

pipeline | a GstPipeline |

#### Returns

The configured delay.

MT safe.

### gst_pipeline_set_latency ()

    void
    gst_pipeline_set_latency (GstPipeline *pipeline,
                              GstClockTime latency);

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.

#### Parameters

pipeline | a GstPipeline |
latency | latency to configure |

Since: 1.6

### gst_pipeline_get_latency ()

    GstClockTime
    gst_pipeline_get_latency (GstPipeline *pipeline);

Gets the latency that should be configured on the pipeline. See `gst_pipeline_set_latency()`.

#### Parameters

pipeline | a GstPipeline |

#### Returns

Latency to configure on the pipeline or GST_CLOCK_TIME_NONE

Since: 1.6

## Types and Values

### struct GstPipeline

    struct GstPipeline {
      GstClock      *fixed_clock;

      GstClockTime   stream_time;
      GstClockTime   delay;
    };

The GstPipeline structure.

#### Members

GstClock *`fixed_clock`; | The fixed clock of the pipeline, used when GST_PIPELINE_FLAG_FIXED_CLOCK is set. |
GstClockTime `stream_time`; | 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 GstElement). |
GstClockTime `delay`; | Extra delay added to base_time to compensate for computing delays when setting elements to PLAYING. |

### enum GstPipelineFlags

Pipeline flags

#### Members

GST_PIPELINE_FLAG_FIXED_CLOCK | this pipeline works with a fixed clock |
GST_PIPELINE_FLAG_LAST | offset to define more flags |

## Property Details

### The `“auto-flush-bus”` property

      “auto-flush-bus”           gboolean

Whether or not to automatically flush all messages on the pipeline's bus when going from READY to NULL state. Please see `gst_pipeline_set_auto_flush_bus()` for more information on this option.

Flags: Read / Write

Default value: TRUE

### The `“delay”` property

      “delay”                    guint64

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.

Flags: Read / Write

Default value: 0

### The `“latency”` property

      “latency”                  guint64

Latency to configure on the pipeline. See `gst_pipeline_set_latency()`.

Flags: Read / Write

Default value: 18446744073709551615

Since: 1.6

## See Also

GstElement, GstBin, GstClock, GstBus