:right-sidebar: True Pipeline =================================================================== .. currentmodule:: gi.repository.Gst .. class:: Pipeline(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gst.Bin`, :class:`~gi.repository.Gst.Element`, :class:`~gi.repository.Gst.Object`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gst.ChildProxy` A :obj:`~gi.repository.Gst.Pipeline` is a special :obj:`~gi.repository.Gst.Bin` used as the toplevel container for the filter graph. The :obj:`~gi.repository.Gst.Pipeline` will manage the selection and distribution of a global :obj:`~gi.repository.Gst.Clock` as well as provide a :obj:`~gi.repository.Gst.Bus` to the application. :func:`~gi.repository.Gst.Pipeline.new` is used to create a pipeline. when you are done with the pipeline, use :func:`~gi.repository.Gst.Object.unref` to free its resources including all added :obj:`~gi.repository.Gst.Element` objects (if not otherwise referenced). Elements are added and removed from the pipeline using the :obj:`~gi.repository.Gst.Bin` methods like :func:`~gi.repository.Gst.Bin.add` and :func:`~gi.repository.Gst.Bin.remove` (see :obj:`~gi.repository.Gst.Bin`\). Before changing the state of the :obj:`~gi.repository.Gst.Pipeline` (see :obj:`~gi.repository.Gst.Element`\) a :obj:`~gi.repository.Gst.Bus` should be retrieved with :func:`~gi.repository.Gst.Pipeline.get_bus`. This :obj:`~gi.repository.Gst.Bus` should then be used to receive :obj:`~gi.repository.Gst.Message` from the elements in the pipeline. Listening to the :obj:`~gi.repository.Gst.Bus` is necessary for retrieving error messages from the :obj:`~gi.repository.Gst.Pipeline` and otherwise the :obj:`~gi.repository.Gst.Pipeline` might stop without any indication, why. Furthermore, the :obj:`~gi.repository.Gst.Pipeline` posts messages even if nobody listens on the :obj:`~gi.repository.Gst.Bus`\, which will pile up and use up memory. By default, a :obj:`~gi.repository.Gst.Pipeline` will automatically flush the pending :obj:`~gi.repository.Gst.Bus` messages when going to the NULL state to ensure that no circular references exist when no messages are read from the :obj:`~gi.repository.Gst.Bus`\. This behaviour can be changed with :func:`~gi.repository.Gst.Pipeline.set_auto_flush_bus`. When the :obj:`~gi.repository.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_STATE_CHANGE_NO_PREROLL`` from the :func:`~gi.repository.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 :func:`~gi.repository.Gst.Pipeline.use_clock` method, which will enforce a given clock on the pipeline. With :func:`~gi.repository.Gst.Pipeline.auto_clock` the default clock selection algorithm can be restored. A :obj:`~gi.repository.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 :func:`~gi.repository.Gst.Element.set_start_time` method. Constructors ------------ .. rst-class:: interim-class .. class:: Pipeline :no-index: .. classmethod:: new(name: str | None = None) -> ~gi.repository.Gst.Element Create a new pipeline with the given name. :param name: name of new pipeline Methods ------- .. rst-class:: interim-class .. class:: Pipeline :no-index: .. method:: auto_clock() -> None Let ``pipeline`` select a clock automatically. This is the default behaviour. Use this function if you previous forced a fixed clock with :func:`~gi.repository.Gst.Pipeline.use_clock` and want to restore the default pipeline clock selection algorithm. MT safe. .. method:: get_auto_flush_bus() -> bool Check if ``pipeline`` will automatically flush messages when going to the NULL state. .. method:: get_bus() -> ~gi.repository.Gst.Bus Gets the :obj:`~gi.repository.Gst.Bus` of ``pipeline``\. The bus allows applications to receive :obj:`~gi.repository.Gst.Message` packets. .. method:: get_configured_latency() -> int Return the configured latency on ``pipeline``\. .. versionadded:: 1.24 .. method:: get_delay() -> int Get the configured delay (see :func:`~gi.repository.Gst.Pipeline.set_delay`). .. method:: get_latency() -> int Gets the latency that should be configured on the pipeline. See :func:`~gi.repository.Gst.Pipeline.set_latency`. .. versionadded:: 1.6 .. method:: get_pipeline_clock() -> ~gi.repository.Gst.Clock Gets the current clock used by ``pipeline``\. Unlike :func:`~gi.repository.Gst.Element.get_clock`, this function will always return a clock, even if the pipeline is not in the PLAYING state. .. versionadded:: 1.6 .. method:: is_live() -> bool Check if ``pipeline`` is live. .. versionadded:: 1.24 .. method:: set_auto_flush_bus(auto_flush: bool) -> None 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. :param auto_flush: whether or not to automatically flush the bus when the pipeline goes from READY to NULL state .. method:: set_delay(delay: int) -> None 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. :param delay: the delay .. method:: set_latency(latency: int) -> None 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. .. versionadded:: 1.6 :param latency: latency to configure .. method:: use_clock(clock: ~gi.repository.Gst.Clock | None = None) -> None 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 :const:`None` all clocking will be disabled which will make the pipeline run as fast as possible. MT safe. :param clock: the clock to use Properties ---------- .. rst-class:: interim-class .. class:: Pipeline :no-index: .. attribute:: props.auto_flush_bus :type: bool The type of the None singleton. .. attribute:: props.delay :type: int The expected delay needed for elements to spin up to the PLAYING state expressed in nanoseconds. see :func:`~gi.repository.Gst.Pipeline.set_delay` for more information on this option. .. attribute:: props.latency :type: int The type of the None singleton. .. versionadded:: 1.6 Fields ------ .. rst-class:: interim-class .. class:: Pipeline :no-index: .. attribute:: bin .. attribute:: delay Extra delay added to base_time to compensate for computing delays when setting elements to PLAYING. .. attribute:: fixed_clock The fixed clock of the pipeline, used when GST_PIPELINE_FLAG_FIXED_CLOCK is set. .. attribute:: priv .. attribute:: 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).