Debian Codegraph @

gstreamer/src/pipeline.hg

raw
1 /* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008-2016 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <gstreamermm/bin.h>
21 #include <gstreamermm/clock.h>
22
23 _DEFS(gstreamermm,gst)
24
25 namespace Gst
26 {
27 _WRAP_ENUM(GstPipelineFlags, PipelineFlags)
28
29 class Bus;
30
31 /** A top-level bin with clocking and bus management functionality.
32 * A Gst::Pipeline is a special Gst::Bin used as the toplevel container for
33 * the filter graph. The Gst::Pipeline will manage the selection and
34 * distribution of a global Gst::Clock as well as provide a Gst::Bus to the
35 * application. It will also implement a default behavour for managing seek
36 * events (see Gst::Element::seek()).
37 *
38 * create() is used to create a pipeline. when the pipeline is destroyed all
39 * its resources including all added Gst::Element objects are destroyed.
40 *
41 * Elements are added and removed from the pipeline using the Gst::Bin methods
42 * like Gst::Bin::add() and Gst::Bin::remove() (see Gst::Bin).
43 *
44 * Before changing the state of the Gst::Pipeline (see Gst::Element) a Gst::Bus
45 * can be retrieved with get_bus(). This bus can then be used to receive
46 * Gst::Message from the elements in the pipeline.
47 *
48 * By default, a Gst::Pipeline will automatically flush the pending Gst::Bus
49 * messages when going to the NULL state to ensure that no circular references
50 * exist when no messages are read from the Gst::Bus. This behaviour can be
51 * changed with set_auto_flush_bus().
52 *
53 * When the Gst::Pipeline performs the PAUSED to PLAYING state change it will
54 * select a clock for the elements. The clock selection algorithm will by
55 * default select a clock provided by an element that is most upstream (closest
56 * to the source). For live pipelines (ones that return
57 * Gst::STATE_CHANGE_NO_PREROLL from the Gst::Element::set_state() call) this
58 * will select the clock provided by the live source. For normal pipelines this
59 * will select a clock provided by the sinks (most likely the audio sink). If
60 * no element provides a clock, a default Gst::SystemClock is used.
61 *
62 * The clock selection can be controlled with the use_clock() method, which
63 * will enforce a given clock on the pipeline. With auto_clock() the default
64 * clock selection algorithm can be restored.
65 *
66 * A Gst::Pipeline maintains a stream time for the elements. The stream time is
67 * defined as the difference between the current clock time and the base time.
68 * When the pipeline goes to READY or a flushing seek is performed on it, the
69 * stream time is reset to 0. When the pipeline is set from PLAYING to PAUSED,
70 * the current clock time is sampled and used to configure the base time for
71 * the elements when the pipeline is set to PLAYING again.
72 *
73 * When sending a flushing seek event to a Gst::Pipeline (see
74 * Gst::Element::seek()), it will make sure that the pipeline is properly
75 * PAUSED and resumed as well as set the new stream time to 0 when the seek
76 * succeeded.
77 *
78 * Last reviewed on 2016-06-06 (1.8.0)
79 * @ingroup GstBaseClasses
80 */
81 class Pipeline : public Bin
82 {
83 _CLASS_GOBJECT(Pipeline, GstPipeline, GST_PIPELINE, Bin, GstBin)
84
85 protected:
86 _WRAP_CTOR(Pipeline(const Glib::ustring& name), gst_pipeline_new)
87 Pipeline();
88
89 public:
90 /** Create a new pipeline with the given name.
91 *
92 * @param name Name of new pipeline.
93 * @return Newly created Gst::Pipeline. MT safe.
94 */
95 _WRAP_CREATE(const Glib::ustring& name)
96
97 /** Create a new pipeline with a unique generic name.
98 * @return Newly created Gst::Pipeline. MT safe.
99 */
100 _WRAP_CREATE()
101
102 _WRAP_METHOD(Glib::RefPtr<Gst::Bus> get_bus(), gst_pipeline_get_bus)
103 _WRAP_METHOD(Glib::RefPtr<const Gst::Bus> get_bus() const, gst_pipeline_get_bus, constversion)
104 _WRAP_METHOD(bool set_clock(const Glib::RefPtr<Gst::Clock>& clock), gst_pipeline_set_clock)
105 _WRAP_METHOD(Glib::RefPtr<Gst::Clock> get_clock(), gst_pipeline_get_clock)
106 _WRAP_METHOD(Glib::RefPtr<const Gst::Clock> get_clock() const, gst_pipeline_get_clock, constversion)
107 _WRAP_METHOD(void use_clock(const Glib::RefPtr<Gst::Clock>& clock), gst_pipeline_use_clock)
108 _WRAP_METHOD(void auto_clock(), gst_pipeline_auto_clock)
109 _WRAP_METHOD(void set_auto_flush_bus(gboolean auto_flush = true), gst_pipeline_set_auto_flush_bus)
110 _WRAP_METHOD(bool get_auto_flush_bus() const, gst_pipeline_get_auto_flush_bus)
111 _WRAP_METHOD(void set_delay(ClockTime delay), gst_pipeline_set_delay)
112 _WRAP_METHOD(ClockTime get_delay() const, gst_pipeline_get_delay)
113 _WRAP_METHOD(Glib::RefPtr<Gst::Clock> get_pipeline_clock(), gst_pipeline_get_pipeline_clock)
114 _WRAP_METHOD(Glib::RefPtr<const Gst::Clock> get_pipeline_clock() const, gst_pipeline_get_pipeline_clock, constversion)
115 _WRAP_METHOD(void set_latency(Gst::ClockTime latency), gst_pipeline_set_latency)
116 _WRAP_METHOD(Gst::ClockTime get_latency() const, gst_pipeline_get_latency)
117
118 _WRAP_PROPERTY("latency", guint64)
119 _WRAP_PROPERTY("auto-flush-bus", bool)
120 _WRAP_PROPERTY("delay", ClockTime)
121 };
122
123 } //namespace Gst