| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_BIN_H |
| 3 | #define _GSTREAMERMM_BIN_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/element.h> |
| 29 | #include <gstreamermm/childproxy.h> |
| 30 | |
| 31 | |
| 32 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 33 | using GstBin = struct _GstBin; |
| 34 | using GstBinClass = struct _GstBinClass; |
| 35 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 36 | |
| 37 | |
| 38 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 39 | namespace Gst |
| 40 | { class Bin_Class; } // namespace Gst |
| 41 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 42 | |
| 43 | namespace Gst |
| 44 | { |
| 45 | |
| 46 | class Pad; |
| 47 | class GhostPad; |
| 48 | |
| 49 | //Gst::Iterator<> forward declaration. |
| 50 | template <class CppType> |
| 51 | class Iterator; |
| 52 | |
| 53 | /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */ |
| 54 | |
| 55 | /** |
| 56 | * @var BinFlags BIN_FLAG_NO_RESYNC |
| 57 | * Don't resync a state change when elements are |
| 58 | * added or linked in the bin (Since 1.0.5). |
| 59 | * |
| 60 | * @var BinFlags BIN_FLAG_LAST |
| 61 | * The last enum in the series of flags for bins. |
| 62 | * Derived classes can use this as first value in a list of flags. |
| 63 | * |
| 64 | * @enum BinFlags |
| 65 | * |
| 66 | * GstBinFlags are a set of flags specific to bins. Most are set/used |
| 67 | * internally. They can be checked using the GST_OBJECT_FLAG_IS_SET () macro, |
| 68 | * and (un)set using GST_OBJECT_FLAG_SET () and GST_OBJECT_FLAG_UNSET (). |
| 69 | * |
| 70 | * @ingroup gstreamermmEnums |
| 71 | * @par Bitwise operators: |
| 72 | * <tt>%BinFlags operator|(BinFlags, BinFlags)</tt><br> |
| 73 | * <tt>%BinFlags operator&(BinFlags, BinFlags)</tt><br> |
| 74 | * <tt>%BinFlags operator^(BinFlags, BinFlags)</tt><br> |
| 75 | * <tt>%BinFlags operator~(BinFlags)</tt><br> |
| 76 | * <tt>%BinFlags& operator|=(BinFlags&, BinFlags)</tt><br> |
| 77 | * <tt>%BinFlags& operator&=(BinFlags&, BinFlags)</tt><br> |
| 78 | * <tt>%BinFlags& operator^=(BinFlags&, BinFlags)</tt><br> |
| 79 | */ |
| 80 | enum BinFlags |
| 81 | { |
| 82 | BIN_FLAG_NO_RESYNC = (GST_ELEMENT_FLAG_LAST << 0), |
| 83 | BIN_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 5) |
| 84 | }; |
| 85 | |
| 86 | /** @ingroup gstreamermmEnums */ |
| 87 | inline BinFlags operator|(BinFlags lhs, BinFlags rhs) |
| 88 | { return static_cast<BinFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } |
| 89 | |
| 90 | /** @ingroup gstreamermmEnums */ |
| 91 | inline BinFlags operator&(BinFlags lhs, BinFlags rhs) |
| 92 | { return static_cast<BinFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } |
| 93 | |
| 94 | /** @ingroup gstreamermmEnums */ |
| 95 | inline BinFlags operator^(BinFlags lhs, BinFlags rhs) |
| 96 | { return static_cast<BinFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } |
| 97 | |
| 98 | /** @ingroup gstreamermmEnums */ |
| 99 | inline BinFlags operator~(BinFlags flags) |
| 100 | { return static_cast<BinFlags>(~static_cast<unsigned>(flags)); } |
| 101 | |
| 102 | /** @ingroup gstreamermmEnums */ |
| 103 | inline BinFlags& operator|=(BinFlags& lhs, BinFlags rhs) |
| 104 | { return (lhs = static_cast<BinFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } |
| 105 | |
| 106 | /** @ingroup gstreamermmEnums */ |
| 107 | inline BinFlags& operator&=(BinFlags& lhs, BinFlags rhs) |
| 108 | { return (lhs = static_cast<BinFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } |
| 109 | |
| 110 | /** @ingroup gstreamermmEnums */ |
| 111 | inline BinFlags& operator^=(BinFlags& lhs, BinFlags rhs) |
| 112 | { return (lhs = static_cast<BinFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } |
| 113 | |
| 114 | } // namespace Gst |
| 115 | |
| 116 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 117 | namespace Glib |
| 118 | { |
| 119 | |
| 120 | template <> |
| 121 | class Value<Gst::BinFlags> : public Glib::Value_Flags<Gst::BinFlags> |
| 122 | { |
| 123 | public: |
| 124 | static GType value_type() G_GNUC_CONST; |
| 125 | }; |
| 126 | |
| 127 | } // namespace Glib |
| 128 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 129 | |
| 130 | namespace Gst |
| 131 | { |
| 132 | |
| 133 | |
| 134 | /** |
| 135 | * Base class and element that can contain other elements |
| 136 | * |
| 137 | * Gst::Bin is an element that can contain other Gst::Element, allowing them to be |
| 138 | * managed as a group. |
| 139 | * Pads from the child elements can be ghosted to the bin, see Gst::GhostPad. |
| 140 | * This makes the bin look like any other elements and enables creation of |
| 141 | * higher-level abstraction elements. |
| 142 | * |
| 143 | * A new Gst::Bin is created with create(). Use a Gst::Pipeline instead if you |
| 144 | * want to create a toplevel bin because a normal bin doesn't have a bus or |
| 145 | * handle clock distribution of its own. |
| 146 | * |
| 147 | * After the bin has been created you will typically add elements to it with |
| 148 | * add(). You can remove elements with remove(). |
| 149 | * |
| 150 | * An element can be retrieved from a bin with get_element(), using the |
| 151 | * elements name. get_element_recurse_up() is mainly used for internal |
| 152 | * purposes and will query the parent bins when the element is not found in the |
| 153 | * current bin. |
| 154 | * |
| 155 | * An iterator of elements in a bin can be retrieved with |
| 156 | * iterate_elements(). Various other iterators exist to retrieve the |
| 157 | * elements in a bin. |
| 158 | * |
| 159 | * The element-added signal is fired whenever a new element is added to |
| 160 | * the bin. Likewise the element-removed signal is fired whenever an |
| 161 | * element is removed from the bin. |
| 162 | * |
| 163 | * Notes: |
| 164 | * |
| 165 | * A Gst::Bin internally intercepts every Gst::Message posted by its children and |
| 166 | * implements the following default behaviour for each of them: |
| 167 | * |
| 168 | * - Gst::MESSAGE_EOS - This message is only posted by sinks in the PLAYING |
| 169 | * state. If all sinks posted the EOS message, this bin will post and EOS |
| 170 | * message upwards. |
| 171 | * |
| 172 | * - Gst::MESSAGE_SEGMENT_START - just collected and never forwarded upwards. |
| 173 | * The messages are used to decide when all elements have completed playback |
| 174 | * of their segment. |
| 175 | * |
| 176 | * - Gst::MESSAGE_SEGMENT_DONE - Is posted by Gst::Bin when all elements that posted |
| 177 | * a SEGMENT_START have posted a SEGMENT_DONE. |
| 178 | * |
| 179 | * - Gst::MESSAGE_DURATION_CHANGED - Is posted by an element that detected a change |
| 180 | * in the stream duration. The default bin behaviour is to clear any |
| 181 | * cached duration values so that the next duration query will perform |
| 182 | * a full duration recalculation. The duration change is posted to the |
| 183 | * application so that it can refetch the new duration with a duration |
| 184 | * query. Note that these messages can be posted before the bin is |
| 185 | * prerolled, in which case the duration query might fail. |
| 186 | * |
| 187 | * - Gst::MESSAGE_CLOCK_LOST - This message is posted by an element when it |
| 188 | * can no longer provide a clock. The default bin behaviour is to |
| 189 | * check if the lost clock was the one provided by the bin. If so and |
| 190 | * the bin is currently in the PLAYING state, the message is forwarded to |
| 191 | * the bin parent. |
| 192 | * This message is also generated when a clock provider is removed from |
| 193 | * the bin. If this message is received by the application, it should |
| 194 | * PAUSE the pipeline and set it back to PLAYING to force a new clock |
| 195 | * distribution. |
| 196 | * |
| 197 | * - Gst::MESSAGE_CLOCK_PROVIDE - This message is generated when an element |
| 198 | * can provide a clock. This mostly happens when a new clock |
| 199 | * provider is added to the bin. The default behaviour of the bin is to |
| 200 | * mark the currently selected clock as dirty, which will perform a clock |
| 201 | * recalculation the next time the bin is asked to provide a clock. |
| 202 | * This message is never sent tot the application but is forwarded to |
| 203 | * the parent of the bin. |
| 204 | * |
| 205 | * - OTHERS - posted upwards. |
| 206 | * |
| 207 | * A Gst::Bin implements the following default behaviour for answering to a |
| 208 | * Gst::Query: |
| 209 | * |
| 210 | * - Gst::QUERY_DURATION - If the query has been asked before with the same format |
| 211 | * and the bin is a toplevel bin (ie. has no parent), |
| 212 | * use the cached previous value. If no previous value was cached, the |
| 213 | * query is sent to all sink elements in the bin and the MAXIMUM of all |
| 214 | * values is returned. If the bin is a toplevel bin the value is cached. |
| 215 | * If no sinks are available in the bin, the query fails. |
| 216 | * |
| 217 | * - Gst::QUERY_POSITION - The query is sent to all sink elements in the bin and the |
| 218 | * MAXIMUM of all values is returned. If no sinks are available in the bin, |
| 219 | * the query fails. |
| 220 | * - OTHERS - the query is forwarded to all sink elements, the result |
| 221 | * of the first sink that answers the query successfully is returned. If no |
| 222 | * sink is in the bin, the query fails. |
| 223 | * |
| 224 | * A Gst::Bin will by default forward any event sent to it to all sink elements. |
| 225 | * If all the sinks return true, the bin will also return true, else false is |
| 226 | * returned. If no sinks are in the bin, the event handler will return true. |
| 227 | * |
| 228 | * Last reviewed on 2016-05-05 (1.8.0). |
| 229 | * |
| 230 | * @ingroup GstBaseClasses |
| 231 | */ |
| 232 | |
| 233 | |
| 234 | class Bin |
| 235 | : public Element, |
| 236 | public ChildProxy |
| 237 | { |
| 238 | |
| 239 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 240 | |
| 241 | public: |
| 242 | using CppObjectType = Bin; |
| 243 | using CppClassType = Bin_Class; |
| 244 | using BaseObjectType = GstBin; |
| 245 | using BaseClassType = GstBinClass; |
| 246 | |
| 247 | // noncopyable |
| 248 | Bin(const Bin&) = delete; |
| 249 | Bin& operator=(const Bin&) = delete; |
| 250 | |
| 251 | private: friend class Bin_Class; |
| 252 | static CppClassType bin_class_; |
| 253 | |
| 254 | protected: |
| 255 | explicit Bin(const Glib::ConstructParams& construct_params); |
| 256 | explicit Bin(GstBin* castitem); |
| 257 | |
| 258 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 259 | |
| 260 | public: |
| 261 | |
| 262 | Bin(Bin&& src) noexcept; |
| 263 | Bin& operator=(Bin&& src) noexcept; |
| 264 | |
| 265 | ~Bin() noexcept override; |
| 266 | |
| 267 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 268 | */ |
| 269 | static GType get_type() G_GNUC_CONST; |
| 270 | |
| 271 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 272 | |
| 273 | |
| 274 | static GType get_base_type() G_GNUC_CONST; |
| 275 | #endif |
| 276 | |
| 277 | ///Provides access to the underlying C GObject. |
| 278 | GstBin* gobj() { return reinterpret_cast<GstBin*>(gobject_); } |
| 279 | |
| 280 | ///Provides access to the underlying C GObject. |
| 281 | const GstBin* gobj() const { return reinterpret_cast<GstBin*>(gobject_); } |
| 282 | |
| 283 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 284 | GstBin* gobj_copy(); |
| 285 | |
| 286 | private: |
| 287 | |
| 288 | |
| 289 | protected: |
| 290 | explicit Bin(const Glib::ustring& name); |
| 291 | |
| 292 | Bin(); |
| 293 | |
| 294 | public: |
| 295 | /** Creates a new bin with the given name. |
| 296 | * |
| 297 | * @param name The name of the new bin. |
| 298 | * @return A new Gst::Bin. |
| 299 | */ |
| 300 | |
| 301 | static Glib::RefPtr<Bin> create(const Glib::ustring& name); |
| 302 | |
| 303 | |
| 304 | /** Creates a new bin with a unique generic name. |
| 305 | * |
| 306 | * @return A new Gst::Bin. |
| 307 | */ |
| 308 | |
| 309 | static Glib::RefPtr<Bin> create(); |
| 310 | |
| 311 | |
| 312 | /** Adds the given element to the bin. Sets the element's parent, and thus |
| 313 | * takes ownership of the element. An element can only be added to one bin. |
| 314 | * |
| 315 | * If the element's pads are linked to other pads, the pads will be unlinked |
| 316 | * before the element is added to the bin. |
| 317 | * |
| 318 | * When you add an element to an already-running pipeline, you will have to |
| 319 | * take care to set the state of the newly-added element to the desired |
| 320 | * state (usually PLAYING or PAUSED, same you set the pipeline to originally) |
| 321 | * with set_state(), or use sync_state_with_parent(). |
| 322 | * The bin or pipeline will not take care of this for you. |
| 323 | * |
| 324 | * MT safe. |
| 325 | * |
| 326 | * @param element The Gst::Element to add. |
| 327 | * @return This Gst::Bin if successful, for chained calls to add(). |
| 328 | * |
| 329 | * @throws std::runtime_error if the Bin does not want to accept the Element. |
| 330 | */ |
| 331 | Glib::RefPtr<Gst::Bin> add(const Glib::RefPtr<Gst::Element>& element); |
| 332 | |
| 333 | |
| 334 | /** Removes the element from the bin, unparenting it as well. |
| 335 | * Unparenting the element means that the element will be dereferenced, |
| 336 | * so if the bin holds the only reference to the element, the element |
| 337 | * will be freed in the process of removing it from the bin. |
| 338 | * |
| 339 | * If the element's pads are linked to other pads, the pads will be unlinked |
| 340 | * before the element is removed from the bin. |
| 341 | * |
| 342 | * MT safe. |
| 343 | * |
| 344 | * @param element the Gst::Element to remove |
| 345 | * @return this Gst::Bin if successful, for chained calls to remove(). |
| 346 | * |
| 347 | * @throws std::runtime_error if the Bin does not want to remove the Element. |
| 348 | */ |
| 349 | Glib::RefPtr<Gst::Bin> remove(const Glib::RefPtr<Gst::Element>& element); |
| 350 | |
| 351 | |
| 352 | //We could add a bool recurse_up = false parameter, |
| 353 | //but get_element() and get_element_recurse_up() seem different enough to be separate. |
| 354 | //One recurses down and the other recurses up, so it's not just additional behaviour. |
| 355 | |
| 356 | /** Gets the element with the given name from a bin. This |
| 357 | * function recurses into child bins. |
| 358 | * |
| 359 | * @param name The element name to search for. |
| 360 | * @return The Gst::Element with the given |
| 361 | * name, or <tt>nullptr</tt>. |
| 362 | */ |
| 363 | Glib::RefPtr<Gst::Element> get_element(const Glib::ustring& name); |
| 364 | |
| 365 | /** Gets the element with the given name from a bin. This |
| 366 | * function recurses into child bins. |
| 367 | * |
| 368 | * @param name The element name to search for. |
| 369 | * @return The Gst::Element with the given |
| 370 | * name, or <tt>nullptr</tt>. |
| 371 | */ |
| 372 | Glib::RefPtr<const Gst::Element> get_element(const Glib::ustring& name) const; |
| 373 | |
| 374 | |
| 375 | /** Gets the element with the given name from this bin. If the |
| 376 | * element is not found, a recursion is performed on the parent bin. |
| 377 | * |
| 378 | * @param name The element name to search for. |
| 379 | * @return The Gst::Element with the given |
| 380 | * name, or <tt>nullptr</tt>. |
| 381 | */ |
| 382 | Glib::RefPtr<Gst::Element> get_element_recurse_up(const Glib::ustring& name); |
| 383 | |
| 384 | /** Gets the element with the given name from this bin. If the |
| 385 | * element is not found, a recursion is performed on the parent bin. |
| 386 | * |
| 387 | * @param name The element name to search for. |
| 388 | * @return The Gst::Element with the given |
| 389 | * name, or <tt>nullptr</tt>. |
| 390 | */ |
| 391 | Glib::RefPtr<const Gst::Element> get_element_recurse_up(const Glib::ustring& name) const; |
| 392 | |
| 393 | |
| 394 | /** Looks for an element inside the bin that implements the given |
| 395 | * interface. If such an element is found, it returns the element. |
| 396 | * You can cast this element to the given interface afterwards. If you want |
| 397 | * all elements that implement the interface, use |
| 398 | * iterate_all_by_interface(). This function recurses into child bins. |
| 399 | * |
| 400 | * MT safe. Caller owns returned reference. |
| 401 | * |
| 402 | * @param interface The Type of an interface. |
| 403 | * @return A Gst::Element inside the bin implementing the interface. |
| 404 | */ |
| 405 | Glib::RefPtr<Gst::Element> get_element(GType interface); |
| 406 | |
| 407 | /** Looks for an element inside the bin that implements the given |
| 408 | * interface. If such an element is found, it returns the element. |
| 409 | * You can cast this element to the given interface afterwards. If you want |
| 410 | * all elements that implement the interface, use |
| 411 | * iterate_all_by_interface(). This function recurses into child bins. |
| 412 | * |
| 413 | * MT safe. Caller owns returned reference. |
| 414 | * |
| 415 | * @param interface The Type of an interface. |
| 416 | * @return A Gst::Element inside the bin implementing the interface. |
| 417 | */ |
| 418 | Glib::RefPtr<const Gst::Element> get_element(GType interface) const; |
| 419 | |
| 420 | /** Adds a ghost pad to the bin using an element's static pad as a target. |
| 421 | * @param element The element with the target static pad. |
| 422 | * @param pad_name The static pad to use as the target. |
| 423 | * @param name An optional name for the ghost pad. |
| 424 | * @return The newly created Gst::GhostPad. |
| 425 | */ |
| 426 | Glib::RefPtr<Gst::GhostPad> add_ghost_pad(const Glib::RefPtr<Gst::Element>& |
| 427 | element, const Glib::ustring& pad_name, const Glib::ustring& name = |
| 428 | Glib::ustring()); |
| 429 | |
| 430 | |
| 431 | /** Recursively looks for elements with an unlinked pad of the given |
| 432 | * direction within the specified bin and returns an unlinked pad |
| 433 | * if one is found, or <tt>nullptr</tt> otherwise. If a pad is found, the caller |
| 434 | * owns a reference to it and should use Gst::Object::unref() on the |
| 435 | * pad when it is not needed any longer. |
| 436 | * |
| 437 | * @param dir Whether to look for an unlinked source or sink pad. |
| 438 | * @return Unlinked pad of the given |
| 439 | * direction, <tt>nullptr</tt>. |
| 440 | */ |
| 441 | Glib::RefPtr<Gst::Pad> find_unlinked_pad(PadDirection dir); |
| 442 | |
| 443 | /** Recursively looks for elements with an unlinked pad of the given |
| 444 | * direction within the specified bin and returns an unlinked pad |
| 445 | * if one is found, or <tt>nullptr</tt> otherwise. If a pad is found, the caller |
| 446 | * owns a reference to it and should use Gst::Object::unref() on the |
| 447 | * pad when it is not needed any longer. |
| 448 | * |
| 449 | * @param dir Whether to look for an unlinked source or sink pad. |
| 450 | * @return Unlinked pad of the given |
| 451 | * direction, <tt>nullptr</tt>. |
| 452 | */ |
| 453 | Glib::RefPtr<const Gst::Pad> find_unlinked_pad(PadDirection dir) const; |
| 454 | |
| 455 | |
| 456 | /** Gets an iterator for the elements in this bin. |
| 457 | * |
| 458 | * MT safe. Caller owns returned value. |
| 459 | * |
| 460 | * @return A Gst::Iterator of Gst::Element, |
| 461 | * or <tt>nullptr</tt>. |
| 462 | */ |
| 463 | Gst::Iterator<Gst::Element> iterate_elements(); |
| 464 | |
| 465 | /** Gets an iterator for the elements in this bin. |
| 466 | * |
| 467 | * MT safe. Caller owns returned value. |
| 468 | * |
| 469 | * @return A Gst::Iterator of Gst::Element, |
| 470 | * or <tt>nullptr</tt>. |
| 471 | */ |
| 472 | Gst::Iterator<const Gst::Element> iterate_elements() const; |
| 473 | |
| 474 | /** Gets an iterator for the elements in this bin. |
| 475 | * This iterator recurses into GstBin children. |
| 476 | * |
| 477 | * MT safe. Caller owns returned value. |
| 478 | * |
| 479 | * @return A Gst::Iterator of Gst::Element, |
| 480 | * or <tt>nullptr</tt>. |
| 481 | */ |
| 482 | Gst::Iterator<Gst::Element> iterate_recurse(); |
| 483 | |
| 484 | /** Gets an iterator for the elements in this bin. |
| 485 | * This iterator recurses into GstBin children. |
| 486 | * |
| 487 | * MT safe. Caller owns returned value. |
| 488 | * |
| 489 | * @return A Gst::Iterator of Gst::Element, |
| 490 | * or <tt>nullptr</tt>. |
| 491 | */ |
| 492 | Gst::Iterator<const Gst::Element> iterate_recurse() const; |
| 493 | |
| 494 | /** Gets an iterator for the elements in this bin in topologically |
| 495 | * sorted order. This means that the elements are returned from |
| 496 | * the most downstream elements (sinks) to the sources. |
| 497 | * |
| 498 | * This function is used internally to perform the state changes |
| 499 | * of the bin elements and for clock selection. |
| 500 | * |
| 501 | * MT safe. Caller owns returned value. |
| 502 | * |
| 503 | * @return A Gst::Iterator of Gst::Element, |
| 504 | * or <tt>nullptr</tt>. |
| 505 | */ |
| 506 | Gst::Iterator<Gst::Element> iterate_sorted(); |
| 507 | |
| 508 | /** Gets an iterator for the elements in this bin in topologically |
| 509 | * sorted order. This means that the elements are returned from |
| 510 | * the most downstream elements (sinks) to the sources. |
| 511 | * |
| 512 | * This function is used internally to perform the state changes |
| 513 | * of the bin elements and for clock selection. |
| 514 | * |
| 515 | * MT safe. Caller owns returned value. |
| 516 | * |
| 517 | * @return A Gst::Iterator of Gst::Element, |
| 518 | * or <tt>nullptr</tt>. |
| 519 | */ |
| 520 | Gst::Iterator<const Gst::Element> iterate_sorted() const; |
| 521 | |
| 522 | /** Gets an iterator for all elements in the bin that have the |
| 523 | * Gst::ELEMENT_FLAG_SOURCE flag set. |
| 524 | * |
| 525 | * MT safe. Caller owns returned value. |
| 526 | * |
| 527 | * @return A Gst::Iterator of Gst::Element, |
| 528 | * or <tt>nullptr</tt>. |
| 529 | */ |
| 530 | Gst::Iterator<Gst::Element> iterate_sources(); |
| 531 | |
| 532 | /** Gets an iterator for all elements in the bin that have the |
| 533 | * Gst::ELEMENT_FLAG_SOURCE flag set. |
| 534 | * |
| 535 | * MT safe. Caller owns returned value. |
| 536 | * |
| 537 | * @return A Gst::Iterator of Gst::Element, |
| 538 | * or <tt>nullptr</tt>. |
| 539 | */ |
| 540 | Gst::Iterator<const Gst::Element> iterate_sources() const; |
| 541 | |
| 542 | /** Gets an iterator for all elements in the bin that have the |
| 543 | * Gst::ELEMENT_FLAG_SINK flag set. |
| 544 | * |
| 545 | * MT safe. Caller owns returned value. |
| 546 | * |
| 547 | * @return A Gst::Iterator of Gst::Element, |
| 548 | * or <tt>nullptr</tt>. |
| 549 | */ |
| 550 | Gst::Iterator<Gst::Element> iterate_sinks(); |
| 551 | |
| 552 | /** Gets an iterator for all elements in the bin that have the |
| 553 | * Gst::ELEMENT_FLAG_SINK flag set. |
| 554 | * |
| 555 | * MT safe. Caller owns returned value. |
| 556 | * |
| 557 | * @return A Gst::Iterator of Gst::Element, |
| 558 | * or <tt>nullptr</tt>. |
| 559 | */ |
| 560 | Gst::Iterator<const Gst::Element> iterate_sinks() const; |
| 561 | |
| 562 | /** Looks for all elements inside the bin that implements the given |
| 563 | * interface. You can safely cast all returned elements to the given interface. |
| 564 | * The function recurses inside child bins. The iterator will yield a series |
| 565 | * of Gst::Element that should be unreffed after use. |
| 566 | * |
| 567 | * MT safe. Caller owns returned value. |
| 568 | * |
| 569 | * @param iface The Type of an interface. |
| 570 | * @return A Gst::Iterator of Gst::Element |
| 571 | * for all elements in the bin implementing the given interface, |
| 572 | * or <tt>nullptr</tt>. |
| 573 | */ |
| 574 | Gst::Iterator<Gst::Element> iterate_by_interface(GType iface); |
| 575 | |
| 576 | /** Looks for all elements inside the bin that implements the given |
| 577 | * interface. You can safely cast all returned elements to the given interface. |
| 578 | * The function recurses inside child bins. The iterator will yield a series |
| 579 | * of Gst::Element that should be unreffed after use. |
| 580 | * |
| 581 | * MT safe. Caller owns returned value. |
| 582 | * |
| 583 | * @param iface The Type of an interface. |
| 584 | * @return A Gst::Iterator of Gst::Element |
| 585 | * for all elements in the bin implementing the given interface, |
| 586 | * or <tt>nullptr</tt>. |
| 587 | */ |
| 588 | Gst::Iterator<const Gst::Element> iterate_by_interface(GType iface) const; |
| 589 | |
| 590 | /** Synchronizes the state of every child of @a bin with the state |
| 591 | * of @a bin. See also Gst::Element::sync_state_with_parent(). |
| 592 | * |
| 593 | * @return <tt>true</tt> if syncing the state was successful for all children, |
| 594 | * otherwise <tt>false</tt>. |
| 595 | */ |
| 596 | bool sync_children_states(); |
| 597 | |
| 598 | |
| 599 | /** Query @a bin for the current latency using and reconfigures this latency to all the |
| 600 | * elements with a LATENCY event. |
| 601 | * |
| 602 | * This method is typically called on the pipeline when a Gst::MESSAGE_LATENCY |
| 603 | * is posted on the bus. |
| 604 | * |
| 605 | * This function simply emits the 'do-latency' signal so any custom latency |
| 606 | * calculations will be performed. |
| 607 | * |
| 608 | * @return <tt>true</tt> if the latency could be queried and reconfigured. |
| 609 | */ |
| 610 | bool recalculate_latency(); |
| 611 | |
| 612 | |
| 613 | /** Gets the bin's list of children. |
| 614 | */ |
| 615 | Glib::ListHandle< Glib::RefPtr<Gst::Element> > get_children() const; |
| 616 | |
| 617 | /** Gets the children cookie. |
| 618 | */ |
| 619 | guint32 get_children_cookie() const; |
| 620 | |
| 621 | /** Gets the number of children in the bin. |
| 622 | */ |
| 623 | int get_num_children() const; |
| 624 | |
| 625 | /** Gets the internal bus for handling child messages. |
| 626 | */ |
| 627 | Glib::RefPtr<Gst::Bus> get_child_bus(); |
| 628 | Glib::RefPtr<const Gst::Bus> get_child_bus() const; |
| 629 | |
| 630 | |
| 631 | /** Gets the bin's queued and cached messages. |
| 632 | */ |
| 633 | Glib::ListHandle< Glib::RefPtr<Gst::Message> > get_messages() const; |
| 634 | |
| 635 | /** Gets whether the bin is currently calculating its state. |
| 636 | */ |
| 637 | bool get_polling() const; |
| 638 | |
| 639 | /** Gets whether the bin needs to select a new clock. |
| 640 | */ |
| 641 | bool get_clock_dirty() const; |
| 642 | |
| 643 | /** Gets the last clock selected. |
| 644 | */ |
| 645 | Glib::RefPtr<Gst::Clock> get_provided_clock(); |
| 646 | Glib::RefPtr<const Gst::Clock> get_provided_clock() const; |
| 647 | |
| 648 | /** Gets the element that provided @a provided_clock. |
| 649 | */ |
| 650 | Glib::RefPtr<Gst::Element> get_clock_provider(); |
| 651 | Glib::RefPtr<const Gst::Element> get_clock_provider() const; |
| 652 | |
| 653 | /** The bin will handle Asynchronous state changes. |
| 654 | * |
| 655 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 656 | * or receive notification when the value of the property changes. |
| 657 | */ |
| 658 | Glib::PropertyProxy< bool > property_async_handling() ; |
| 659 | |
| 660 | /** The bin will handle Asynchronous state changes. |
| 661 | * |
| 662 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 663 | * or receive notification when the value of the property changes. |
| 664 | */ |
| 665 | Glib::PropertyProxy_ReadOnly< bool > property_async_handling() const; |
| 666 | |
| 667 | /** Forwards all children messages. |
| 668 | * |
| 669 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 670 | * or receive notification when the value of the property changes. |
| 671 | */ |
| 672 | Glib::PropertyProxy< bool > property_message_forward() ; |
| 673 | |
| 674 | /** Forwards all children messages. |
| 675 | * |
| 676 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 677 | * or receive notification when the value of the property changes. |
| 678 | */ |
| 679 | Glib::PropertyProxy_ReadOnly< bool > property_message_forward() const; |
| 680 | |
| 681 | |
| 682 | /** |
| 683 | * @par Slot Prototype: |
| 684 | * <tt>void on_my_%element_added(const Glib::RefPtr<Gst::Element>& element)</tt> |
| 685 | * |
| 686 | * Will be emitted after the element was added to the bin. |
| 687 | * |
| 688 | * @param element The Gst::Element that was added to the bin. |
| 689 | */ |
| 690 | |
| 691 | Glib::SignalProxy< void,const Glib::RefPtr<Gst::Element>& > signal_element_added(); |
| 692 | |
| 693 | |
| 694 | /** |
| 695 | * @par Slot Prototype: |
| 696 | * <tt>void on_my_%element_removed(const Glib::RefPtr<Gst::Element>& element)</tt> |
| 697 | * |
| 698 | * Will be emitted after the element was removed from the bin. |
| 699 | * |
| 700 | * @param element The Gst::Element that was removed from the bin. |
| 701 | */ |
| 702 | |
| 703 | Glib::SignalProxy< void,const Glib::RefPtr<Gst::Element>& > signal_element_removed(); |
| 704 | |
| 705 | |
| 706 | //TODO: The default signal handler is marked as private in the C header. Is that intendend? |
| 707 | |
| 708 | /** |
| 709 | * @par Slot Prototype: |
| 710 | * <tt>bool on_my_%do_latency()</tt> |
| 711 | * |
| 712 | * Will be emitted when the bin needs to perform latency calculations. This |
| 713 | * signal is only emitted for toplevel bins or when async-handling is |
| 714 | * enabled. |
| 715 | * |
| 716 | * Only one signal handler is invoked. If no signals are connected, the |
| 717 | * default handler is invoked, which will query and distribute the lowest |
| 718 | * possible latency to all sinks. |
| 719 | * |
| 720 | * Connect to this signal if the default latency calculations are not |
| 721 | * sufficient, like when you need different latencies for different sinks in |
| 722 | * the same pipeline. |
| 723 | */ |
| 724 | |
| 725 | Glib::SignalProxy< bool > signal_do_latency(); |
| 726 | |
| 727 | |
| 728 | /** Method to add an element to a bin. |
| 729 | */ |
| 730 | virtual bool add_element_vfunc(const Glib::RefPtr<Gst::Element>& element); |
| 731 | |
| 732 | |
| 733 | /** Method to remove an element from a bin. |
| 734 | */ |
| 735 | virtual bool remove_element_vfunc(const Glib::RefPtr<Gst::Element>& element); |
| 736 | |
| 737 | |
| 738 | /** Method to handle a message from the children. |
| 739 | */ |
| 740 | virtual void handle_message_vfunc(const Glib::RefPtr<Gst::Message>& message); |
| 741 | |
| 742 | |
| 743 | public: |
| 744 | |
| 745 | public: |
| 746 | //C++ methods used to invoke GTK+ virtual functions: |
| 747 | |
| 748 | protected: |
| 749 | //GTK+ Virtual Functions (override these to change behaviour): |
| 750 | |
| 751 | //Default Signal Handlers:: |
| 752 | /// This is a default handler for the signal signal_element_added(). |
| 753 | virtual void on_element_added(const Glib::RefPtr<Gst::Element>& element); |
| 754 | /// This is a default handler for the signal signal_element_removed(). |
| 755 | virtual void on_element_removed(const Glib::RefPtr<Gst::Element>& element); |
| 756 | /// This is a default handler for the signal signal_do_latency(). |
| 757 | virtual bool on_do_latency(); |
| 758 | |
| 759 | |
| 760 | }; |
| 761 | |
| 762 | /*! A gstreamermm Gst::Bin example. |
| 763 | * @example basics/bin.cc |
| 764 | */ |
| 765 | |
| 766 | } //namespace Gst |
| 767 | |
| 768 | |
| 769 | namespace Glib |
| 770 | { |
| 771 | /** A Glib::wrap() method for this object. |
| 772 | * |
| 773 | * @param object The C instance. |
| 774 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 775 | * @result A C++ instance that wraps this C instance. |
| 776 | * |
| 777 | * @relates Gst::Bin |
| 778 | */ |
| 779 | Glib::RefPtr<Gst::Bin> wrap(GstBin* object, bool take_copy = false); |
| 780 | } |
| 781 | |
| 782 | |
| 783 | #endif /* _GSTREAMERMM_BIN_H */ |
| 784 |