| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_PIPELINE_H |
| 3 | #define _GSTREAMERMM_PIPELINE_H |
| 4 | |
| 5 | |
| 6 | #include <glibmm/ustring.h> |
| 7 | #include <sigc++/sigc++.h> |
| 8 | |
| 9 | /* gstreamermm - a C++ wrapper for gstreamer |
| 10 | * |
| 11 | * Copyright 2008-2016 The gstreamermm Development Team |
| 12 | * |
| 13 | * This library is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU Lesser General Public |
| 15 | * License as published by the Free Software Foundation; either |
| 16 | * version 2.1 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This library is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | * Lesser General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU Lesser General Public |
| 24 | * License along with this library; if not, write to the Free |
| 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 26 | */ |
| 27 | |
| 28 | #include <gstreamermm/bin.h> |
| 29 | #include <gstreamermm/clock.h> |
| 30 | |
| 31 | |
| 32 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 33 | using GstPipeline = struct _GstPipeline; |
| 34 | using GstPipelineClass = struct _GstPipelineClass; |
| 35 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 36 | |
| 37 | |
| 38 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 39 | namespace Gst |
| 40 | { class Pipeline_Class; } // namespace Gst |
| 41 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 42 | |
| 43 | namespace Gst |
| 44 | { |
| 45 | //gtkmmproc error: PipelineFlags : enum defs lookup failed. |
| 46 | |
| 47 | class Bus; |
| 48 | |
| 49 | /** A top-level bin with clocking and bus management functionality. |
| 50 | * A Gst::Pipeline is a special Gst::Bin used as the toplevel container for |
| 51 | * the filter graph. The Gst::Pipeline will manage the selection and |
| 52 | * distribution of a global Gst::Clock as well as provide a Gst::Bus to the |
| 53 | * application. It will also implement a default behavour for managing seek |
| 54 | * events (see Gst::Element::seek()). |
| 55 | * |
| 56 | * create() is used to create a pipeline. when the pipeline is destroyed all |
| 57 | * its resources including all added Gst::Element objects are destroyed. |
| 58 | * |
| 59 | * Elements are added and removed from the pipeline using the Gst::Bin methods |
| 60 | * like Gst::Bin::add() and Gst::Bin::remove() (see Gst::Bin). |
| 61 | * |
| 62 | * Before changing the state of the Gst::Pipeline (see Gst::Element) a Gst::Bus |
| 63 | * can be retrieved with get_bus(). This bus can then be used to receive |
| 64 | * Gst::Message from the elements in the pipeline. |
| 65 | * |
| 66 | * By default, a Gst::Pipeline will automatically flush the pending Gst::Bus |
| 67 | * messages when going to the NULL state to ensure that no circular references |
| 68 | * exist when no messages are read from the Gst::Bus. This behaviour can be |
| 69 | * changed with set_auto_flush_bus(). |
| 70 | * |
| 71 | * When the Gst::Pipeline performs the PAUSED to PLAYING state change it will |
| 72 | * select a clock for the elements. The clock selection algorithm will by |
| 73 | * default select a clock provided by an element that is most upstream (closest |
| 74 | * to the source). For live pipelines (ones that return |
| 75 | * Gst::STATE_CHANGE_NO_PREROLL from the Gst::Element::set_state() call) this |
| 76 | * will select the clock provided by the live source. For normal pipelines this |
| 77 | * will select a clock provided by the sinks (most likely the audio sink). If |
| 78 | * no element provides a clock, a default Gst::SystemClock is used. |
| 79 | * |
| 80 | * The clock selection can be controlled with the use_clock() method, which |
| 81 | * will enforce a given clock on the pipeline. With auto_clock() the default |
| 82 | * clock selection algorithm can be restored. |
| 83 | * |
| 84 | * A Gst::Pipeline maintains a stream time for the elements. The stream time is |
| 85 | * defined as the difference between the current clock time and the base time. |
| 86 | * When the pipeline goes to READY or a flushing seek is performed on it, the |
| 87 | * stream time is reset to 0. When the pipeline is set from PLAYING to PAUSED, |
| 88 | * the current clock time is sampled and used to configure the base time for |
| 89 | * the elements when the pipeline is set to PLAYING again. |
| 90 | * |
| 91 | * When sending a flushing seek event to a Gst::Pipeline (see |
| 92 | * Gst::Element::seek()), it will make sure that the pipeline is properly |
| 93 | * PAUSED and resumed as well as set the new stream time to 0 when the seek |
| 94 | * succeeded. |
| 95 | * |
| 96 | * Last reviewed on 2016-06-06 (1.8.0) |
| 97 | * @ingroup GstBaseClasses |
| 98 | */ |
| 99 | |
| 100 | class Pipeline : public Bin |
| 101 | { |
| 102 | |
| 103 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 104 | |
| 105 | public: |
| 106 | using CppObjectType = Pipeline; |
| 107 | using CppClassType = Pipeline_Class; |
| 108 | using BaseObjectType = GstPipeline; |
| 109 | using BaseClassType = GstPipelineClass; |
| 110 | |
| 111 | // noncopyable |
| 112 | Pipeline(const Pipeline&) = delete; |
| 113 | Pipeline& operator=(const Pipeline&) = delete; |
| 114 | |
| 115 | private: friend class Pipeline_Class; |
| 116 | static CppClassType pipeline_class_; |
| 117 | |
| 118 | protected: |
| 119 | explicit Pipeline(const Glib::ConstructParams& construct_params); |
| 120 | explicit Pipeline(GstPipeline* castitem); |
| 121 | |
| 122 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 123 | |
| 124 | public: |
| 125 | |
| 126 | Pipeline(Pipeline&& src) noexcept; |
| 127 | Pipeline& operator=(Pipeline&& src) noexcept; |
| 128 | |
| 129 | ~Pipeline() noexcept override; |
| 130 | |
| 131 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 132 | */ |
| 133 | static GType get_type() G_GNUC_CONST; |
| 134 | |
| 135 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 136 | |
| 137 | |
| 138 | static GType get_base_type() G_GNUC_CONST; |
| 139 | #endif |
| 140 | |
| 141 | ///Provides access to the underlying C GObject. |
| 142 | GstPipeline* gobj() { return reinterpret_cast<GstPipeline*>(gobject_); } |
| 143 | |
| 144 | ///Provides access to the underlying C GObject. |
| 145 | const GstPipeline* gobj() const { return reinterpret_cast<GstPipeline*>(gobject_); } |
| 146 | |
| 147 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 148 | GstPipeline* gobj_copy(); |
| 149 | |
| 150 | private: |
| 151 | |
| 152 | |
| 153 | protected: |
| 154 | explicit Pipeline(const Glib::ustring& name); |
| 155 | |
| 156 | Pipeline(); |
| 157 | |
| 158 | public: |
| 159 | /** Create a new pipeline with the given name. |
| 160 | * |
| 161 | * @param name Name of new pipeline. |
| 162 | * @return Newly created Gst::Pipeline. MT safe. |
| 163 | */ |
| 164 | |
| 165 | static Glib::RefPtr<Pipeline> create(const Glib::ustring& name); |
| 166 | |
| 167 | |
| 168 | /** Create a new pipeline with a unique generic name. |
| 169 | * @return Newly created Gst::Pipeline. MT safe. |
| 170 | */ |
| 171 | |
| 172 | static Glib::RefPtr<Pipeline> create(); |
| 173 | |
| 174 | |
| 175 | /** Gets the Gst::Bus of @a pipeline. The bus allows applications to receive |
| 176 | * Gst::Message packets. |
| 177 | * |
| 178 | * @return A Gst::Bus, unref after usage. |
| 179 | * |
| 180 | * MT safe. |
| 181 | */ |
| 182 | Glib::RefPtr<Gst::Bus> get_bus(); |
| 183 | |
| 184 | /** Gets the Gst::Bus of @a pipeline. The bus allows applications to receive |
| 185 | * Gst::Message packets. |
| 186 | * |
| 187 | * @return A Gst::Bus, unref after usage. |
| 188 | * |
| 189 | * MT safe. |
| 190 | */ |
| 191 | Glib::RefPtr<const Gst::Bus> get_bus() const; |
| 192 | |
| 193 | /** Set the clock for @a pipeline. The clock will be distributed |
| 194 | * to all the elements managed by the pipeline. |
| 195 | * |
| 196 | * @param clock The clock to set. |
| 197 | * @return <tt>true</tt> if the clock could be set on the pipeline. <tt>false</tt> if |
| 198 | * some element did not accept the clock. |
| 199 | * |
| 200 | * MT safe. |
| 201 | */ |
| 202 | bool set_clock(const Glib::RefPtr<Gst::Clock>& clock); |
| 203 | |
| 204 | /** Gets the current clock used by @a pipeline. Users of object |
| 205 | * oriented languages should use get_pipeline_clock() |
| 206 | * to avoid confusion with Gst::Element::get_clock() which has a different behavior. |
| 207 | * |
| 208 | * Unlike Gst::Element::get_clock(), this function will always return a |
| 209 | * clock, even if the pipeline is not in the PLAYING state. |
| 210 | * |
| 211 | * @return A Gst::Clock, unref after usage. |
| 212 | */ |
| 213 | Glib::RefPtr<Gst::Clock> get_clock(); |
| 214 | |
| 215 | /** Gets the current clock used by @a pipeline. Users of object |
| 216 | * oriented languages should use get_pipeline_clock() |
| 217 | * to avoid confusion with Gst::Element::get_clock() which has a different behavior. |
| 218 | * |
| 219 | * Unlike Gst::Element::get_clock(), this function will always return a |
| 220 | * clock, even if the pipeline is not in the PLAYING state. |
| 221 | * |
| 222 | * @return A Gst::Clock, unref after usage. |
| 223 | */ |
| 224 | Glib::RefPtr<const Gst::Clock> get_clock() const; |
| 225 | |
| 226 | /** Force @a pipeline to use the given @a clock. The pipeline will |
| 227 | * always use the given clock even if new clock providers are added |
| 228 | * to this pipeline. |
| 229 | * |
| 230 | * If @a clock is <tt>nullptr</tt> all clocking will be disabled which will make |
| 231 | * the pipeline run as fast as possible. |
| 232 | * |
| 233 | * MT safe. |
| 234 | * |
| 235 | * @param clock The clock to use. |
| 236 | */ |
| 237 | void use_clock(const Glib::RefPtr<Gst::Clock>& clock); |
| 238 | |
| 239 | /** Let @a pipeline select a clock automatically. This is the default |
| 240 | * behaviour. |
| 241 | * |
| 242 | * Use this function if you previous forced a fixed clock with |
| 243 | * use_clock() and want to restore the default |
| 244 | * pipeline clock selection algorithm. |
| 245 | * |
| 246 | * MT safe. |
| 247 | */ |
| 248 | void auto_clock(); |
| 249 | |
| 250 | /** Usually, when a pipeline goes from READY to <tt>nullptr</tt> state, it automatically |
| 251 | * flushes all pending messages on the bus, which is done for refcounting |
| 252 | * purposes, to break circular references. |
| 253 | * |
| 254 | * This means that applications that update state using (async) bus messages |
| 255 | * (e.g. do certain things when a pipeline goes from PAUSED to READY) might |
| 256 | * not get to see messages when the pipeline is shut down, because they might |
| 257 | * be flushed before they can be dispatched in the main thread. This behaviour |
| 258 | * can be disabled using this function. |
| 259 | * |
| 260 | * It is important that all messages on the bus are handled when the |
| 261 | * automatic flushing is disabled else memory leaks will be introduced. |
| 262 | * |
| 263 | * MT safe. |
| 264 | * |
| 265 | * @param auto_flush Whether or not to automatically flush the bus when |
| 266 | * the pipeline goes from READY to <tt>nullptr</tt> state. |
| 267 | */ |
| 268 | void set_auto_flush_bus(gboolean auto_flush = true); |
| 269 | |
| 270 | /** Check if @a pipeline will automatically flush messages when going to |
| 271 | * the <tt>nullptr</tt> state. |
| 272 | * |
| 273 | * @return Whether the pipeline will automatically flush its bus when |
| 274 | * going from READY to <tt>nullptr</tt> state or not. |
| 275 | * |
| 276 | * MT safe. |
| 277 | */ |
| 278 | bool get_auto_flush_bus() const; |
| 279 | |
| 280 | /** Set the expected delay needed for all elements to perform the |
| 281 | * PAUSED to PLAYING state change. @a delay will be added to the |
| 282 | * base time of the elements so that they wait an additional @a delay |
| 283 | * amount of time before starting to process buffers and cannot be |
| 284 | * Gst::CLOCK_TIME_NONE. |
| 285 | * |
| 286 | * This option is used for tuning purposes and should normally not be |
| 287 | * used. |
| 288 | * |
| 289 | * MT safe. |
| 290 | * |
| 291 | * @param delay The delay. |
| 292 | */ |
| 293 | void set_delay(ClockTime delay); |
| 294 | |
| 295 | /** Get the configured delay (see set_delay()). |
| 296 | * |
| 297 | * @return The configured delay. |
| 298 | * |
| 299 | * MT safe. |
| 300 | */ |
| 301 | ClockTime get_delay() const; |
| 302 | |
| 303 | /** Gets the current clock used by @a pipeline. |
| 304 | * |
| 305 | * Unlike Gst::Element::get_clock(), this function will always return a |
| 306 | * clock, even if the pipeline is not in the PLAYING state. |
| 307 | * |
| 308 | * @return A Gst::Clock, unref after usage. |
| 309 | */ |
| 310 | Glib::RefPtr<Gst::Clock> get_pipeline_clock(); |
| 311 | |
| 312 | /** Gets the current clock used by @a pipeline. |
| 313 | * |
| 314 | * Unlike Gst::Element::get_clock(), this function will always return a |
| 315 | * clock, even if the pipeline is not in the PLAYING state. |
| 316 | * |
| 317 | * @return A Gst::Clock, unref after usage. |
| 318 | */ |
| 319 | Glib::RefPtr<const Gst::Clock> get_pipeline_clock() const; |
| 320 | |
| 321 | /** Sets the latency that should be configured on the pipeline. Setting |
| 322 | * GST_CLOCK_TIME_NONE will restore the default behaviour of using the minimum |
| 323 | * latency from the LATENCY query. Setting this is usually not required and |
| 324 | * the pipeline will figure out an appropriate latency automatically. |
| 325 | * |
| 326 | * Setting a too low latency, especially lower than the minimum latency from |
| 327 | * the LATENCY query, will most likely cause the pipeline to fail. |
| 328 | * |
| 329 | * @param latency Latency to configure. |
| 330 | */ |
| 331 | void set_latency(Gst::ClockTime latency); |
| 332 | |
| 333 | /** Gets the latency that should be configured on the pipeline. See |
| 334 | * set_latency(). |
| 335 | * |
| 336 | * @return Latency to configure on the pipeline or GST_CLOCK_TIME_NONE. |
| 337 | */ |
| 338 | Gst::ClockTime get_latency() const; |
| 339 | |
| 340 | /** Latency to configure on the pipeline. |
| 341 | * |
| 342 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 343 | * or receive notification when the value of the property changes. |
| 344 | */ |
| 345 | Glib::PropertyProxy< guint64 > property_latency() ; |
| 346 | |
| 347 | /** Latency to configure on the pipeline. |
| 348 | * |
| 349 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 350 | * or receive notification when the value of the property changes. |
| 351 | */ |
| 352 | Glib::PropertyProxy_ReadOnly< guint64 > property_latency() const; |
| 353 | |
| 354 | /** Whether to automatically flush the pipeline's bus when going from READY into NULL state. |
| 355 | * |
| 356 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 357 | * or receive notification when the value of the property changes. |
| 358 | */ |
| 359 | Glib::PropertyProxy< bool > property_auto_flush_bus() ; |
| 360 | |
| 361 | /** Whether to automatically flush the pipeline's bus when going from READY into NULL state. |
| 362 | * |
| 363 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 364 | * or receive notification when the value of the property changes. |
| 365 | */ |
| 366 | Glib::PropertyProxy_ReadOnly< bool > property_auto_flush_bus() const; |
| 367 | |
| 368 | /** Expected delay needed for elements to spin up to PLAYING in nanoseconds. |
| 369 | * |
| 370 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 371 | * or receive notification when the value of the property changes. |
| 372 | */ |
| 373 | Glib::PropertyProxy< ClockTime > property_delay() ; |
| 374 | |
| 375 | /** Expected delay needed for elements to spin up to PLAYING in nanoseconds. |
| 376 | * |
| 377 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 378 | * or receive notification when the value of the property changes. |
| 379 | */ |
| 380 | Glib::PropertyProxy_ReadOnly< ClockTime > property_delay() const; |
| 381 | |
| 382 | |
| 383 | public: |
| 384 | |
| 385 | public: |
| 386 | //C++ methods used to invoke GTK+ virtual functions: |
| 387 | |
| 388 | protected: |
| 389 | //GTK+ Virtual Functions (override these to change behaviour): |
| 390 | |
| 391 | //Default Signal Handlers:: |
| 392 | |
| 393 | |
| 394 | }; |
| 395 | |
| 396 | } //namespace Gst |
| 397 | |
| 398 | |
| 399 | namespace Glib |
| 400 | { |
| 401 | /** A Glib::wrap() method for this object. |
| 402 | * |
| 403 | * @param object The C instance. |
| 404 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 405 | * @result A C++ instance that wraps this C instance. |
| 406 | * |
| 407 | * @relates Gst::Pipeline |
| 408 | */ |
| 409 | Glib::RefPtr<Gst::Pipeline> wrap(GstPipeline* object, bool take_copy = false); |
| 410 | } |
| 411 | |
| 412 | |
| 413 | #endif /* _GSTREAMERMM_PIPELINE_H */ |
| 414 |