| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_ELEMENT_H |
| 3 | #define _GSTREAMERMM_ELEMENT_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 <gst/gstelement.h> |
| 29 | #include <gstreamermm/object.h> |
| 30 | #include <gstreamermm/clock.h> |
| 31 | #include <gstreamermm/enums.h> |
| 32 | #include <gstreamermm/error.h> |
| 33 | #include <gstreamermm/message.h> |
| 34 | |
| 35 | |
| 36 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 37 | using GstElement = struct _GstElement; |
| 38 | using GstElementClass = struct _GstElementClass; |
| 39 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 40 | |
| 41 | |
| 42 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 43 | namespace Gst |
| 44 | { class Element_Class; } // namespace Gst |
| 45 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 46 | |
| 47 | namespace Gst |
| 48 | { |
| 49 | |
| 50 | /** @defgroup GstBaseClasses gstreamermm Base Classes |
| 51 | * Wrapped GStreamer base classes (plug-ins derrive from these). |
| 52 | */ |
| 53 | |
| 54 | /** @defgroup GstPlugins gstreamermm Plugins |
| 55 | * Wrapped GStreamer plugins. |
| 56 | */ |
| 57 | |
| 58 | /** @defgroup GstInterfaces gstreamermm Interfaces |
| 59 | * Wrapped GStreamer interfaces and classes related to them. |
| 60 | */ |
| 61 | |
| 62 | class Bus; |
| 63 | class Caps; |
| 64 | class Context; |
| 65 | class ElementFactory; |
| 66 | class Event; |
| 67 | class Pad; |
| 68 | class PadTemplate; |
| 69 | class Query; |
| 70 | |
| 71 | //Gst::Iterator<> forward declaration. |
| 72 | template <class CppType> |
| 73 | class Iterator; |
| 74 | |
| 75 | /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */ |
| 76 | |
| 77 | /** |
| 78 | * @var ElementFlags ELEMENT_FLAG_LOCKED_STATE |
| 79 | * Ignore state changes from parent. |
| 80 | * |
| 81 | * @var ElementFlags ELEMENT_FLAG_SINK |
| 82 | * The element is a sink. |
| 83 | * |
| 84 | * @var ElementFlags ELEMENT_FLAG_SOURCE |
| 85 | * The element is a source. |
| 86 | * |
| 87 | * @var ElementFlags ELEMENT_FLAG_PROVIDE_CLOCK |
| 88 | * The element can provide a clock. |
| 89 | * |
| 90 | * @var ElementFlags ELEMENT_FLAG_REQUIRE_CLOCK |
| 91 | * The element requires a clock. |
| 92 | * |
| 93 | * @var ElementFlags ELEMENT_FLAG_INDEXABLE |
| 94 | * The element can use an index. |
| 95 | * |
| 96 | * @var ElementFlags ELEMENT_FLAG_LAST |
| 97 | * Offset to define more flags. |
| 98 | * |
| 99 | * @enum ElementFlags |
| 100 | * |
| 101 | * The standard flags that an element may have. |
| 102 | * |
| 103 | * @ingroup gstreamermmEnums |
| 104 | * @par Bitwise operators: |
| 105 | * <tt>%ElementFlags operator|(ElementFlags, ElementFlags)</tt><br> |
| 106 | * <tt>%ElementFlags operator&(ElementFlags, ElementFlags)</tt><br> |
| 107 | * <tt>%ElementFlags operator^(ElementFlags, ElementFlags)</tt><br> |
| 108 | * <tt>%ElementFlags operator~(ElementFlags)</tt><br> |
| 109 | * <tt>%ElementFlags& operator|=(ElementFlags&, ElementFlags)</tt><br> |
| 110 | * <tt>%ElementFlags& operator&=(ElementFlags&, ElementFlags)</tt><br> |
| 111 | * <tt>%ElementFlags& operator^=(ElementFlags&, ElementFlags)</tt><br> |
| 112 | */ |
| 113 | enum ElementFlags |
| 114 | { |
| 115 | ELEMENT_FLAG_LOCKED_STATE = (GST_OBJECT_FLAG_LAST << 0), |
| 116 | ELEMENT_FLAG_SINK = (GST_OBJECT_FLAG_LAST << 1), |
| 117 | ELEMENT_FLAG_SOURCE = (GST_OBJECT_FLAG_LAST << 2), |
| 118 | ELEMENT_FLAG_PROVIDE_CLOCK = (GST_OBJECT_FLAG_LAST << 3), |
| 119 | ELEMENT_FLAG_REQUIRE_CLOCK = (GST_OBJECT_FLAG_LAST << 4), |
| 120 | ELEMENT_FLAG_INDEXABLE = (GST_OBJECT_FLAG_LAST << 5), |
| 121 | ELEMENT_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 10) |
| 122 | }; |
| 123 | |
| 124 | /** @ingroup gstreamermmEnums */ |
| 125 | inline ElementFlags operator|(ElementFlags lhs, ElementFlags rhs) |
| 126 | { return static_cast<ElementFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } |
| 127 | |
| 128 | /** @ingroup gstreamermmEnums */ |
| 129 | inline ElementFlags operator&(ElementFlags lhs, ElementFlags rhs) |
| 130 | { return static_cast<ElementFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } |
| 131 | |
| 132 | /** @ingroup gstreamermmEnums */ |
| 133 | inline ElementFlags operator^(ElementFlags lhs, ElementFlags rhs) |
| 134 | { return static_cast<ElementFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } |
| 135 | |
| 136 | /** @ingroup gstreamermmEnums */ |
| 137 | inline ElementFlags operator~(ElementFlags flags) |
| 138 | { return static_cast<ElementFlags>(~static_cast<unsigned>(flags)); } |
| 139 | |
| 140 | /** @ingroup gstreamermmEnums */ |
| 141 | inline ElementFlags& operator|=(ElementFlags& lhs, ElementFlags rhs) |
| 142 | { return (lhs = static_cast<ElementFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } |
| 143 | |
| 144 | /** @ingroup gstreamermmEnums */ |
| 145 | inline ElementFlags& operator&=(ElementFlags& lhs, ElementFlags rhs) |
| 146 | { return (lhs = static_cast<ElementFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } |
| 147 | |
| 148 | /** @ingroup gstreamermmEnums */ |
| 149 | inline ElementFlags& operator^=(ElementFlags& lhs, ElementFlags rhs) |
| 150 | { return (lhs = static_cast<ElementFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } |
| 151 | |
| 152 | } // namespace Gst |
| 153 | |
| 154 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 155 | namespace Glib |
| 156 | { |
| 157 | |
| 158 | template <> |
| 159 | class Value<Gst::ElementFlags> : public Glib::Value_Flags<Gst::ElementFlags> |
| 160 | { |
| 161 | public: |
| 162 | static GType value_type() G_GNUC_CONST; |
| 163 | }; |
| 164 | |
| 165 | } // namespace Glib |
| 166 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 167 | |
| 168 | namespace Gst |
| 169 | { |
| 170 | |
| 171 | /** |
| 172 | * @var StateChange STATE_CHANGE_NULL_TO_READY |
| 173 | * State change from <tt>nullptr</tt> to READY. |
| 174 | * - |
| 175 | * The element must check if the resources it needs are available. Device |
| 176 | * sinks and -sources typically try to probe the device to constrain their |
| 177 | * caps. |
| 178 | * - |
| 179 | * The element opens the device (in case feature need to be probed). |
| 180 | * . |
| 181 | * |
| 182 | * @var StateChange STATE_CHANGE_READY_TO_PAUSED |
| 183 | * State change from READY to PAUSED. |
| 184 | * - |
| 185 | * The element pads are activated in order to receive data in PAUSED. |
| 186 | * Streaming threads are started. |
| 187 | * - |
| 188 | * Some elements might need to return Gst::STATE_CHANGE_ASYNC and complete |
| 189 | * the state change when they have enough information. It is a requirement |
| 190 | * for sinks to return Gst::STATE_CHANGE_ASYNC and complete the state change |
| 191 | * when they receive the first buffer or Gst::EVENT_EOS (preroll). |
| 192 | * Sinks also block the dataflow when in PAUSED. |
| 193 | * - |
| 194 | * A pipeline resets the running_time to 0. |
| 195 | * - |
| 196 | * Live sources return Gst::STATE_CHANGE_NO_PREROLL and don't generate data. |
| 197 | * . |
| 198 | * |
| 199 | * @var StateChange STATE_CHANGE_PAUSED_TO_PLAYING |
| 200 | * State change from PAUSED to PLAYING. |
| 201 | * - |
| 202 | * Most elements ignore this state change. |
| 203 | * - |
| 204 | * The pipeline selects a Gst::Clock and distributes this to all the children |
| 205 | * before setting them to PLAYING. This means that it is only allowed to |
| 206 | * synchronize on the Gst::Clock in the PLAYING state. |
| 207 | * - |
| 208 | * The pipeline uses the Gst::Clock and the running_time to calculate the |
| 209 | * base_time. The base_time is distributed to all children when performing |
| 210 | * the state change. |
| 211 | * - |
| 212 | * Sink elements stop blocking on the preroll buffer or event and start |
| 213 | * rendering the data. |
| 214 | * - |
| 215 | * Sinks can post Gst::MESSAGE_EOS in the PLAYING state. It is not allowed |
| 216 | * to post Gst::MESSAGE_EOS when not in the PLAYING state. |
| 217 | * - |
| 218 | * While streaming in PAUSED or PLAYING elements can create and remove |
| 219 | * sometimes pads. |
| 220 | * - |
| 221 | * Live sources start generating data and return Gst::STATE_CHANGE_SUCCESS. |
| 222 | * . |
| 223 | * |
| 224 | * @var StateChange STATE_CHANGE_PLAYING_TO_PAUSED |
| 225 | * State change from PLAYING to PAUSED. |
| 226 | * - |
| 227 | * Most elements ignore this state change. |
| 228 | * - |
| 229 | * The pipeline calculates the running_time based on the last selected |
| 230 | * Gst::Clock and the base_time. It stores this information to continue |
| 231 | * playback when going back to the PLAYING state. |
| 232 | * - |
| 233 | * Sinks unblock any Gst::Clock wait calls. |
| 234 | * - |
| 235 | * When a sink does not have a pending buffer to play, it returns |
| 236 | * Gst::STATE_CHANGE_ASYNC from this state change and completes the state |
| 237 | * change when it receives a new buffer or an Gst::EVENT_EOS. |
| 238 | * - |
| 239 | * Any queued Gst::MESSAGE_EOS items are removed since they will be reposted |
| 240 | * when going back to the PLAYING state. The EOS messages are queued in |
| 241 | * Gst::Bin containers. |
| 242 | * - |
| 243 | * Live sources stop generating data and return Gst::STATE_CHANGE_NO_PREROLL. |
| 244 | * . |
| 245 | * |
| 246 | * @var StateChange STATE_CHANGE_PAUSED_TO_READY |
| 247 | * State change from PAUSED to READY. |
| 248 | * - |
| 249 | * Sinks unblock any waits in the preroll. |
| 250 | * - |
| 251 | * Elements unblock any waits on devices |
| 252 | * - |
| 253 | * Chain or get_range functions return Gst::FLOW_FLUSHING. |
| 254 | * - |
| 255 | * The element pads are deactivated so that streaming becomes impossible and |
| 256 | * all streaming threads are stopped. |
| 257 | * - |
| 258 | * The sink forgets all negotiated formats |
| 259 | * - |
| 260 | * Elements remove all sometimes pads |
| 261 | * . |
| 262 | * |
| 263 | * @var StateChange STATE_CHANGE_READY_TO_NULL |
| 264 | * State change from READY to <tt>nullptr</tt>. |
| 265 | * - |
| 266 | * Elements close devices |
| 267 | * - |
| 268 | * Elements reset any internal state. |
| 269 | * . |
| 270 | * |
| 271 | * @enum StateChange |
| 272 | * |
| 273 | * These are the different state changes an element goes through. |
| 274 | * Gst::STATE_NULL ⇒ Gst::STATE_PLAYING is called an upwards state change |
| 275 | * and Gst::STATE_PLAYING ⇒ Gst::STATE_NULL a downwards state change. |
| 276 | * |
| 277 | * @ingroup gstreamermmEnums |
| 278 | * @par Bitwise operators: |
| 279 | * <tt>%StateChange operator|(StateChange, StateChange)</tt><br> |
| 280 | * <tt>%StateChange operator&(StateChange, StateChange)</tt><br> |
| 281 | * <tt>%StateChange operator^(StateChange, StateChange)</tt><br> |
| 282 | * <tt>%StateChange operator~(StateChange)</tt><br> |
| 283 | * <tt>%StateChange& operator|=(StateChange&, StateChange)</tt><br> |
| 284 | * <tt>%StateChange& operator&=(StateChange&, StateChange)</tt><br> |
| 285 | * <tt>%StateChange& operator^=(StateChange&, StateChange)</tt><br> |
| 286 | */ |
| 287 | enum StateChange |
| 288 | { |
| 289 | STATE_CHANGE_NULL_TO_READY = 0xA, |
| 290 | STATE_CHANGE_READY_TO_PAUSED = 0x13, |
| 291 | STATE_CHANGE_PAUSED_TO_PLAYING = 0x1C, |
| 292 | STATE_CHANGE_PLAYING_TO_PAUSED = 0x23, |
| 293 | STATE_CHANGE_PAUSED_TO_READY = 0x1A, |
| 294 | STATE_CHANGE_READY_TO_NULL = 0x11 |
| 295 | }; |
| 296 | |
| 297 | /** @ingroup gstreamermmEnums */ |
| 298 | inline StateChange operator|(StateChange lhs, StateChange rhs) |
| 299 | { return static_cast<StateChange>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } |
| 300 | |
| 301 | /** @ingroup gstreamermmEnums */ |
| 302 | inline StateChange operator&(StateChange lhs, StateChange rhs) |
| 303 | { return static_cast<StateChange>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } |
| 304 | |
| 305 | /** @ingroup gstreamermmEnums */ |
| 306 | inline StateChange operator^(StateChange lhs, StateChange rhs) |
| 307 | { return static_cast<StateChange>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } |
| 308 | |
| 309 | /** @ingroup gstreamermmEnums */ |
| 310 | inline StateChange operator~(StateChange flags) |
| 311 | { return static_cast<StateChange>(~static_cast<unsigned>(flags)); } |
| 312 | |
| 313 | /** @ingroup gstreamermmEnums */ |
| 314 | inline StateChange& operator|=(StateChange& lhs, StateChange rhs) |
| 315 | { return (lhs = static_cast<StateChange>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } |
| 316 | |
| 317 | /** @ingroup gstreamermmEnums */ |
| 318 | inline StateChange& operator&=(StateChange& lhs, StateChange rhs) |
| 319 | { return (lhs = static_cast<StateChange>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } |
| 320 | |
| 321 | /** @ingroup gstreamermmEnums */ |
| 322 | inline StateChange& operator^=(StateChange& lhs, StateChange rhs) |
| 323 | { return (lhs = static_cast<StateChange>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } |
| 324 | |
| 325 | } // namespace Gst |
| 326 | |
| 327 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 328 | namespace Glib |
| 329 | { |
| 330 | |
| 331 | template <> |
| 332 | class Value<Gst::StateChange> : public Glib::Value_Flags<Gst::StateChange> |
| 333 | { |
| 334 | public: |
| 335 | static GType value_type() G_GNUC_CONST; |
| 336 | }; |
| 337 | |
| 338 | } // namespace Glib |
| 339 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 340 | |
| 341 | namespace Gst |
| 342 | { |
| 343 | |
| 344 | /** |
| 345 | * @var StateChangeReturn STATE_CHANGE_FAILURE |
| 346 | * The state change failed. |
| 347 | * |
| 348 | * @var StateChangeReturn STATE_CHANGE_SUCCESS |
| 349 | * The state change succeeded. |
| 350 | * |
| 351 | * @var StateChangeReturn STATE_CHANGE_ASYNC |
| 352 | * The state change will happen asynchronously. |
| 353 | * |
| 354 | * @var StateChangeReturn STATE_CHANGE_NO_PREROLL |
| 355 | * The state change succeeded but the element |
| 356 | * cannot produce data in Gst::STATE_PAUSED. |
| 357 | * This typically happens with live sources. |
| 358 | * |
| 359 | * @enum StateChangeReturn |
| 360 | * |
| 361 | * The possible return values from a state change function such as |
| 362 | * Gst::Element::set_state(). Only @a GST_STATE_CHANGE_FAILURE is a real failure. |
| 363 | * |
| 364 | * @ingroup gstreamermmEnums |
| 365 | */ |
| 366 | enum StateChangeReturn |
| 367 | { |
| 368 | STATE_CHANGE_FAILURE, |
| 369 | STATE_CHANGE_SUCCESS, |
| 370 | STATE_CHANGE_ASYNC, |
| 371 | STATE_CHANGE_NO_PREROLL |
| 372 | }; |
| 373 | |
| 374 | } // namespace Gst |
| 375 | |
| 376 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 377 | namespace Glib |
| 378 | { |
| 379 | |
| 380 | template <> |
| 381 | class Value<Gst::StateChangeReturn> : public Glib::Value_Enum<Gst::StateChangeReturn> |
| 382 | { |
| 383 | public: |
| 384 | static GType value_type() G_GNUC_CONST; |
| 385 | }; |
| 386 | |
| 387 | } // namespace Glib |
| 388 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 389 | |
| 390 | namespace Gst |
| 391 | { |
| 392 | |
| 393 | |
| 394 | namespace Enums |
| 395 | { |
| 396 | |
| 397 | /** Gets a string representing the given state. |
| 398 | * |
| 399 | * @param state A Gst::State to get the name of. |
| 400 | * @return A Glib::ustring with the name of the state. |
| 401 | */ |
| 402 | Glib::ustring get_name(State state); |
| 403 | |
| 404 | /** Gets a string representing the given state change result. |
| 405 | * |
| 406 | * @param state_ret A Gst::StateChangeReturn to get the name of. |
| 407 | * @return A Glib::ustring with the name of the state change result. |
| 408 | */ |
| 409 | Glib::ustring get_name(StateChangeReturn state_ret); |
| 410 | |
| 411 | } //namespace Enums |
| 412 | |
| 413 | /** Abstract base class for all pipeline elements |
| 414 | * |
| 415 | * Gst::Element is the abstract base class needed to construct an element that |
| 416 | * can be used in a GStreamer pipeline. Please refer to the plugin writers |
| 417 | * guide for more information on creating Gst::Element subclasses. |
| 418 | * |
| 419 | * The name of a Gst::Element can be get with get_name() and set with |
| 420 | * set_name(). |
| 421 | * |
| 422 | * Elements can have pads (of the type Gst::Pad). These pads link to pads on |
| 423 | * other elements. Gst::Buffer flow between these linked pads. |
| 424 | * A Gst::Element has a GList of Gst::Pad structures for all their input (or sink) |
| 425 | * and output (or source) pads. |
| 426 | * Core and plug-in writers can add and remove pads with add_pad() |
| 427 | * and remove_pad(). |
| 428 | * |
| 429 | * An existing pad of an element can be retrieved by name with |
| 430 | * get_static_pad(). A new dynamic pad can be created using |
| 431 | * request_pad() with a Gst::PadTemplate. |
| 432 | * An iterator of all pads can be retrieved with iterate_pads(). |
| 433 | * |
| 434 | * Elements can be linked through their pads. |
| 435 | * If the link is straightforward, use the link() |
| 436 | * convenience function to link two elements. |
| 437 | * Use link_filtered() to link two elements constrained by |
| 438 | * a specified set of Gst::Caps. |
| 439 | * For finer control, use link_pads() and |
| 440 | * link_pads_filtered() to specify the pads to link on |
| 441 | * each element by name. |
| 442 | * |
| 443 | * Each element has a state (see Gst::State). You can get and set the state |
| 444 | * of an element with get_state() and set_state(). |
| 445 | * Setting a state triggers a Gst::StateChange. To get a string representation |
| 446 | * of a Gst::State, use Gst::Enums::get_name(). |
| 447 | * |
| 448 | * You can get and set a Gst::Clock on an element using get_clock() |
| 449 | * and set_clock(). |
| 450 | * Some elements can provide a clock for the pipeline if |
| 451 | * the Gst::ELEMENT_FLAG_PROVIDE_CLOCK flag is set. With the |
| 452 | * provide_clock() method one can retrieve the clock provided by |
| 453 | * such an element. |
| 454 | * Not all elements require a clock to operate correctly. If the |
| 455 | * Gst::ELEMENT_FLAG_REQUIRE_CLOCK flag is set, a clock should be set on the |
| 456 | * element with set_clock(). |
| 457 | * |
| 458 | * Note that clock selection and distribution is normally handled by the |
| 459 | * toplevel Gst::Pipeline so the clock functions are only to be used in very |
| 460 | * specific situations. |
| 461 | * |
| 462 | * Last reviewed on 2016-05-18 (1.8.0). |
| 463 | * |
| 464 | * @ingroup GstBaseClasses |
| 465 | */ |
| 466 | |
| 467 | class Element : public Gst::Object |
| 468 | { |
| 469 | |
| 470 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 471 | |
| 472 | public: |
| 473 | using CppObjectType = Element; |
| 474 | using CppClassType = Element_Class; |
| 475 | using BaseObjectType = GstElement; |
| 476 | using BaseClassType = GstElementClass; |
| 477 | |
| 478 | // noncopyable |
| 479 | Element(const Element&) = delete; |
| 480 | Element& operator=(const Element&) = delete; |
| 481 | |
| 482 | private: friend class Element_Class; |
| 483 | static CppClassType element_class_; |
| 484 | |
| 485 | protected: |
| 486 | explicit Element(const Glib::ConstructParams& construct_params); |
| 487 | explicit Element(GstElement* castitem); |
| 488 | |
| 489 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 490 | |
| 491 | public: |
| 492 | |
| 493 | Element(Element&& src) noexcept; |
| 494 | Element& operator=(Element&& src) noexcept; |
| 495 | |
| 496 | ~Element() noexcept override; |
| 497 | |
| 498 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 499 | */ |
| 500 | static GType get_type() G_GNUC_CONST; |
| 501 | |
| 502 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 503 | |
| 504 | |
| 505 | static GType get_base_type() G_GNUC_CONST; |
| 506 | #endif |
| 507 | |
| 508 | ///Provides access to the underlying C GObject. |
| 509 | GstElement* gobj() { return reinterpret_cast<GstElement*>(gobject_); } |
| 510 | |
| 511 | ///Provides access to the underlying C GObject. |
| 512 | const GstElement* gobj() const { return reinterpret_cast<GstElement*>(gobject_); } |
| 513 | |
| 514 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 515 | GstElement* gobj_copy(); |
| 516 | |
| 517 | private: |
| 518 | |
| 519 | |
| 520 | public: |
| 521 | /** Links this source element to the @a dest element. |
| 522 | * The link must be from source to destination - the other direction will not |
| 523 | * be tried. The function looks for existing pads that aren't linked yet. It |
| 524 | * will request new pads if necessary. Such pads need to be released manually |
| 525 | * when unlinking. If multiple links are possible, only one is established. |
| 526 | * |
| 527 | * Make sure you have added your elements to a bin or pipeline with |
| 528 | * Gst::Bin::add() before trying to link them. |
| 529 | * |
| 530 | * @param dest the Gst::Element containing the destination pad. |
| 531 | * @return the destination element for further linking if desired. |
| 532 | * @throws std::runtime_error If the elements could not be linked. |
| 533 | */ |
| 534 | Glib::RefPtr<Gst::Element> link(const Glib::RefPtr<Gst::Element>& dest); |
| 535 | |
| 536 | |
| 537 | /** Adds a pad (link point) to @a element. @a pad's parent will be set to @a element; |
| 538 | * see Gst::Object::set_parent() for refcounting information. |
| 539 | * |
| 540 | * Pads are not automatically activated so elements should perform the needed |
| 541 | * steps to activate the pad in case this pad is added in the PAUSED or PLAYING |
| 542 | * state. See Gst::Pad::set_active() for more information about activating pads. |
| 543 | * |
| 544 | * The pad and the element should be unlocked when calling this function. |
| 545 | * |
| 546 | * This function will emit the Gst::Element::signal_pad_added() signal on the element. |
| 547 | * |
| 548 | * @param pad The Gst::Pad to add to the element. |
| 549 | * @return <tt>true</tt> if the pad could be added. This function can fail when |
| 550 | * a pad with the same name already existed or the pad already had another |
| 551 | * parent. |
| 552 | * |
| 553 | * MT safe. |
| 554 | */ |
| 555 | bool add_pad(const Glib::RefPtr<Gst::Pad>& pad); |
| 556 | |
| 557 | /** Creates a pad for each pad template that is always available. |
| 558 | * This function is only useful during object initialization of |
| 559 | * subclasses of Gst::Element. |
| 560 | */ |
| 561 | void create_all_pads(); |
| 562 | |
| 563 | |
| 564 | /** Looks for an unlinked pad to which the given pad can link. It is not |
| 565 | * guaranteed that linking the pads will work, though it should work in most |
| 566 | * cases. |
| 567 | * |
| 568 | * This function will first attempt to find a compatible unlinked ALWAYS pad, |
| 569 | * and if none can be found, it will request a compatible REQUEST pad by looking |
| 570 | * at the templates of @a element. |
| 571 | * |
| 572 | * @param pad The Gst::Pad to find a compatible one for. |
| 573 | * @param caps The Gst::Caps to use as a filter. |
| 574 | * @return The Gst::Pad to which a link |
| 575 | * can be made, or <tt>nullptr</tt> if one cannot be found. Gst::Object::unref() |
| 576 | * after usage. |
| 577 | */ |
| 578 | Glib::RefPtr<Gst::Pad> create_compatible_pad(const Glib::RefPtr<const Gst::Pad>& pad, const Glib::RefPtr<const Gst::Caps>& caps); |
| 579 | |
| 580 | /** Retrieves a pad template from @a element that is compatible with @a compattempl. |
| 581 | * Pads from compatible templates can be linked together. |
| 582 | * |
| 583 | * @param compattempl The Gst::PadTemplate to find a compatible |
| 584 | * template for. |
| 585 | * @return A compatible Gst::PadTemplate, |
| 586 | * or <tt>nullptr</tt> if none was found. No unreferencing is necessary. |
| 587 | */ |
| 588 | Glib::RefPtr<Gst::PadTemplate> get_compatible_pad_template(const Glib::RefPtr<const Gst::PadTemplate>& compattempl); |
| 589 | |
| 590 | /** Retrieves a pad template from @a element that is compatible with @a compattempl. |
| 591 | * Pads from compatible templates can be linked together. |
| 592 | * |
| 593 | * @param compattempl The Gst::PadTemplate to find a compatible |
| 594 | * template for. |
| 595 | * @return A compatible Gst::PadTemplate, |
| 596 | * or <tt>nullptr</tt> if none was found. No unreferencing is necessary. |
| 597 | */ |
| 598 | Glib::RefPtr<const Gst::PadTemplate> get_compatible_pad_template(const Glib::RefPtr<const Gst::PadTemplate>& compattempl) const; |
| 599 | |
| 600 | //TODO: The documentation says "The pad should be released with gst_element_release_request_pad().", which is odd. murrayc |
| 601 | |
| 602 | /** Retrieves a pad from the element by name (e.g.\ "src_\\%d"). This version only |
| 603 | * retrieves request pads. The pad should be released with |
| 604 | * release_request_pad(). |
| 605 | * |
| 606 | * This method is slower than manually getting the pad template and calling |
| 607 | * request_pad() if the pads should have a specific name (e.g. |
| 608 | * @a name is "src_1" instead of "src_\\%u"). |
| 609 | * |
| 610 | * @param name The name of the request Gst::Pad to retrieve. |
| 611 | * @return Requested Gst::Pad if found, |
| 612 | * otherwise <tt>nullptr</tt>. Release after usage. |
| 613 | */ |
| 614 | Glib::RefPtr<Gst::Pad> get_request_pad(const Glib::ustring& name); |
| 615 | |
| 616 | //TODO: The documentation says "The pad should be released with gst_element_release_request_pad().", which is odd. murrayc |
| 617 | |
| 618 | /** Retrieves a request pad from the element according to the provided template. |
| 619 | * Pad templates can be looked up using |
| 620 | * Gst::ElementFactory::get_static_pad_templates(). |
| 621 | * |
| 622 | * The pad should be released with release_request_pad(). |
| 623 | * |
| 624 | * @param templ A Gst::PadTemplate of which we want a pad of. |
| 625 | * @param name The name of the request Gst::Pad |
| 626 | * to retrieve. Can be <tt>nullptr</tt>. |
| 627 | * @param caps The caps of the pad we want to |
| 628 | * request. Can be <tt>nullptr</tt>. |
| 629 | * @return Requested Gst::Pad if found, |
| 630 | * otherwise <tt>nullptr</tt>. Release after usage. |
| 631 | */ |
| 632 | Glib::RefPtr<Gst::Pad> request_pad(const Glib::RefPtr<Gst::PadTemplate>& templ, const Glib::ustring& name, const Glib::RefPtr<const Gst::Caps>& caps); |
| 633 | |
| 634 | /// A request_pad() convenience overload. |
| 635 | Glib::RefPtr<Gst::Pad> request_pad(const Glib::RefPtr<Gst::PadTemplate>& templ, const Glib::ustring& name); |
| 636 | |
| 637 | /// A request_pad() convenience overload. |
| 638 | Glib::RefPtr<Gst::Pad> request_pad(const Glib::RefPtr<Gst::PadTemplate>& templ, const Glib::RefPtr<const Gst::Caps>& caps); |
| 639 | |
| 640 | /// A request_pad() convenience overload. |
| 641 | Glib::RefPtr<Gst::Pad> request_pad(const Glib::RefPtr<Gst::PadTemplate>& templ); |
| 642 | |
| 643 | |
| 644 | /** Retrieves a pad from @a element by name. This version only retrieves |
| 645 | * already-existing (i.e. 'static') pads. |
| 646 | * |
| 647 | * @param name The name of the static Gst::Pad to retrieve. |
| 648 | * @return The requested Gst::Pad if |
| 649 | * found, otherwise <tt>nullptr</tt>. unref after usage. |
| 650 | * |
| 651 | * MT safe. |
| 652 | */ |
| 653 | Glib::RefPtr<Gst::Pad> get_static_pad(const Glib::ustring& name); |
| 654 | |
| 655 | /** Retrieves a pad from @a element by name. This version only retrieves |
| 656 | * already-existing (i.e. 'static') pads. |
| 657 | * |
| 658 | * @param name The name of the static Gst::Pad to retrieve. |
| 659 | * @return The requested Gst::Pad if |
| 660 | * found, otherwise <tt>nullptr</tt>. unref after usage. |
| 661 | * |
| 662 | * MT safe. |
| 663 | */ |
| 664 | Glib::RefPtr<const Gst::Pad> get_static_pad(const Glib::ustring& name) const; |
| 665 | |
| 666 | |
| 667 | /** Use this function to signal that the element does not expect any more pads |
| 668 | * to show up in the current pipeline. This function should be called whenever |
| 669 | * pads have been added by the element itself. Elements with Gst::PAD_SOMETIMES |
| 670 | * pad templates use this in combination with autopluggers to figure out that |
| 671 | * the element is done initializing its pads. |
| 672 | * |
| 673 | * This function emits the Gst::Element::signal_no_more_pads() signal. |
| 674 | * |
| 675 | * MT safe. |
| 676 | */ |
| 677 | void no_more_pads(); |
| 678 | |
| 679 | |
| 680 | /** Makes the element free the previously requested pad as obtained with |
| 681 | * get_request_pad(). |
| 682 | * MT safe. |
| 683 | * @param pad The Gst::Pad to release. |
| 684 | */ |
| 685 | void release_request_pad(const Glib::RefPtr<Gst::Pad>& pad); |
| 686 | |
| 687 | |
| 688 | /** Removes @a pad from @a element. @a pad will be destroyed if it has not been |
| 689 | * referenced elsewhere using Gst::Object::unparent(). |
| 690 | * |
| 691 | * This function is used by plugin developers and should not be used |
| 692 | * by applications. Pads that were dynamically requested from elements |
| 693 | * with request_pad() should be released with the |
| 694 | * release_request_pad() function instead. |
| 695 | * |
| 696 | * Pads are not automatically deactivated so elements should perform the needed |
| 697 | * steps to deactivate the pad in case this pad is removed in the PAUSED or |
| 698 | * PLAYING state. See Gst::Pad::set_active() for more information about |
| 699 | * deactivating pads. |
| 700 | * |
| 701 | * The pad and the element should be unlocked when calling this function. |
| 702 | * |
| 703 | * This function will emit the Gst::Element::signal_pad_removed() signal on the element. |
| 704 | * |
| 705 | * @param pad The Gst::Pad to remove from the element. |
| 706 | * @return <tt>true</tt> if the pad could be removed. Can return <tt>false</tt> if the |
| 707 | * pad does not belong to the provided element. |
| 708 | * |
| 709 | * MT safe. |
| 710 | */ |
| 711 | bool remove_pad(const Glib::RefPtr<Gst::Pad>& pad); |
| 712 | |
| 713 | /** Retrieves an iterator of @a element's pads. The iterator should |
| 714 | * be freed after usage. Also more specialized iterators exists such as |
| 715 | * iterate_src_pads() or iterate_sink_pads(). |
| 716 | * |
| 717 | * The order of pads returned by the iterator will be the order in which |
| 718 | * the pads were added to the element. |
| 719 | * |
| 720 | * @return The Gst::Iterator of Gst::Pad. |
| 721 | * |
| 722 | * MT safe. |
| 723 | */ |
| 724 | Gst::Iterator<Gst::Pad> iterate_pads(); |
| 725 | |
| 726 | /** Retrieves an iterator of @a element's pads. The iterator should |
| 727 | * be freed after usage. Also more specialized iterators exists such as |
| 728 | * iterate_src_pads() or iterate_sink_pads(). |
| 729 | * |
| 730 | * The order of pads returned by the iterator will be the order in which |
| 731 | * the pads were added to the element. |
| 732 | * |
| 733 | * @return The Gst::Iterator of Gst::Pad. |
| 734 | * |
| 735 | * MT safe. |
| 736 | */ |
| 737 | Gst::Iterator<const Gst::Pad> iterate_pads() const; |
| 738 | |
| 739 | /** Retrieves an iterator of @a element's sink pads. |
| 740 | * |
| 741 | * The order of pads returned by the iterator will be the order in which |
| 742 | * the pads were added to the element. |
| 743 | * |
| 744 | * @return The Gst::Iterator of Gst::Pad. |
| 745 | * |
| 746 | * MT safe. |
| 747 | */ |
| 748 | Gst::Iterator<Gst::Pad> iterate_sink_pads(); |
| 749 | |
| 750 | /** Retrieves an iterator of @a element's sink pads. |
| 751 | * |
| 752 | * The order of pads returned by the iterator will be the order in which |
| 753 | * the pads were added to the element. |
| 754 | * |
| 755 | * @return The Gst::Iterator of Gst::Pad. |
| 756 | * |
| 757 | * MT safe. |
| 758 | */ |
| 759 | Gst::Iterator<const Gst::Pad> iterate_sink_pads() const; |
| 760 | |
| 761 | /** Retrieves an iterator of @a element's source pads. |
| 762 | * |
| 763 | * The order of pads returned by the iterator will be the order in which |
| 764 | * the pads were added to the element. |
| 765 | * |
| 766 | * @return The Gst::Iterator of Gst::Pad. |
| 767 | * |
| 768 | * MT safe. |
| 769 | */ |
| 770 | Gst::Iterator<Gst::Pad> iterate_src_pads(); |
| 771 | |
| 772 | /** Retrieves an iterator of @a element's source pads. |
| 773 | * |
| 774 | * The order of pads returned by the iterator will be the order in which |
| 775 | * the pads were added to the element. |
| 776 | * |
| 777 | * @return The Gst::Iterator of Gst::Pad. |
| 778 | * |
| 779 | * MT safe. |
| 780 | */ |
| 781 | Gst::Iterator<const Gst::Pad> iterate_src_pads() const; |
| 782 | |
| 783 | /** Unlinks all source pads of the source element with all sink pads |
| 784 | * of the sink element to which they are linked. |
| 785 | * |
| 786 | * If the link has been made using link(), it could have created an |
| 787 | * requestpad, which has to be released using release_request_pad(). |
| 788 | * |
| 789 | * @param dest The sink Gst::Element to unlink. |
| 790 | */ |
| 791 | void unlink(const Glib::RefPtr<Gst::Element>& dest); |
| 792 | |
| 793 | /** Sets the context of the element. Increases the refcount of the context. |
| 794 | * |
| 795 | * MT safe. |
| 796 | * |
| 797 | * @param context The Gst::Context to set. |
| 798 | */ |
| 799 | void set_context(const Glib::RefPtr<Gst::Context>& context); |
| 800 | |
| 801 | |
| 802 | //This is not like link() because link() was written to return the |
| 803 | //destination element as a convenience for further linking to compensate for |
| 804 | //C API's convenience function gst_element_link_many(). |
| 805 | |
| 806 | /** Links the two named pads of the source and destination elements. |
| 807 | * Side effect is that if one of the pads has no parent, it becomes a |
| 808 | * child of the parent of the other element. If they have different |
| 809 | * parents, the link fails. |
| 810 | * |
| 811 | * @param srcpadname The name of the Gst::Pad in source element |
| 812 | * or <tt>nullptr</tt> for any pad. |
| 813 | * @param dest The Gst::Element containing the destination pad. |
| 814 | * @param destpadname The name of the Gst::Pad in destination element, |
| 815 | * or <tt>nullptr</tt> for any pad. |
| 816 | * @return <tt>true</tt> if the pads could be linked, <tt>false</tt> otherwise. |
| 817 | */ |
| 818 | bool link_pads(const Glib::ustring& srcpadname, const Glib::RefPtr<Gst::Element>& dest, const Glib::ustring& destpadname); |
| 819 | |
| 820 | |
| 821 | /** Unlinks the two named pads of the source and destination elements. |
| 822 | * |
| 823 | * This is a convenience function for Gst::Pad::unlink(). |
| 824 | * |
| 825 | * @param srcpadname The name of the Gst::Pad in source element. |
| 826 | * @param dest A Gst::Element containing the destination pad. |
| 827 | * @param destpadname The name of the Gst::Pad in destination element. |
| 828 | */ |
| 829 | void unlink_pads(const Glib::ustring& srcpadname, const Glib::RefPtr<Gst::Element>& dest, const Glib::ustring& destpadname); |
| 830 | |
| 831 | //This is not like link() because link() was written to return the |
| 832 | //destination element as a convenience for further linking to compensate for |
| 833 | //C API's convenience function gst_element_link_many(). |
| 834 | |
| 835 | /** Links the two named pads of the source and destination elements. Side effect |
| 836 | * is that if one of the pads has no parent, it becomes a child of the parent of |
| 837 | * the other element. If they have different parents, the link fails. If @a caps |
| 838 | * is not <tt>nullptr</tt>, makes sure that the caps of the link is a subset of @a caps. |
| 839 | * |
| 840 | * @param srcpadname The name of the Gst::Pad in source element |
| 841 | * or <tt>nullptr</tt> for any pad. |
| 842 | * @param dest The Gst::Element containing the destination pad. |
| 843 | * @param destpadname The name of the Gst::Pad in destination element |
| 844 | * or <tt>nullptr</tt> for any pad. |
| 845 | * @param filter The Gst::Caps to filter the link, |
| 846 | * or <tt>nullptr</tt> for no filter. |
| 847 | * @return <tt>true</tt> if the pads could be linked, <tt>false</tt> otherwise. |
| 848 | */ |
| 849 | bool link_pads(const Glib::ustring& srcpadname, const Glib::RefPtr<Gst::Element>& dest, const Glib::ustring& destpadname, const Glib::RefPtr<Gst::Caps>& filter); |
| 850 | |
| 851 | //This is not like link() because link() was written to return the |
| 852 | //destination element as a convenience for further linking to compensate for |
| 853 | //C API's convenience function gst_element_link_many(). |
| 854 | |
| 855 | /** Links the two named pads of the source and destination elements. |
| 856 | * Side effect is that if one of the pads has no parent, it becomes a |
| 857 | * child of the parent of the other element. If they have different |
| 858 | * parents, the link fails. |
| 859 | * |
| 860 | * Calling link_pads_full() with @a flags == Gst::PAD_LINK_CHECK_DEFAULT |
| 861 | * is the same as calling link_pads() and the recommended way of |
| 862 | * linking pads with safety checks applied. |
| 863 | * |
| 864 | * This is a convenience function for Gst::Pad::link_full(). |
| 865 | * |
| 866 | * @param srcpadname The name of the Gst::Pad in source element |
| 867 | * or <tt>nullptr</tt> for any pad. |
| 868 | * @param dest The Gst::Element containing the destination pad. |
| 869 | * @param destpadname The name of the Gst::Pad in destination element, |
| 870 | * or <tt>nullptr</tt> for any pad. |
| 871 | * @param flags The Gst::PadLinkCheck to be performed when linking pads. |
| 872 | * @return <tt>true</tt> if the pads could be linked, <tt>false</tt> otherwise. |
| 873 | */ |
| 874 | bool link_pads(const Glib::ustring& srcpadname, const Glib::RefPtr<Gst::Element>& dest, const Glib::ustring& destpadname, PadLinkCheck flags); |
| 875 | |
| 876 | /** Links @a src to @a dest using the given caps as filtercaps. The link must |
| 877 | * be from source to destination; the other direction will not be tried. The |
| 878 | * function looks for existing pads that aren't linked yet. It will request |
| 879 | * new pads if necessary. If multiple links are possible, only one is |
| 880 | * established. |
| 881 | * |
| 882 | * Make sure you have added your elements to a bin or pipeline with |
| 883 | * Gst::Bin::add() before trying to link them. |
| 884 | * |
| 885 | * @param dest The Gst::Element containing the destination pad. |
| 886 | * @param filter The Gst::Caps to filter the link. |
| 887 | * @return the destination element for further linking if desired. |
| 888 | * @throws std::runtime_error If the elements could not be linked. |
| 889 | */ |
| 890 | Glib::RefPtr<Gst::Element> link(const Glib::RefPtr<Gst::Element>& dest, const Glib::RefPtr<Gst::Caps>& filter); |
| 891 | |
| 892 | |
| 893 | /** Set the base time of an element. See get_base_time(). |
| 894 | * |
| 895 | * MT safe. |
| 896 | * |
| 897 | * @param time The base time to set. |
| 898 | */ |
| 899 | void set_base_time(ClockTime time); |
| 900 | |
| 901 | /** Returns the base time of the element. The base time is the |
| 902 | * absolute time of the clock when this element was last put to |
| 903 | * PLAYING. Subtracting the base time from the clock time gives |
| 904 | * the running time of the element. |
| 905 | * |
| 906 | * @return The base time of the element. |
| 907 | * |
| 908 | * MT safe. |
| 909 | */ |
| 910 | ClockTime get_base_time() const; |
| 911 | |
| 912 | /** Set the start time of an element. The start time of the element is the |
| 913 | * running time of the element when it last went to the PAUSED state. In READY |
| 914 | * or after a flushing seek, it is set to 0. |
| 915 | * |
| 916 | * Toplevel elements like Gst::Pipeline will manage the start_time and |
| 917 | * base_time on its children. Setting the start_time to Gst::CLOCK_TIME_NONE |
| 918 | * on such a toplevel element will disable the distribution of the base_time to |
| 919 | * the children and can be useful if the application manages the base_time |
| 920 | * itself, for example if you want to synchronize capture from multiple |
| 921 | * pipelines, and you can also ensure that the pipelines have the same clock. |
| 922 | * |
| 923 | * MT safe. |
| 924 | * |
| 925 | * @param time The base time to set. |
| 926 | */ |
| 927 | void set_start_time(Gst::ClockTime time); |
| 928 | |
| 929 | /** Returns the start time of the element. The start time is the |
| 930 | * running time of the clock when this element was last put to PAUSED. |
| 931 | * |
| 932 | * Usually the start_time is managed by a toplevel element such as |
| 933 | * Gst::Pipeline. |
| 934 | * |
| 935 | * MT safe. |
| 936 | * |
| 937 | * @return The start time of the element. |
| 938 | */ |
| 939 | Gst::ClockTime get_start_time() const; |
| 940 | |
| 941 | /** Sets the bus of the element. Increases the refcount on the bus. |
| 942 | * For internal use only, unless you're testing elements. |
| 943 | * |
| 944 | * MT safe. |
| 945 | * |
| 946 | * @param bus The Gst::Bus to set. |
| 947 | */ |
| 948 | void set_bus(const Glib::RefPtr<Gst::Bus>& bus); |
| 949 | |
| 950 | /** Returns the bus of the element. Note that only a Gst::Pipeline will provide a |
| 951 | * bus for the application. |
| 952 | * |
| 953 | * @return The element's Gst::Bus. unref after usage. |
| 954 | * |
| 955 | * MT safe. |
| 956 | */ |
| 957 | Glib::RefPtr<Gst::Bus> get_bus(); |
| 958 | |
| 959 | /** Returns the bus of the element. Note that only a Gst::Pipeline will provide a |
| 960 | * bus for the application. |
| 961 | * |
| 962 | * @return The element's Gst::Bus. unref after usage. |
| 963 | * |
| 964 | * MT safe. |
| 965 | */ |
| 966 | Glib::RefPtr<const Gst::Bus> get_bus() const; |
| 967 | |
| 968 | |
| 969 | /** Retrieves the factory that was used to create this element. |
| 970 | * |
| 971 | * @return The Gst::ElementFactory used for creating this |
| 972 | * element. no refcounting is needed. |
| 973 | */ |
| 974 | Glib::RefPtr<Gst::ElementFactory> get_factory(); |
| 975 | |
| 976 | /** Retrieves the factory that was used to create this element. |
| 977 | * |
| 978 | * @return The Gst::ElementFactory used for creating this |
| 979 | * element. no refcounting is needed. |
| 980 | */ |
| 981 | Glib::RefPtr<const Gst::ElementFactory> get_factory() const; |
| 982 | |
| 983 | // We don't wrap the gst_element_get_name(), gst_element_set_name(), |
| 984 | // gst_element_get_parent(), and gst_element_set_parent() macros because they |
| 985 | // just calls the base (GstObject) class's functions anyway. |
| 986 | |
| 987 | |
| 988 | /** Sets the clock for the element. This function increases the |
| 989 | * refcount on the clock. Any previously set clock on the object |
| 990 | * is unreffed. |
| 991 | * |
| 992 | * @param clock The Gst::Clock to set for the element. |
| 993 | * @return <tt>true</tt> if the element accepted the clock. An element can refuse a |
| 994 | * clock when it, for example, is not able to slave its internal clock to the |
| 995 | * @a clock or when it requires a specific clock to operate. |
| 996 | * |
| 997 | * MT safe. |
| 998 | */ |
| 999 | bool set_clock(const Glib::RefPtr<Gst::Clock>& clock); |
| 1000 | |
| 1001 | /** Gets the currently configured clock of the element. This is the clock as was |
| 1002 | * last set with set_clock(). |
| 1003 | * |
| 1004 | * Elements in a pipeline will only have their clock set when the |
| 1005 | * pipeline is in the PLAYING state. |
| 1006 | * |
| 1007 | * @return The Gst::Clock of the element. unref after usage. |
| 1008 | * |
| 1009 | * MT safe. |
| 1010 | */ |
| 1011 | Glib::RefPtr<Gst::Clock> get_clock(); |
| 1012 | |
| 1013 | /** Gets the currently configured clock of the element. This is the clock as was |
| 1014 | * last set with set_clock(). |
| 1015 | * |
| 1016 | * Elements in a pipeline will only have their clock set when the |
| 1017 | * pipeline is in the PLAYING state. |
| 1018 | * |
| 1019 | * @return The Gst::Clock of the element. unref after usage. |
| 1020 | * |
| 1021 | * MT safe. |
| 1022 | */ |
| 1023 | Glib::RefPtr<const Gst::Clock> get_clock() const; |
| 1024 | |
| 1025 | /** Get the clock provided by the given element. |
| 1026 | * <note>An element is only required to provide a clock in the PAUSED |
| 1027 | * state. Some elements can provide a clock in other states.</note> |
| 1028 | * |
| 1029 | * @return The GstClock provided by the |
| 1030 | * element or <tt>nullptr</tt> if no clock could be provided. Unref after usage. |
| 1031 | * |
| 1032 | * MT safe. |
| 1033 | */ |
| 1034 | Glib::RefPtr<Gst::Clock> provide_clock(); |
| 1035 | |
| 1036 | /** Get the clock provided by the given element. |
| 1037 | * <note>An element is only required to provide a clock in the PAUSED |
| 1038 | * state. Some elements can provide a clock in other states.</note> |
| 1039 | * |
| 1040 | * @return The GstClock provided by the |
| 1041 | * element or <tt>nullptr</tt> if no clock could be provided. Unref after usage. |
| 1042 | * |
| 1043 | * MT safe. |
| 1044 | */ |
| 1045 | Glib::RefPtr<const Gst::Clock> provide_clock() const; |
| 1046 | |
| 1047 | /** Sets the state of the element. This function will try to set the |
| 1048 | * requested state by going through all the intermediary states and calling |
| 1049 | * the class's state change function for each. |
| 1050 | * |
| 1051 | * This function can return Gst::STATE_CHANGE_ASYNC, in which case the |
| 1052 | * element will perform the remainder of the state change asynchronously in |
| 1053 | * another thread. |
| 1054 | * An application can use get_state() to wait for the completion |
| 1055 | * of the state change or it can wait for a Gst::MESSAGE_ASYNC_DONE or |
| 1056 | * Gst::MESSAGE_STATE_CHANGED on the bus. |
| 1057 | * |
| 1058 | * State changes to Gst::STATE_READY or Gst::STATE_NULL never return |
| 1059 | * Gst::STATE_CHANGE_ASYNC. |
| 1060 | * |
| 1061 | * @param state The element's new Gst::State. |
| 1062 | * @return Result of the state change using Gst::StateChangeReturn. |
| 1063 | * |
| 1064 | * MT safe. |
| 1065 | */ |
| 1066 | StateChangeReturn set_state(State state); |
| 1067 | |
| 1068 | /** Gets the state of the element. |
| 1069 | * |
| 1070 | * For elements that performed an ASYNC state change, as reported by |
| 1071 | * set_state(), this function will block up to the |
| 1072 | * specified timeout value for the state change to complete. |
| 1073 | * If the element completes the state change or goes into |
| 1074 | * an error, this function returns immediately with a return value of |
| 1075 | * Gst::STATE_CHANGE_SUCCESS or Gst::STATE_CHANGE_FAILURE respectively. |
| 1076 | * |
| 1077 | * For elements that did not return Gst::STATE_CHANGE_ASYNC, this function |
| 1078 | * returns the current and pending state immediately. |
| 1079 | * |
| 1080 | * This function returns Gst::STATE_CHANGE_NO_PREROLL if the element |
| 1081 | * successfully changed its state but is not able to provide data yet. |
| 1082 | * This mostly happens for live sources that only produce data in |
| 1083 | * Gst::STATE_PLAYING. While the state change return is equivalent to |
| 1084 | * Gst::STATE_CHANGE_SUCCESS, it is returned to the application to signal that |
| 1085 | * some sink elements might not be able to complete their state change because |
| 1086 | * an element is not producing data to complete the preroll. When setting the |
| 1087 | * element to playing, the preroll will complete and playback will start. |
| 1088 | * |
| 1089 | * @param state A pointer to Gst::State to hold the state. |
| 1090 | * Can be <tt>nullptr</tt>. |
| 1091 | * @param pending A pointer to Gst::State to hold the pending |
| 1092 | * state. Can be <tt>nullptr</tt>. |
| 1093 | * @param timeout A Gst::ClockTime to specify the timeout for an async |
| 1094 | * state change or Gst::CLOCK_TIME_NONE for infinite timeout. |
| 1095 | * @return Gst::STATE_CHANGE_SUCCESS if the element has no more pending state |
| 1096 | * and the last state change succeeded, Gst::STATE_CHANGE_ASYNC if the |
| 1097 | * element is still performing a state change or |
| 1098 | * Gst::STATE_CHANGE_FAILURE if the last state change failed. |
| 1099 | * |
| 1100 | * MT safe. |
| 1101 | */ |
| 1102 | StateChangeReturn get_state(State& state, State& pending, ClockTime timeout) const; |
| 1103 | |
| 1104 | /** Locks the state of an element, so state changes of the parent don't affect |
| 1105 | * this element anymore. |
| 1106 | * |
| 1107 | * MT safe. |
| 1108 | * |
| 1109 | * @param locked_state <tt>true</tt> to lock the element's state. |
| 1110 | * @return <tt>true</tt> if the state was changed, <tt>false</tt> if bad parameters were given |
| 1111 | * or the elements state-locking needed no change. |
| 1112 | */ |
| 1113 | bool set_locked_state(gboolean locked_state); |
| 1114 | |
| 1115 | /** Checks if the state of an element is locked. |
| 1116 | * If the state of an element is locked, state changes of the parent don't |
| 1117 | * affect the element. |
| 1118 | * This way you can leave currently unused elements inside bins. Just lock their |
| 1119 | * state before changing the state from Gst::STATE_NULL. |
| 1120 | * |
| 1121 | * MT safe. |
| 1122 | * |
| 1123 | * @return <tt>true</tt>, if the element's state is locked. |
| 1124 | */ |
| 1125 | bool is_locked_state() const; |
| 1126 | |
| 1127 | /** Abort the state change of the element. This function is used |
| 1128 | * by elements that do asynchronous state changes and find out |
| 1129 | * something is wrong. |
| 1130 | * |
| 1131 | * This function should be called with the STATE_LOCK held. |
| 1132 | * |
| 1133 | * MT safe. |
| 1134 | */ |
| 1135 | void abort_state(); |
| 1136 | |
| 1137 | /** Commit the state change of the element and proceed to the next |
| 1138 | * pending state if any. This function is used |
| 1139 | * by elements that do asynchronous state changes. |
| 1140 | * The core will normally call this method automatically when an |
| 1141 | * element returned Gst::STATE_CHANGE_SUCCESS from the state change function. |
| 1142 | * |
| 1143 | * If after calling this method the element still has not reached |
| 1144 | * the pending state, the next state change is performed. |
| 1145 | * |
| 1146 | * This method is used internally and should normally not be called by plugins |
| 1147 | * or applications. |
| 1148 | * |
| 1149 | * @param ret The previous state return value. |
| 1150 | * @return The result of the commit state change. |
| 1151 | * |
| 1152 | * MT safe. |
| 1153 | */ |
| 1154 | StateChangeReturn continue_state(StateChangeReturn ret); |
| 1155 | |
| 1156 | /** Brings the element to the lost state. The current state of the |
| 1157 | * element is copied to the pending state so that any call to |
| 1158 | * get_state() will return Gst::STATE_CHANGE_ASYNC. |
| 1159 | * |
| 1160 | * An ASYNC_START message is posted. If the element was PLAYING, it will |
| 1161 | * go to PAUSED. The element will be restored to its PLAYING state by |
| 1162 | * the parent pipeline when it prerolls again. |
| 1163 | * |
| 1164 | * This is mostly used for elements that lost their preroll buffer |
| 1165 | * in the Gst::STATE_PAUSED or Gst::STATE_PLAYING state after a flush, |
| 1166 | * they will go to their pending state again when a new preroll buffer is |
| 1167 | * queued. This function can only be called when the element is currently |
| 1168 | * not in error or an async state change. |
| 1169 | * |
| 1170 | * This function is used internally and should normally not be called from |
| 1171 | * plugins or applications. |
| 1172 | */ |
| 1173 | void lost_state(); |
| 1174 | |
| 1175 | /** Tries to change the state of the element to the same as its parent. |
| 1176 | * If this function returns <tt>false</tt>, the state of element is undefined. |
| 1177 | * |
| 1178 | * @return <tt>true</tt>, if the element's state could be synced to the parent's state. |
| 1179 | * |
| 1180 | * MT safe. |
| 1181 | */ |
| 1182 | bool sync_state_with_parent(); |
| 1183 | |
| 1184 | /** Perform @a transition on @a element. |
| 1185 | * |
| 1186 | * This function must be called with STATE_LOCK held and is mainly used |
| 1187 | * internally. |
| 1188 | * |
| 1189 | * @param transition The requested transition. |
| 1190 | * @return The Gst::StateChangeReturn of the state transition. |
| 1191 | */ |
| 1192 | StateChangeReturn change_state(StateChange transition); |
| 1193 | |
| 1194 | /** Post an error, warning or info message on the bus from inside an element. |
| 1195 | * |
| 1196 | * type must be of Gst::MESSAGE_ERROR, Gst::MESSAGE_WARNING or |
| 1197 | * Gst::MESSAGE_INFO. |
| 1198 | * |
| 1199 | * MT safe. |
| 1200 | * |
| 1201 | * @param code The GError code belonging to the domain. |
| 1202 | * @param line The source code line where the error was generated. |
| 1203 | * @param type The GstMessageType. |
| 1204 | * @param domain The GStreamer GError domain this message belongs to. |
| 1205 | * @param text A text string to be used as a replacement for the default |
| 1206 | * message connected to code. |
| 1207 | * @param debug A debug message to be used as a replacement for the default |
| 1208 | * debugging information. |
| 1209 | * @param file The source code file where the error was generated. |
| 1210 | * @param function The source code function where the error was generated. |
| 1211 | */ |
| 1212 | void post_message(int code, int line, MessageType type = Gst::MESSAGE_INFO, |
| 1213 | const Glib::QueryQuark& domain = get_core_error_quark(), |
| 1214 | const Glib::ustring& text = Glib::ustring(), |
| 1215 | const Glib::ustring& debug = Glib::ustring(), |
| 1216 | const Glib::ustring& file = Glib::ustring(), |
| 1217 | const Glib::ustring& function = Glib::ustring()); |
| 1218 | |
| 1219 | |
| 1220 | /** Post a message on the element's Gst::Bus. This function takes ownership of the |
| 1221 | * message; if you want to access the message after this call, you should add an |
| 1222 | * additional reference before calling. |
| 1223 | * |
| 1224 | * @param message A Gst::Message to post. |
| 1225 | * @return <tt>true</tt> if the message was successfully posted. The function returns |
| 1226 | * <tt>false</tt> if the element did not have a bus. |
| 1227 | * |
| 1228 | * MT safe. |
| 1229 | */ |
| 1230 | bool post_message(Glib::RefPtr<Gst::Message>&& message); |
| 1231 | |
| 1232 | |
| 1233 | /** Performs a query on the given element. |
| 1234 | * |
| 1235 | * For elements that don't implement a query handler, this function |
| 1236 | * forwards the query to a random srcpad or to the peer of a |
| 1237 | * random linked sinkpad of this element. |
| 1238 | * |
| 1239 | * Please note that some queries might need a running pipeline to work. |
| 1240 | * |
| 1241 | * @param query The Gst::Query. |
| 1242 | * @return <tt>true</tt> if the query could be performed. |
| 1243 | * |
| 1244 | * MT safe. |
| 1245 | */ |
| 1246 | bool query(const Glib::RefPtr<Gst::Query>& query) const; |
| 1247 | |
| 1248 | /** Queries an element to convert @a src_val in @a src_format to @a dest_format. |
| 1249 | * |
| 1250 | * @param src_format A Gst::Format to convert from. |
| 1251 | * @param src_val A value to convert. |
| 1252 | * @param dest_format The Gst::Format to convert to. |
| 1253 | * @param dest_val A pointer to the result. |
| 1254 | * @return <tt>true</tt> if the query could be performed. |
| 1255 | */ |
| 1256 | bool query_convert(Gst::Format src_format, gint64 src_val, Format dest_format, gint64& dest_val) const; |
| 1257 | |
| 1258 | /** Queries an element (usually top-level pipeline or playbin element) for the |
| 1259 | * stream position in nanoseconds. This will be a value between 0 and the |
| 1260 | * stream duration (if the stream duration is known). This query will usually |
| 1261 | * only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING |
| 1262 | * state). The application will receive an ASYNC_DONE message on the pipeline |
| 1263 | * bus when that is the case. |
| 1264 | * |
| 1265 | * If one repeatedly calls this function one can also create a query and reuse |
| 1266 | * it in query(). |
| 1267 | * |
| 1268 | * @param format The Gst::Format requested. |
| 1269 | * @param cur A location in which to store the current |
| 1270 | * position, or <tt>nullptr</tt>. |
| 1271 | * @return <tt>true</tt> if the query could be performed. |
| 1272 | */ |
| 1273 | bool query_position(Gst::Format format, gint64& cur) const; |
| 1274 | |
| 1275 | /// A query_position() convenience overload. |
| 1276 | bool query_position(Gst::Format format) const; |
| 1277 | |
| 1278 | /** Queries an element (usually top-level pipeline or playbin element) for the |
| 1279 | * total stream duration in nanoseconds. This query will only work once the |
| 1280 | * pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application |
| 1281 | * will receive an ASYNC_DONE message on the pipeline bus when that is the case. |
| 1282 | * |
| 1283 | * If the duration changes for some reason, you will get a DURATION_CHANGED |
| 1284 | * message on the pipeline bus, in which case you should re-query the duration |
| 1285 | * using this function. |
| 1286 | * |
| 1287 | * @param format The Gst::Format requested. |
| 1288 | * @param duration A location in which to store the total duration, or <tt>nullptr</tt>. |
| 1289 | * @return <tt>true</tt> if the query could be performed. |
| 1290 | */ |
| 1291 | bool query_duration(Gst::Format format, gint64& duration) const; |
| 1292 | |
| 1293 | /// A query_duration() convenience overload. |
| 1294 | bool query_duration(Gst::Format format) const; |
| 1295 | |
| 1296 | |
| 1297 | /** Simple API to perform a seek on the given element, meaning it just seeks |
| 1298 | * to the given position relative to the start of the stream. For more complex |
| 1299 | * operations like segment seeks (e.g. for looping) or changing the playback |
| 1300 | * rate or seeking relative to the last configured playback segment you should |
| 1301 | * use seek(). |
| 1302 | * |
| 1303 | * In a completely prerolled PAUSED or PLAYING pipeline, seeking is always |
| 1304 | * guaranteed to return <tt>true</tt> on a seekable media type or <tt>false</tt> when the media |
| 1305 | * type is certainly not seekable (such as a live stream). |
| 1306 | * |
| 1307 | * Some elements allow for seeking in the READY state, in this |
| 1308 | * case they will store the seek event and execute it when they are put to |
| 1309 | * PAUSED. If the element supports seek in READY, it will always return <tt>true</tt> when |
| 1310 | * it receives the event in the READY state. |
| 1311 | * |
| 1312 | * @param format A Gst::Format to execute the seek in, such as Gst::FORMAT_TIME. |
| 1313 | * @param seek_flags Seek options; playback applications will usually want to use |
| 1314 | * GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT here. |
| 1315 | * @param seek_pos Position to seek to (relative to the start); if you are doing |
| 1316 | * a seek in Gst::FORMAT_TIME this value is in nanoseconds - |
| 1317 | * multiply with Gst::SECOND to convert seconds to nanoseconds or |
| 1318 | * with Gst::MSECOND to convert milliseconds to nanoseconds. |
| 1319 | * @return <tt>true</tt> if the seek operation succeeded. Flushing seeks will trigger a |
| 1320 | * preroll, which will emit Gst::MESSAGE_ASYNC_DONE. |
| 1321 | */ |
| 1322 | bool seek(Format format, SeekFlags seek_flags, gint64 seek_pos); |
| 1323 | |
| 1324 | /** Sends a seek event to an element. See Gst::Event::new_seek() for the details of |
| 1325 | * the parameters. The seek event is sent to the element using |
| 1326 | * send_event(). |
| 1327 | * |
| 1328 | * MT safe. |
| 1329 | * |
| 1330 | * @param rate The new playback rate. |
| 1331 | * @param format The format of the seek values. |
| 1332 | * @param flags The optional seek flags. |
| 1333 | * @param cur_type The type and flags for the new start position. |
| 1334 | * @param cur The value of the new start position. |
| 1335 | * @param stop_type The type and flags for the new stop position. |
| 1336 | * @param stop The value of the new stop position. |
| 1337 | * @return <tt>true</tt> if the event was handled. Flushing seeks will trigger a |
| 1338 | * preroll, which will emit Gst::MESSAGE_ASYNC_DONE. |
| 1339 | */ |
| 1340 | bool seek(double rate, Format format, SeekFlags flags, SeekType cur_type, gint64 cur, SeekType stop_type, gint64 stop); |
| 1341 | |
| 1342 | |
| 1343 | /** Sends an event to an element. If the element doesn't implement an |
| 1344 | * event handler, the event will be pushed on a random linked sink pad for |
| 1345 | * downstream events or a random linked source pad for upstream events. |
| 1346 | * |
| 1347 | * This function takes ownership of the provided event so you should |
| 1348 | * Gst::Event::ref() it if you want to reuse the event after this call. |
| 1349 | * |
| 1350 | * MT safe. |
| 1351 | * |
| 1352 | * @param event The Gst::Event to send to the element. |
| 1353 | * @return <tt>true</tt> if the event was handled. Events that trigger a preroll (such |
| 1354 | * as flushing seeks and steps) will emit Gst::MESSAGE_ASYNC_DONE. |
| 1355 | */ |
| 1356 | bool send_event(Glib::RefPtr<Gst::Event>&& event); |
| 1357 | /// A send_event() convenience overload. Allows to re-use @a event parameter after function call. |
| 1358 | bool send_event(const Glib::RefPtr<Gst::Event>& event); |
| 1359 | |
| 1360 | |
| 1361 | /** Gets the context with @a context_type set on the element or <tt>nullptr</tt>. |
| 1362 | * |
| 1363 | * MT safe. |
| 1364 | * |
| 1365 | * @param context_type A name of a context to retrieve. |
| 1366 | * @return A Gst::Context or <tt>nullptr</tt>. |
| 1367 | */ |
| 1368 | Glib::RefPtr<Gst::Context> get_context(const Glib::ustring& context_type); |
| 1369 | |
| 1370 | /** Gets the context with @a context_type set on the element or <tt>nullptr</tt>. |
| 1371 | * |
| 1372 | * @param context_type A name of a context to retrieve. |
| 1373 | * @return A Gst::Context or <tt>nullptr</tt>. |
| 1374 | */ |
| 1375 | Glib::RefPtr<Gst::Context> get_context_unlocked(const Glib::ustring& context_type); |
| 1376 | |
| 1377 | |
| 1378 | /** Gets the contexts set on the element. |
| 1379 | * |
| 1380 | * MT safe. |
| 1381 | * |
| 1382 | * @return List of Gst::Context. |
| 1383 | */ |
| 1384 | std::vector< Glib::RefPtr<Gst::Context> > get_contexts(); |
| 1385 | |
| 1386 | |
| 1387 | /** |
| 1388 | * @par Slot Prototype: |
| 1389 | * <tt>void on_my_%no_more_pads()</tt> |
| 1390 | * |
| 1391 | * This signals that the element will not generate more dynamic pads. |
| 1392 | * Note that this signal will usually be emitted from the context of |
| 1393 | * the streaming thread. |
| 1394 | */ |
| 1395 | |
| 1396 | Glib::SignalProxy< void > signal_no_more_pads(); |
| 1397 | |
| 1398 | |
| 1399 | /** |
| 1400 | * @par Slot Prototype: |
| 1401 | * <tt>void on_my_%pad_added(const Glib::RefPtr<Gst::Pad>& new_pad)</tt> |
| 1402 | * |
| 1403 | * a new Gst::Pad has been added to the element. Note that this signal will |
| 1404 | * usually be emitted from the context of the streaming thread. Also keep in |
| 1405 | * mind that if you add new elements to the pipeline in the signal handler |
| 1406 | * you will need to set them to the desired target state with |
| 1407 | * Gst::Element::set_state() or Gst::Element::sync_state_with_parent(). |
| 1408 | * |
| 1409 | * @param new_pad The pad that has been added. |
| 1410 | */ |
| 1411 | |
| 1412 | Glib::SignalProxy< void,const Glib::RefPtr<Gst::Pad>& > signal_pad_added(); |
| 1413 | |
| 1414 | |
| 1415 | /** |
| 1416 | * @par Slot Prototype: |
| 1417 | * <tt>void on_my_%pad_removed(const Glib::RefPtr<Gst::Pad>& old_pad)</tt> |
| 1418 | * |
| 1419 | * a Gst::Pad has been removed from the element |
| 1420 | * |
| 1421 | * @param old_pad The pad that has been removed. |
| 1422 | */ |
| 1423 | |
| 1424 | Glib::SignalProxy< void,const Glib::RefPtr<Gst::Pad>& > signal_pad_removed(); |
| 1425 | |
| 1426 | |
| 1427 | /** Called when a request pad is to be released. |
| 1428 | */ |
| 1429 | virtual void release_pad_vfunc(const Glib::RefPtr<Gst::Pad>& pad); |
| 1430 | |
| 1431 | |
| 1432 | /** Called when a new pad is requested. |
| 1433 | */ |
| 1434 | virtual Glib::RefPtr<Gst::Pad> request_new_pad_vfunc(Glib::RefPtr<Gst::PadTemplate> templ, const Glib::ustring& name, const Glib::RefPtr<const Gst::Caps>& caps); |
| 1435 | |
| 1436 | |
| 1437 | /** Get the state of the element. |
| 1438 | */ |
| 1439 | virtual StateChangeReturn get_state_vfunc(State& state, State& pending, ClockTime timeout) const; |
| 1440 | |
| 1441 | |
| 1442 | /** Set a new state on the element. |
| 1443 | */ |
| 1444 | virtual StateChangeReturn set_state_vfunc(State state); |
| 1445 | |
| 1446 | |
| 1447 | /** Called by set_state to perform an incremental state change. |
| 1448 | */ |
| 1449 | virtual StateChangeReturn change_state_vfunc(StateChange transition); |
| 1450 | |
| 1451 | |
| 1452 | /** Called immediately after a new state was set. |
| 1453 | */ |
| 1454 | virtual void state_changed_vfunc(Gst::State oldstate, Gst::State newstate, Gst::State pending); |
| 1455 | |
| 1456 | |
| 1457 | /** Set a Gst::Bus on the element. |
| 1458 | */ |
| 1459 | virtual void set_bus_vfunc(const Glib::RefPtr<Gst::Bus>& bus); |
| 1460 | |
| 1461 | |
| 1462 | /** Gets the Gst::Clock provided by the element. |
| 1463 | */ |
| 1464 | virtual Glib::RefPtr<Gst::Clock> provide_clock_vfunc(); |
| 1465 | |
| 1466 | |
| 1467 | /** Set the Gst::Clock on the element. |
| 1468 | */ |
| 1469 | virtual bool set_clock_vfunc(const Glib::RefPtr<Gst::Clock>& clock); |
| 1470 | |
| 1471 | |
| 1472 | /** Send a Gst::Event to the element. |
| 1473 | */ |
| 1474 | virtual bool send_event_vfunc(const Glib::RefPtr<Gst::Event>& event); |
| 1475 | |
| 1476 | |
| 1477 | /** Perform a Gst::Query on the element. |
| 1478 | */ |
| 1479 | virtual bool query_vfunc(const Glib::RefPtr<Gst::Query>& query) const; |
| 1480 | |
| 1481 | |
| 1482 | /** Set a Gst::Context on the element |
| 1483 | */ |
| 1484 | virtual void set_context_vfunc(const Glib::RefPtr<Gst::Context>& context); |
| 1485 | |
| 1486 | |
| 1487 | /** Called when a message is posted on the element. |
| 1488 | * Chain up to the parent class' handler to have it posted on the bus. |
| 1489 | */ |
| 1490 | virtual bool post_message_vfunc(const Glib::RefPtr<Gst::Message>& message); |
| 1491 | |
| 1492 | |
| 1493 | Glib::RefPtr<Gst::PadTemplate> get_pad_template(const Glib::ustring &factory_name) const; |
| 1494 | |
| 1495 | /** |
| 1496 | * Sets specified property. Allows to create property-chain |
| 1497 | * (e.g. element->property("location", "test.ogg")->property("num_buffers", 20); |
| 1498 | * |
| 1499 | * @param name The property name. |
| 1500 | * @param value The property value. |
| 1501 | * |
| 1502 | * @return A this element. |
| 1503 | */ |
| 1504 | template<typename T> |
| 1505 | Glib::RefPtr<Gst::Element> property(const Glib::ustring& name, const T& value) |
| 1506 | { |
| 1507 | set_property(name, value); |
| 1508 | return Glib::RefPtr<Gst::Element>( dynamic_cast<Gst::Element*> (Glib::wrap_auto ((GObject*)(gobj()), true)) ); |
| 1509 | } |
| 1510 | |
| 1511 | |
| 1512 | public: |
| 1513 | |
| 1514 | public: |
| 1515 | //C++ methods used to invoke GTK+ virtual functions: |
| 1516 | |
| 1517 | protected: |
| 1518 | //GTK+ Virtual Functions (override these to change behaviour): |
| 1519 | |
| 1520 | //Default Signal Handlers:: |
| 1521 | /// This is a default handler for the signal signal_no_more_pads(). |
| 1522 | virtual void on_no_more_pads(); |
| 1523 | /// This is a default handler for the signal signal_pad_added(). |
| 1524 | virtual void on_pad_added(const Glib::RefPtr<Gst::Pad>& new_pad); |
| 1525 | /// This is a default handler for the signal signal_pad_removed(). |
| 1526 | virtual void on_pad_removed(const Glib::RefPtr<Gst::Pad>& old_pad); |
| 1527 | |
| 1528 | |
| 1529 | }; |
| 1530 | |
| 1531 | } // namespace Gst |
| 1532 | |
| 1533 | |
| 1534 | namespace Glib |
| 1535 | { |
| 1536 | /** A Glib::wrap() method for this object. |
| 1537 | * |
| 1538 | * @param object The C instance. |
| 1539 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 1540 | * @result A C++ instance that wraps this C instance. |
| 1541 | * |
| 1542 | * @relates Gst::Element |
| 1543 | */ |
| 1544 | Glib::RefPtr<Gst::Element> wrap(GstElement* object, bool take_copy = false); |
| 1545 | } |
| 1546 | |
| 1547 | |
| 1548 | #endif /* _GSTREAMERMM_ELEMENT_H */ |
| 1549 |