gstreamermm: Gst::Bin Class Reference

gstreamermm 1.10.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gst::Bin Class Reference
gstreamermm Base Classes

Base class and element that can contain other elements. More...

`#include <gstreamermm/bin.h>`

Inheritance diagram for Gst::Bin:
[legend]

## Public Member Functions
| Bin (Bin&& src) noexcept
Bin& | operator= (Bin&& src) noexcept
| ~Bin () noexcept override
GstBin* | gobj ()
| Provides access to the underlying C GObject. More...
const GstBin* | gobj () const
| Provides access to the underlying C GObject. More...
GstBin* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::RefPtr< Gst::Bin > | add (const Glib::RefPtr< Gst::Element >& element)
| Adds the given element to the bin. More...
Glib::RefPtr< Gst::Bin > | remove (const Glib::RefPtr< Gst::Element >& element)
| Removes the element from the bin, unparenting it as well. More...
Glib::RefPtr< Gst::Element > | get_element (const Glib::ustring& name)
| Gets the element with the given name from a bin. More...
Glib::RefPtr< const Gst::Element > | get_element (const Glib::ustring& name) const
| Gets the element with the given name from a bin. More...
Glib::RefPtr< Gst::Element > | get_element_recurse_up (const Glib::ustring& name)
| Gets the element with the given name from this bin. More...
Glib::RefPtr< const Gst::Element > | get_element_recurse_up (const Glib::ustring& name) const
| Gets the element with the given name from this bin. More...
Glib::RefPtr< Gst::Element > | get_element (GType interface)
| Looks for an element inside the bin that implements the given interface. More...
Glib::RefPtr< const Gst::Element > | get_element (GType interface) const
| Looks for an element inside the bin that implements the given interface. More...
Glib::RefPtr< Gst::GhostPad > | add_ghost_pad (const Glib::RefPtr< Gst::Element >& element, const Glib::ustring& pad_name, const Glib::ustring& name=Glib::ustring())
| Adds a ghost pad to the bin using an element's static pad as a target. More...
Glib::RefPtr< Gst::Pad > | find_unlinked_pad (PadDirection dir)
| Recursively looks for elements with an unlinked pad of the given direction within the specified bin and returns an unlinked pad if one is found, or `nullptr` otherwise. More...
Glib::RefPtr< const Gst::Pad > | find_unlinked_pad (PadDirection dir) const
| Recursively looks for elements with an unlinked pad of the given direction within the specified bin and returns an unlinked pad if one is found, or `nullptr` otherwise. More...
Gst::Iterator< Gst::Element > | iterate_elements ()
| Gets an iterator for the elements in this bin. More...
Gst::Iterator< const Gst::Element > | iterate_elements () const
| Gets an iterator for the elements in this bin. More...
Gst::Iterator< Gst::Element > | iterate_recurse ()
| Gets an iterator for the elements in this bin. More...
Gst::Iterator< const Gst::Element > | iterate_recurse () const
| Gets an iterator for the elements in this bin. More...
Gst::Iterator< Gst::Element > | iterate_sorted ()
| Gets an iterator for the elements in this bin in topologically sorted order. More...
Gst::Iterator< const Gst::Element > | iterate_sorted () const
| Gets an iterator for the elements in this bin in topologically sorted order. More...
Gst::Iterator< Gst::Element > | iterate_sources ()
| Gets an iterator for all elements in the bin that have the Gst::ELEMENT_FLAG_SOURCE flag set. More...
Gst::Iterator< const Gst::Element > | iterate_sources () const
| Gets an iterator for all elements in the bin that have the Gst::ELEMENT_FLAG_SOURCE flag set. More...
Gst::Iterator< Gst::Element > | iterate_sinks ()
| Gets an iterator for all elements in the bin that have the Gst::ELEMENT_FLAG_SINK flag set. More...
Gst::Iterator< const Gst::Element > | iterate_sinks () const
| Gets an iterator for all elements in the bin that have the Gst::ELEMENT_FLAG_SINK flag set. More...
Gst::Iterator< Gst::Element > | iterate_by_interface (GType iface)
| Looks for all elements inside the bin that implements the given interface. More...
Gst::Iterator< const Gst::Element > | iterate_by_interface (GType iface) const
| Looks for all elements inside the bin that implements the given interface. More...
bool | sync_children_states ()
| Synchronizes the state of every child of bin with the state of bin. More...
bool | recalculate_latency ()
| Query bin for the current latency using and reconfigures this latency to all the elements with a LATENCY event. More...
Glib::ListHandle< Glib::RefPtr< Gst::Element > > | get_children () const
| Gets the bin's list of children. More...
guint32 | get_children_cookie () const
| Gets the children cookie. More...
int | get_num_children () const
| Gets the number of children in the bin. More...
Glib::RefPtr< Gst::Bus > | get_child_bus ()
| Gets the internal bus for handling child messages. More...
Glib::RefPtr< const Gst::Bus > | get_child_bus () const
Glib::ListHandle< Glib::RefPtr< Gst::Message > > | get_messages () const
| Gets the bin's queued and cached messages. More...
bool | get_polling () const
| Gets whether the bin is currently calculating its state. More...
bool | get_clock_dirty () const
| Gets whether the bin needs to select a new clock. More...
Glib::RefPtr< Gst::Clock > | get_provided_clock ()
| Gets the last clock selected. More...
Glib::RefPtr< const Gst::Clock > | get_provided_clock () const
Glib::RefPtr< Gst::Element > | get_clock_provider ()
| Gets the element that provided provided_clock. More...
Glib::RefPtr< const Gst::Element > | get_clock_provider () const
Glib::PropertyProxy< bool > | property_async_handling ()
| The bin will handle Asynchronous state changes. More...
Glib::PropertyProxy_ReadOnly< bool > | property_async_handling () const
| The bin will handle Asynchronous state changes. More...
Glib::PropertyProxy< bool > | property_message_forward ()
| Forwards all children messages. More...
Glib::PropertyProxy_ReadOnly< bool > | property_message_forward () const
| Forwards all children messages. More...
Glib::SignalProxy< void, const Glib::RefPtr< Gst::Element >&> | signal_element_added ()
Glib::SignalProxy< void, const Glib::RefPtr< Gst::Element >&> | signal_element_removed ()
Glib::SignalProxy< bool > | signal_do_latency ()
virtual bool | add_element_vfunc (const Glib::RefPtr< Gst::Element >& element)
| Method to add an element to a bin. More...
virtual bool | remove_element_vfunc (const Glib::RefPtr< Gst::Element >& element)
| Method to remove an element from a bin. More...
virtual void | handle_message_vfunc (const Glib::RefPtr< Gst::Message >& message)
| Method to handle a message from the children. More...
Public Member Functions inherited from Gst::Element
| Element (Element&& src) noexcept
Element& | operator= (Element&& src) noexcept
| ~Element () noexcept override
GstElement* | gobj ()
| Provides access to the underlying C GObject. More...
const GstElement* | gobj () const
| Provides access to the underlying C GObject. More...
GstElement* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::RefPtr< Gst::Element > | link (const Glib::RefPtr< Gst::Element >& dest)
| Links this source element to the dest element. More...
bool | add_pad (const Glib::RefPtr< Gst::Pad >& pad)
| Adds a pad (link point) to element. More...
void | create_all_pads ()
| Creates a pad for each pad template that is always available. More...
Glib::RefPtr< Gst::Pad > | create_compatible_pad (const Glib::RefPtr< const Gst::Pad >& pad, const Glib::RefPtr< const Gst::Caps >& caps)
| Looks for an unlinked pad to which the given pad can link. More...
Glib::RefPtr< Gst::PadTemplate > | get_compatible_pad_template (const Glib::RefPtr< const Gst::PadTemplate >& compattempl)
| Retrieves a pad template from element that is compatible with compattempl. More...
Glib::RefPtr< const Gst::PadTemplate > | get_compatible_pad_template (const Glib::RefPtr< const Gst::PadTemplate >& compattempl) const
| Retrieves a pad template from element that is compatible with compattempl. More...
Glib::RefPtr< Gst::Pad > | get_request_pad (const Glib::ustring& name)
| Retrieves a pad from the element by name (e.g. "src_\\%d"). More...
Glib::RefPtr< Gst::Pad > | request_pad (const Glib::RefPtr< Gst::PadTemplate >& templ, const Glib::ustring& name, const Glib::RefPtr< const Gst::Caps >& caps)
| Retrieves a request pad from the element according to the provided template. More...
Glib::RefPtr< Gst::Pad > | request_pad (const Glib::RefPtr< Gst::PadTemplate >& templ, const Glib::ustring& name)
| A request_pad() convenience overload. More...
Glib::RefPtr< Gst::Pad > | request_pad (const Glib::RefPtr< Gst::PadTemplate >& templ, const Glib::RefPtr< const Gst::Caps >& caps)
| A request_pad() convenience overload. More...
Glib::RefPtr< Gst::Pad > | request_pad (const Glib::RefPtr< Gst::PadTemplate >& templ)
| A request_pad() convenience overload. More...
Glib::RefPtr< Gst::Pad > | get_static_pad (const Glib::ustring& name)
| Retrieves a pad from element by name. More...
Glib::RefPtr< const Gst::Pad > | get_static_pad (const Glib::ustring& name) const
| Retrieves a pad from element by name. More...
void | no_more_pads ()
| Use this function to signal that the element does not expect any more pads to show up in the current pipeline. More...
void | release_request_pad (const Glib::RefPtr< Gst::Pad >& pad)
| Makes the element free the previously requested pad as obtained with get_request_pad(). More...
bool | remove_pad (const Glib::RefPtr< Gst::Pad >& pad)
| Removes pad from element. More...
Gst::Iterator< Gst::Pad > | iterate_pads ()
| Retrieves an iterator of element's pads. More...
Gst::Iterator< const Gst::Pad > | iterate_pads () const
| Retrieves an iterator of element's pads. More...
Gst::Iterator< Gst::Pad > | iterate_sink_pads ()
| Retrieves an iterator of element's sink pads. More...
Gst::Iterator< const Gst::Pad > | iterate_sink_pads () const
| Retrieves an iterator of element's sink pads. More...
Gst::Iterator< Gst::Pad > | iterate_src_pads ()
| Retrieves an iterator of element's source pads. More...
Gst::Iterator< const Gst::Pad > | iterate_src_pads () const
| Retrieves an iterator of element's source pads. More...
void | unlink (const Glib::RefPtr< Gst::Element >& dest)
| Unlinks all source pads of the source element with all sink pads of the sink element to which they are linked. More...
void | set_context (const Glib::RefPtr< Gst::Context >& context)
| Sets the context of the element. More...
bool | link_pads (const Glib::ustring& srcpadname, const Glib::RefPtr< Gst::Element >& dest, const Glib::ustring& destpadname)
| Links the two named pads of the source and destination elements. More...
void | unlink_pads (const Glib::ustring& srcpadname, const Glib::RefPtr< Gst::Element >& dest, const Glib::ustring& destpadname)
| Unlinks the two named pads of the source and destination elements. More...
bool | link_pads (const Glib::ustring& srcpadname, const Glib::RefPtr< Gst::Element >& dest, const Glib::ustring& destpadname, const Glib::RefPtr< Gst::Caps >& filter)
| Links the two named pads of the source and destination elements. More...
bool | link_pads (const Glib::ustring& srcpadname, const Glib::RefPtr< Gst::Element >& dest, const Glib::ustring& destpadname, PadLinkCheck flags)
| Links the two named pads of the source and destination elements. More...
Glib::RefPtr< Gst::Element > | link (const Glib::RefPtr< Gst::Element >& dest, const Glib::RefPtr< Gst::Caps >& filter)
| Links src to dest using the given caps as filtercaps. More...
void | set_base_time (ClockTime time)
| Set the base time of an element. More...
ClockTime | get_base_time () const
| Returns the base time of the element. More...
void | set_start_time (Gst::ClockTime time)
| Set the start time of an element. More...
Gst::ClockTime | get_start_time () const
| Returns the start time of the element. More...
void | set_bus (const Glib::RefPtr< Gst::Bus >& bus)
| Sets the bus of the element. More...
Glib::RefPtr< Gst::Bus > | get_bus ()
| Returns the bus of the element. More...
Glib::RefPtr< const Gst::Bus > | get_bus () const
| Returns the bus of the element. More...
Glib::RefPtr< Gst::ElementFactory > | get_factory ()
| Retrieves the factory that was used to create this element. More...
Glib::RefPtr< const Gst::ElementFactory > | get_factory () const
| Retrieves the factory that was used to create this element. More...
bool | set_clock (const Glib::RefPtr< Gst::Clock >& clock)
| Sets the clock for the element. More...
Glib::RefPtr< Gst::Clock > | get_clock ()
| Gets the currently configured clock of the element. More...
Glib::RefPtr< const Gst::Clock > | get_clock () const
| Gets the currently configured clock of the element. More...
Glib::RefPtr< Gst::Clock > | provide_clock ()
| Get the clock provided by the given element. More...
Glib::RefPtr< const Gst::Clock > | provide_clock () const
| Get the clock provided by the given element. More...
StateChangeReturn | set_state (State state)
| Sets the state of the element. More...
StateChangeReturn | get_state (State& state, State& pending, ClockTime timeout) const
| Gets the state of the element. More...
bool | set_locked_state (gboolean locked_state)
| Locks the state of an element, so state changes of the parent don't affect this element anymore. More...
bool | is_locked_state () const
| Checks if the state of an element is locked. More...
void | abort_state ()
| Abort the state change of the element. More...
StateChangeReturn | continue_state (StateChangeReturn ret)
| Commit the state change of the element and proceed to the next pending state if any. More...
void | lost_state ()
| Brings the element to the lost state. More...
bool | sync_state_with_parent ()
| Tries to change the state of the element to the same as its parent. More...
StateChangeReturn | change_state (StateChange transition)
| Perform transition on element. More...
void | post_message (int code, int line, MessageType type=Gst::MESSAGE_INFO, const Glib::QueryQuark& domain=get_core_error_quark(), const Glib::ustring& text=Glib::ustring(), const Glib::ustring& debug=Glib::ustring(), const Glib::ustring& file=Glib::ustring(), const Glib::ustring& function=Glib::ustring())
| Post an error, warning or info message on the bus from inside an element. More...
bool | post_message (Glib::RefPtr< Gst::Message >&& message)
| Post a message on the element's Gst::Bus. More...
bool | query (const Glib::RefPtr< Gst::Query >& query) const
| Performs a query on the given element. More...
bool | query_convert (Gst::Format src_format, gint64 src_val, Format dest_format, gint64& dest_val) const
| Queries an element to convert src_val in src_format to dest_format. More...
bool | query_position (Gst::Format format, gint64& cur) const
| Queries an element (usually top-level pipeline or playbin element) for the stream position in nanoseconds. More...
bool | query_position (Gst::Format format) const
| A query_position() convenience overload. More...
bool | query_duration (Gst::Format format, gint64& duration) const
| Queries an element (usually top-level pipeline or playbin element) for the total stream duration in nanoseconds. More...
bool | query_duration (Gst::Format format) const
| A query_duration() convenience overload. More...
bool | seek (Format format, SeekFlags seek_flags, gint64 seek_pos)
| Simple API to perform a seek on the given element, meaning it just seeks to the given position relative to the start of the stream. More...
bool | seek (double rate, Format format, SeekFlags flags, SeekType cur_type, gint64 cur, SeekType stop_type, gint64 stop)
| Sends a seek event to an element. More...
bool | send_event (Glib::RefPtr< Gst::Event >&& event)
| Sends an event to an element. More...
bool | send_event (const Glib::RefPtr< Gst::Event >& event)
| A send_event() convenience overload. Allows to re-use event parameter after function call. More...
Glib::RefPtr< Gst::Context > | get_context (const Glib::ustring& context_type)
| Gets the context with context_type set on the element or `nullptr`. More...
Glib::RefPtr< Gst::Context > | get_context_unlocked (const Glib::ustring& context_type)
| Gets the context with context_type set on the element or `nullptr`. More...
std::vector< Glib::RefPtr< Gst::Context > > | get_contexts ()
| Gets the contexts set on the element. More...
Glib::SignalProxy< void > | signal_no_more_pads ()
Glib::SignalProxy< void, const Glib::RefPtr< Gst::Pad >&> | signal_pad_added ()
Glib::SignalProxy< void, const Glib::RefPtr< Gst::Pad >&> | signal_pad_removed ()
virtual void | release_pad_vfunc (const Glib::RefPtr< Gst::Pad >& pad)
| Called when a request pad is to be released. More...
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)
| Called when a new pad is requested. More...
virtual StateChangeReturn | get_state_vfunc (State& state, State& pending, ClockTime timeout) const
| Get the state of the element. More...
virtual StateChangeReturn | set_state_vfunc (State state)
| Set a new state on the element. More...
virtual StateChangeReturn | change_state_vfunc (StateChange transition)
| Called by set_state to perform an incremental state change. More...
virtual void | state_changed_vfunc (Gst::State oldstate, Gst::State newstate, Gst::State pending)
| Called immediately after a new state was set. More...
virtual void | set_bus_vfunc (const Glib::RefPtr< Gst::Bus >& bus)
| Set a Gst::Bus on the element. More...
virtual Glib::RefPtr< Gst::Clock > | provide_clock_vfunc ()
| Gets the Gst::Clock provided by the element. More...
virtual bool | set_clock_vfunc (const Glib::RefPtr< Gst::Clock >& clock)
| Set the Gst::Clock on the element. More...
virtual bool | send_event_vfunc (const Glib::RefPtr< Gst::Event >& event)
| Send a Gst::Event to the element. More...
virtual bool | query_vfunc (const Glib::RefPtr< Gst::Query >&query) const
| Perform a Gst::Query on the element. More...
virtual void | set_context_vfunc (const Glib::RefPtr< Gst::Context >& context)
| Set a Gst::Context on the element. More...
virtual bool | post_message_vfunc (const Glib::RefPtr< Gst::Message >& message)
| Called when a message is posted on the element. More...
Glib::RefPtr< Gst::PadTemplate > | get_pad_template (const Glib::ustring& factory_name) const
template<typename T >
Glib::RefPtr< Gst::Element > | property (const Glib::ustring& name, const T& value)
| Sets specified property. More...
Public Member Functions inherited from Gst::Object
| Object (Object&& src) noexcept
Object& | operator= (Object&& src) noexcept
| ~Object () noexcept override
GstObject* | gobj ()
| Provides access to the underlying C GObject. More...
const GstObject* | gobj () const
| Provides access to the underlying C GObject. More...
GstObject* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
bool | is_element () const
bool | is_element_factory () const
bool | is_pad () const
bool | is_pad_template () const
bool | is_bin () const
guint32 | get_flags () const
| Returns the entire set of flags for the object. More...
bool | set_name (const Glib::ustring& name)
| Sets the name of object, or gives object a guaranteed unique name (if name is `nullptr`). More...
Glib::ustring | get_name () const
| Returns a copy of the name of object. More...
bool | set_parent (const Glib::RefPtr< Gst::Object >& parent)
| Sets the parent of object to parent. More...
Glib::RefPtr< Gst::Object > | get_parent ()
| Returns the parent of object. More...
Glib::RefPtr< const Gst::Object > | get_parent () const
| Returns the parent of object. More...
void | unparent ()
| Clear the parent of object, removing the associated reference. More...
void | set_control_rate (Gst::ClockTime control_rate)
| Change the control-rate for this object. More...
Gst::ClockTime | get_control_rate () const
| Obtain the control-rate for this object. More...
Gst::ClockTime | suggest_next_sync () const
| Returns a suggestion for timestamps where buffers should be split to get best controller results. More...
bool | sync_values (Gst::ClockTime timestamp)
| Sets the properties of the object, according to the Gst::ControlSources that (maybe) handle them and for the given timestamp. More...
void | set_control_bindings_disabled (bool disabled)
| This function is used to disable all controlled properties of the object for some time, i.e. sync_values() will do nothing. More...
bool | has_asctive_control_bindings () const
| Check if the object has an active controlled properties. More...
bool | has_ancestor (const Glib::RefPtr< const Gst::Object >& ancestor) const
| Check if object has an ancestor ancestor somewhere up in the hierarchy. More...
bool | has_as_ancestor (const Glib::RefPtr< Gst::Object >& ancestor) const
| Check if object has an ancestor ancestor somewhere up in the hierarchy. More...
bool | has_as_parent (const Glib::RefPtr< Gst::Object >& parent) const
| Check if parent is the parent of object. More...
Glib::ustring | get_path_string ()
| Generates a string describing the path of object in the object hierarchy. More...
Glib::PropertyProxy< Glib::ustring > | property_name ()
| The name of the object. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_name () const
| The name of the object. More...
Glib::PropertyProxy< Glib::RefPtr< Gst::Object > > | property_parent ()
| The parent of the object. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gst::Object > > | property_parent () const
| The parent of the object. More...
Glib::SignalProxy< void, const Glib::RefPtr< Gst::Object >&, GParamSpec*> | signal_deep_notify ()
int | get_refcount () const
Public Member Functions inherited from Gst::ChildProxy
| ChildProxy (ChildProxy&& src) noexcept
ChildProxy& | operator= (ChildProxy&& src) noexcept
| ~ChildProxy () noexcept override
GstChildProxy* | gobj ()
| Provides access to the underlying C GObject. More...
const GstChildProxy* | gobj () const
| Provides access to the underlying C GObject. More...
guint | get_children_count () const
| Gets the number of child objects this parent contains. More...
Glib::RefPtr< Gst::Object > | get_child (const Glib::ustring& name)
| Looks up a child element by the given name. More...
Glib::RefPtr< const Gst::Object > | get_child (const Glib::ustring& name) const
| Looks up a child element by the given name. More...
Glib::RefPtr< Glib::Object > | get_child (guint index)
| Fetches a child by its number. More...
Glib::RefPtr< const Glib::Object > | get_child (guint index) const
| Fetches a child by its number. More...
bool | lookup (const Glib::ustring& name, Glib::RefPtr< Glib::Object >& target, GParamSpec*& pspec)
| Looks up which object and ParamSpec would be effected by the given name. More...
Glib::RefPtr< Gst::ChildProxy > | get_proxy_property (const Glib::ustring& name, Glib::ValueBase& value)
| Gets a single property using the Gst::ChildProxy mechanism. More...
Glib::RefPtr< const Gst::ChildProxy > | get_proxy_property (const Glib::ustring& name, Glib::ValueBase& value) const
| Gets a single property using the Gst::ChildProxy mechanism. More...
Glib::RefPtr< Gst::ChildProxy > | set_proxy_property (const Glib::ustring& name, const Glib::ValueBase& value)
| Sets a single property using the Gst::ChildProxy mechanism. More...
void | child_added (const Glib::RefPtr< Gst::Object >& child, const Glib::ustring& name)
| Emits the "child-added" signal. More...
void | child_removed (const Glib::RefPtr< Gst::Object >& child, const Glib::ustring& name)
| Emits the "child-removed" signal. More...
Glib::SignalProxy< void, const Glib::RefPtr< Gst::Object >&, const Glib::ustring&> | signal_child_added ()
Glib::SignalProxy< void, const Glib::RefPtr< Gst::Object >&, const Glib::ustring&> | signal_child_removed ()
virtual Glib::RefPtr< Glib::Object > | get_child_by_name_vfunc (const Glib::ustring& name) const
| Virtual method to fetch the child by name. More...
virtual Glib::RefPtr< Glib::Object > | get_child_by_index_vfunc (guint index) const
| Virtual method to fetch the child by index. More...
virtual guint | get_children_count_vfunc () const
| Virtual method to get the children count. More...

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< Bin > | create (const Glib::ustring& name)
| Creates a new bin with the given name. More...
static Glib::RefPtr< Bin > | create ()
| Creates a new bin with a unique generic name. More...
Static Public Member Functions inherited from Gst::Element
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
Static Public Member Functions inherited from Gst::Object
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static bool | check_uniqueness (const Glib::ListHandle< const Gst::Object >& list, const Glib::ustring& name)
| Checks to see if there is any object named name in list. More...
Static Public Member Functions inherited from Gst::ChildProxy
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Member Functions
| Bin (const Glib::ustring& name)
| Bin ()
virtual void | on_element_added (const Glib::RefPtr< Gst::Element >& element)
| This is a default handler for the signal signal_element_added(). More...
virtual void | on_element_removed (const Glib::RefPtr< Gst::Element >& element)
| This is a default handler for the signal signal_element_removed(). More...
virtual bool | on_do_latency ()
| This is a default handler for the signal signal_do_latency(). More...
Protected Member Functions inherited from Gst::Element
virtual void | on_no_more_pads ()
| This is a default handler for the signal signal_no_more_pads(). More...
virtual void | on_pad_added (const Glib::RefPtr< Gst::Pad >& new_pad)
| This is a default handler for the signal signal_pad_added(). More...
virtual void | on_pad_removed (const Glib::RefPtr< Gst::Pad >& old_pad)
| This is a default handler for the signal signal_pad_removed(). More...
Protected Member Functions inherited from Gst::Object
virtual void | on_deep_notify (const Glib::RefPtr< Gst::Object >& prop_object, GParamSpec* prop)
| This is a default handler for the signal signal_deep_notify(). More...
Protected Member Functions inherited from Gst::ChildProxy
| ChildProxy ()
| You should derive from this class to use it. More...
virtual void | on_child_added (const Glib::RefPtr< Gst::Object >& object, const Glib::ustring& name)
| This is a default handler for the signal signal_child_added(). More...
virtual void | on_child_removed (const Glib::RefPtr< Gst::Object >& object, const Glib::ustring& name)
| This is a default handler for the signal signal_child_removed(). More...

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gst::Bin > | wrap (GstBin* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gst::Element
Glib::RefPtr< Gst::Element > | wrap (GstElement* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gst::Object
Glib::RefPtr< Gst::Object > | wrap (GstObject* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gst::ChildProxy
Glib::RefPtr< Gst::ChildProxy > | wrap (GstChildProxy* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

Base class and element that can contain other elements.

Gst::Bin is an element that can contain other Gst::Element, allowing them to be managed as a group. Pads from the child elements can be ghosted to the bin, see Gst::GhostPad. This makes the bin look like any other elements and enables creation of higher-level abstraction elements.

A new Gst::Bin is created with create(). Use a Gst::Pipeline instead if you want to create a toplevel bin because a normal bin doesn't have a bus or handle clock distribution of its own.

After the bin has been created you will typically add elements to it with add(). You can remove elements with remove().

An element can be retrieved from a bin with get_element(), using the elements name. get_element_recurse_up() is mainly used for internal purposes and will query the parent bins when the element is not found in the current bin.

An iterator of elements in a bin can be retrieved with iterate_elements(). Various other iterators exist to retrieve the elements in a bin.

The element-added signal is fired whenever a new element is added to the bin. Likewise the element-removed signal is fired whenever an element is removed from the bin.

Notes:

A Gst::Bin internally intercepts every Gst::Message posted by its children and implements the following default behaviour for each of them:

- Gst::MESSAGE_EOS - This message is only posted by sinks in the PLAYING state. If all sinks posted the EOS message, this bin will post and EOS message upwards.
- Gst::MESSAGE_SEGMENT_START - just collected and never forwarded upwards. The messages are used to decide when all elements have completed playback of their segment.
- Gst::MESSAGE_SEGMENT_DONE - Is posted by Gst::Bin when all elements that posted a SEGMENT_START have posted a SEGMENT_DONE.
- Gst::MESSAGE_DURATION_CHANGED - Is posted by an element that detected a change in the stream duration. The default bin behaviour is to clear any cached duration values so that the next duration query will perform a full duration recalculation. The duration change is posted to the application so that it can refetch the new duration with a duration query. Note that these messages can be posted before the bin is prerolled, in which case the duration query might fail.
- Gst::MESSAGE_CLOCK_LOST - This message is posted by an element when it can no longer provide a clock. The default bin behaviour is to check if the lost clock was the one provided by the bin. If so and the bin is currently in the PLAYING state, the message is forwarded to the bin parent. This message is also generated when a clock provider is removed from the bin. If this message is received by the application, it should PAUSE the pipeline and set it back to PLAYING to force a new clock distribution.
- Gst::MESSAGE_CLOCK_PROVIDE - This message is generated when an element can provide a clock. This mostly happens when a new clock provider is added to the bin. The default behaviour of the bin is to mark the currently selected clock as dirty, which will perform a clock recalculation the next time the bin is asked to provide a clock. This message is never sent tot the application but is forwarded to the parent of the bin.
- OTHERS - posted upwards.

A Gst::Bin implements the following default behaviour for answering to a Gst::Query:

- Gst::QUERY_DURATION - If the query has been asked before with the same format and the bin is a toplevel bin (ie. has no parent), use the cached previous value. If no previous value was cached, the query is sent to all sink elements in the bin and the MAXIMUM of all values is returned. If the bin is a toplevel bin the value is cached. If no sinks are available in the bin, the query fails.
- Gst::QUERY_POSITION - The query is sent to all sink elements in the bin and the MAXIMUM of all values is returned. If no sinks are available in the bin, the query fails.
- OTHERS - the query is forwarded to all sink elements, the result of the first sink that answers the query successfully is returned. If no sink is in the bin, the query fails.

A Gst::Bin will by default forward any event sent to it to all sink elements. If all the sinks return true, the bin will also return true, else false is returned. If no sinks are in the bin, the event handler will return true.

Last reviewed on 2016-05-05 (1.8.0).

## Constructor & Destructor Documentation

## ◆ Bin() [1/3]

Gst::Bin::Bin | ( | Bin&& | src | ) |
| noexcept

## ◆ ~Bin()

Gst::Bin::~Bin | ( |  | ) |
| overridenoexcept

## ◆ Bin() [2/3]

Gst::Bin::Bin | ( | const Glib::ustring & | name | ) |
| explicitprotected

## ◆ Bin() [3/3]

Gst::Bin::Bin | ( |  | ) |
| protected

## Member Function Documentation

## ◆ add()

Glib::RefPtr<Gst::Bin> Gst::Bin::add | ( | const Glib::RefPtr< Gst::Element >& | element | ) |

Adds the given element to the bin.

Sets the element's parent, and thus takes ownership of the element. An element can only be added to one bin.

If the element's pads are linked to other pads, the pads will be unlinked before the element is added to the bin.

When you add an element to an already-running pipeline, you will have to take care to set the state of the newly-added element to the desired state (usually PLAYING or PAUSED, same you set the pipeline to originally) with set_state(), or use sync_state_with_parent(). The bin or pipeline will not take care of this for you.

MT safe.

Parameters

  element | The Gst::Element to add.

Returns
  This Gst::Bin if successful, for chained calls to add().

Exceptions

  std::runtime_error | if the Bin does not want to accept the Element.

## ◆ add_element_vfunc()

virtual bool Gst::Bin::add_element_vfunc | ( | const Glib::RefPtr< Gst::Element >& | element | ) |
| virtual

Method to add an element to a bin.

## ◆ add_ghost_pad()

Glib::RefPtr<Gst::GhostPad> Gst::Bin::add_ghost_pad | ( | const Glib::RefPtr< Gst::Element >& | element,
|  | const Glib::ustring & | pad_name,
|  | const Glib::ustring & | name = `Glib::ustring()`
| ) |  |

Adds a ghost pad to the bin using an element's static pad as a target.

Parameters

  element | The element with the target static pad.
  pad_name | The static pad to use as the target.
  name | An optional name for the ghost pad.

Returns
  The newly created Gst::GhostPad.

## ◆ create() [1/2]

static Glib::RefPtr<Bin> Gst::Bin::create | ( | const Glib::ustring & | name | ) |
| static

Creates a new bin with the given name.

Parameters

  name | The name of the new bin.

Returns
  A new Gst::Bin.

## ◆ create() [2/2]

static Glib::RefPtr<Bin> Gst::Bin::create | ( |  | ) |
| static

Creates a new bin with a unique generic name.

Returns
  A new Gst::Bin.

Examples:
  basics/bin.cc.

## ◆ find_unlinked_pad() [1/2]

Glib::RefPtr<Gst::Pad> Gst::Bin::find_unlinked_pad | ( | PadDirection | dir | ) |

Recursively looks for elements with an unlinked pad of the given direction within the specified bin and returns an unlinked pad if one is found, or `nullptr` otherwise.

If a pad is found, the caller owns a reference to it and should use Gst::Object::unref() on the pad when it is not needed any longer.

Parameters

  dir | Whether to look for an unlinked source or sink pad.

Returns
  Unlinked pad of the given direction, `nullptr`.

## ◆ find_unlinked_pad() [2/2]

Glib::RefPtr<const Gst::Pad> Gst::Bin::find_unlinked_pad | ( | PadDirection | dir | ) | const

Recursively looks for elements with an unlinked pad of the given direction within the specified bin and returns an unlinked pad if one is found, or `nullptr` otherwise.

If a pad is found, the caller owns a reference to it and should use Gst::Object::unref() on the pad when it is not needed any longer.

Parameters

  dir | Whether to look for an unlinked source or sink pad.

Returns
  Unlinked pad of the given direction, `nullptr`.

## ◆ get_child_bus() [1/2]

Glib::RefPtr<Gst::Bus> Gst::Bin::get_child_bus | ( |  | ) |

Gets the internal bus for handling child messages.

## ◆ get_child_bus() [2/2]

Glib::RefPtr<const Gst::Bus> Gst::Bin::get_child_bus | ( |  | ) | const

## ◆ get_children()

Glib::ListHandle< Glib::RefPtr<Gst::Element> > Gst::Bin::get_children | ( |  | ) | const

Gets the bin's list of children.

## ◆ get_children_cookie()

guint32 Gst::Bin::get_children_cookie | ( |  | ) | const

Gets the children cookie.

## ◆ get_clock_dirty()

bool Gst::Bin::get_clock_dirty | ( |  | ) | const

Gets whether the bin needs to select a new clock.

## ◆ get_clock_provider() [1/2]

Glib::RefPtr<Gst::Element> Gst::Bin::get_clock_provider | ( |  | ) |

Gets the element that provided provided_clock.

## ◆ get_clock_provider() [2/2]

Glib::RefPtr<const Gst::Element> Gst::Bin::get_clock_provider | ( |  | ) | const

## ◆ get_element() [1/4]

Glib::RefPtr<Gst::Element> Gst::Bin::get_element | ( | const Glib::ustring & | name | ) |

Gets the element with the given name from a bin.

This function recurses into child bins.

Parameters

  name | The element name to search for.

Returns
  The Gst::Element with the given name, or `nullptr`.

## ◆ get_element() [2/4]

Glib::RefPtr<const Gst::Element> Gst::Bin::get_element | ( | const Glib::ustring & | name | ) | const

Gets the element with the given name from a bin.

This function recurses into child bins.

Parameters

  name | The element name to search for.

Returns
  The Gst::Element with the given name, or `nullptr`.

## ◆ get_element() [3/4]

Glib::RefPtr<Gst::Element> Gst::Bin::get_element | ( | GType | interface | ) |

Looks for an element inside the bin that implements the given interface.

If such an element is found, it returns the element. You can cast this element to the given interface afterwards. If you want all elements that implement the interface, use iterate_all_by_interface(). This function recurses into child bins.

MT safe. Caller owns returned reference.

Parameters

  interface | The Type of an interface.

Returns
  A Gst::Element inside the bin implementing the interface.

## ◆ get_element() [4/4]

Glib::RefPtr<const Gst::Element> Gst::Bin::get_element | ( | GType | interface | ) | const

Looks for an element inside the bin that implements the given interface.

If such an element is found, it returns the element. You can cast this element to the given interface afterwards. If you want all elements that implement the interface, use iterate_all_by_interface(). This function recurses into child bins.

MT safe. Caller owns returned reference.

Parameters

  interface | The Type of an interface.

Returns
  A Gst::Element inside the bin implementing the interface.

## ◆ get_element_recurse_up() [1/2]

Glib::RefPtr<Gst::Element> Gst::Bin::get_element_recurse_up | ( | const Glib::ustring & | name | ) |

Gets the element with the given name from this bin.

If the element is not found, a recursion is performed on the parent bin.

Parameters

  name | The element name to search for.

Returns
  The Gst::Element with the given name, or `nullptr`.

## ◆ get_element_recurse_up() [2/2]

Glib::RefPtr<const Gst::Element> Gst::Bin::get_element_recurse_up | ( | const Glib::ustring & | name | ) | const

Gets the element with the given name from this bin.

If the element is not found, a recursion is performed on the parent bin.

Parameters

  name | The element name to search for.

Returns
  The Gst::Element with the given name, or `nullptr`.

## ◆ get_messages()

Glib::ListHandle< Glib::RefPtr<Gst::Message> > Gst::Bin::get_messages | ( |  | ) | const

Gets the bin's queued and cached messages.

## ◆ get_num_children()

int Gst::Bin::get_num_children | ( |  | ) | const

Gets the number of children in the bin.

## ◆ get_polling()

bool Gst::Bin::get_polling | ( |  | ) | const

Gets whether the bin is currently calculating its state.

## ◆ get_provided_clock() [1/2]

Glib::RefPtr<Gst::Clock> Gst::Bin::get_provided_clock | ( |  | ) |

Gets the last clock selected.

## ◆ get_provided_clock() [2/2]

Glib::RefPtr<const Gst::Clock> Gst::Bin::get_provided_clock | ( |  | ) | const

## ◆ get_type()

static GType Gst::Bin::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GstBin* Gst::Bin::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GstBin* Gst::Bin::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GstBin* Gst::Bin::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ handle_message_vfunc()

virtual void Gst::Bin::handle_message_vfunc | ( | const Glib::RefPtr< Gst::Message >& | message | ) |
| virtual

Method to handle a message from the children.

## ◆ iterate_by_interface() [1/2]

Gst::Iterator<Gst::Element> Gst::Bin::iterate_by_interface | ( | GType | iface | ) |

Looks for all elements inside the bin that implements the given interface.

You can safely cast all returned elements to the given interface. The function recurses inside child bins. The iterator will yield a series of Gst::Element that should be unreffed after use.

MT safe. Caller owns returned value.

Parameters

  iface | The Type of an interface.

Returns
  A Gst::Iterator of Gst::Element for all elements in the bin implementing the given interface, or `nullptr`.

## ◆ iterate_by_interface() [2/2]

Gst::Iterator<const Gst::Element> Gst::Bin::iterate_by_interface | ( | GType | iface | ) | const

Looks for all elements inside the bin that implements the given interface.

You can safely cast all returned elements to the given interface. The function recurses inside child bins. The iterator will yield a series of Gst::Element that should be unreffed after use.

MT safe. Caller owns returned value.

Parameters

  iface | The Type of an interface.

Returns
  A Gst::Iterator of Gst::Element for all elements in the bin implementing the given interface, or `nullptr`.

## ◆ iterate_elements() [1/2]

Gst::Iterator<Gst::Element> Gst::Bin::iterate_elements | ( |  | ) |

Gets an iterator for the elements in this bin.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ iterate_elements() [2/2]

Gst::Iterator<const Gst::Element> Gst::Bin::iterate_elements | ( |  | ) | const

Gets an iterator for the elements in this bin.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ iterate_recurse() [1/2]

Gst::Iterator<Gst::Element> Gst::Bin::iterate_recurse | ( |  | ) |

Gets an iterator for the elements in this bin.

This iterator recurses into GstBin children.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ iterate_recurse() [2/2]

Gst::Iterator<const Gst::Element> Gst::Bin::iterate_recurse | ( |  | ) | const

Gets an iterator for the elements in this bin.

This iterator recurses into GstBin children.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ iterate_sinks() [1/2]

Gst::Iterator<Gst::Element> Gst::Bin::iterate_sinks | ( |  | ) |

Gets an iterator for all elements in the bin that have the Gst::ELEMENT_FLAG_SINK flag set.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ iterate_sinks() [2/2]

Gst::Iterator<const Gst::Element> Gst::Bin::iterate_sinks | ( |  | ) | const

Gets an iterator for all elements in the bin that have the Gst::ELEMENT_FLAG_SINK flag set.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ iterate_sorted() [1/2]

Gst::Iterator<Gst::Element> Gst::Bin::iterate_sorted | ( |  | ) |

Gets an iterator for the elements in this bin in topologically sorted order.

This means that the elements are returned from the most downstream elements (sinks) to the sources.

This function is used internally to perform the state changes of the bin elements and for clock selection.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ iterate_sorted() [2/2]

Gst::Iterator<const Gst::Element> Gst::Bin::iterate_sorted | ( |  | ) | const

Gets an iterator for the elements in this bin in topologically sorted order.

This means that the elements are returned from the most downstream elements (sinks) to the sources.

This function is used internally to perform the state changes of the bin elements and for clock selection.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ iterate_sources() [1/2]

Gst::Iterator<Gst::Element> Gst::Bin::iterate_sources | ( |  | ) |

Gets an iterator for all elements in the bin that have the Gst::ELEMENT_FLAG_SOURCE flag set.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ iterate_sources() [2/2]

Gst::Iterator<const Gst::Element> Gst::Bin::iterate_sources | ( |  | ) | const

Gets an iterator for all elements in the bin that have the Gst::ELEMENT_FLAG_SOURCE flag set.

MT safe. Caller owns returned value.

Returns
  A Gst::Iterator of Gst::Element, or `nullptr`.

## ◆ on_do_latency()

virtual bool Gst::Bin::on_do_latency | ( |  | ) |
| protectedvirtual

This is a default handler for the signal signal_do_latency().

## ◆ on_element_added()

virtual void Gst::Bin::on_element_added | ( | const Glib::RefPtr< Gst::Element >& | element | ) |
| protectedvirtual

This is a default handler for the signal signal_element_added().

## ◆ on_element_removed()

virtual void Gst::Bin::on_element_removed | ( | const Glib::RefPtr< Gst::Element >& | element | ) |
| protectedvirtual

This is a default handler for the signal signal_element_removed().

## ◆ operator=()

Bin& Gst::Bin::operator= | ( | Bin&& | src | ) |
| noexcept

## ◆ property_async_handling() [1/2]

Glib::PropertyProxy< bool > Gst::Bin::property_async_handling | ( |  | ) |

The bin will handle Asynchronous state changes.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_async_handling() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gst::Bin::property_async_handling | ( |  | ) | const

The bin will handle Asynchronous state changes.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_message_forward() [1/2]

Glib::PropertyProxy< bool > Gst::Bin::property_message_forward | ( |  | ) |

Forwards all children messages.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_message_forward() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gst::Bin::property_message_forward | ( |  | ) | const

Forwards all children messages.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ recalculate_latency()

bool Gst::Bin::recalculate_latency | ( |  | ) |

Query bin for the current latency using and reconfigures this latency to all the elements with a LATENCY event.

This method is typically called on the pipeline when a Gst::MESSAGE_LATENCY is posted on the bus.

This function simply emits the 'do-latency' signal so any custom latency calculations will be performed.

Returns
  `true` if the latency could be queried and reconfigured.

## ◆ remove()

Glib::RefPtr<Gst::Bin> Gst::Bin::remove | ( | const Glib::RefPtr< Gst::Element >& | element | ) |

Removes the element from the bin, unparenting it as well.

Unparenting the element means that the element will be dereferenced, so if the bin holds the only reference to the element, the element will be freed in the process of removing it from the bin.

If the element's pads are linked to other pads, the pads will be unlinked before the element is removed from the bin.

MT safe.

Parameters

  element | the Gst::Element to remove

Returns
  this Gst::Bin if successful, for chained calls to remove().

Exceptions

  std::runtime_error | if the Bin does not want to remove the Element.

## ◆ remove_element_vfunc()

virtual bool Gst::Bin::remove_element_vfunc | ( | const Glib::RefPtr< Gst::Element >& | element | ) |
| virtual

Method to remove an element from a bin.

## ◆ signal_do_latency()

Glib::SignalProxy< bool > Gst::Bin::signal_do_latency | ( |  | ) |

Slot Prototype:
  `bool on_my_do_latency()`

Will be emitted when the bin needs to perform latency calculations. This signal is only emitted for toplevel bins or when async-handling is enabled.

Only one signal handler is invoked. If no signals are connected, the default handler is invoked, which will query and distribute the lowest possible latency to all sinks.

Connect to this signal if the default latency calculations are not sufficient, like when you need different latencies for different sinks in the same pipeline.

## ◆ signal_element_added()

Glib::SignalProxy< void,const Glib::RefPtr<Gst::Element>& > Gst::Bin::signal_element_added | ( |  | ) |

Slot Prototype:
  `void on_my_element_added(const Glib::RefPtr<Gst::Element>& element)`

Will be emitted after the element was added to the bin.

Parameters

  element | The Gst::Element that was added to the bin.

## ◆ signal_element_removed()

Glib::SignalProxy< void,const Glib::RefPtr<Gst::Element>& > Gst::Bin::signal_element_removed | ( |  | ) |

Slot Prototype:
  `void on_my_element_removed(const Glib::RefPtr<Gst::Element>& element)`

Will be emitted after the element was removed from the bin.

Parameters

  element | The Gst::Element that was removed from the bin.

## ◆ sync_children_states()

bool Gst::Bin::sync_children_states | ( |  | ) |

Synchronizes the state of every child of bin with the state of bin.

See also Gst::Element::sync_state_with_parent().

Returns
  `true` if syncing the state was successful for all children, otherwise `false`.

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gst::Bin > wrap | ( | GstBin * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.