Class: Gst::Bin
- Includes:
- Enumerable
- Defined in:
- lib/gst/bin.rb
Overview
Subclasses can override Gst::BinClass::add_element and #GstBinClass::remove_element to update the list of children in the bin.
The Gst::BinClass::handle_message method can be overridden to implement custom message handling.
Gst::BinClass::deep_element_added will be called when a new element has been added to any bin inside this bin, so it will also be called if a new child was added to a sub-bin of this bin. Gst::Bin implementations that override this message should chain up to the parent class implementation so the Gst::Bin::deep-element-added signal is emitted on all parents.
Direct Known Subclasses
Instance Method Summary collapse
- #<<(element) ⇒ Object
- #add_elements(*elements) ⇒ Object (also: #add)
-
#add_many(element_1, array) ⇒ nil
Adds a nil-terminated list of elements to a bin.
-
#async_handling=(async_handling) ⇒ Boolean
If set to true, the bin will handle asynchronous state changes.
-
#async_handling? ⇒ Boolean
If set to true, the bin will handle asynchronous state changes.
- #each(options = {}) ⇒ Object
-
#find_unlinked_pad(direction) ⇒ Gst::Pad
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 nil otherwise.
-
#get_by_interface(iface) ⇒ Gst::Element
Looks for an element inside the bin that implements the given interface.
-
#get_by_name(name) ⇒ Gst::Element
Gets the element with the given name from a bin.
-
#get_by_name_recurse_up(name) ⇒ Gst::Element
Gets the element with the given name from this bin.
-
#initialize(name) ⇒ Gst::Element
constructor
Creates a new bin with the given name.
-
#iterate_all_by_element_factory_name(factory_name) ⇒ Gst::Iterator
Looks for all elements inside the bin with the given element factory name.
-
#iterate_all_by_interface(iface) ⇒ Gst::Iterator
Looks for all elements inside the bin that implements the given interface.
-
#iterate_elements ⇒ Gst::Iterator
Gets an iterator for the elements in this bin.
-
#iterate_recurse ⇒ Gst::Iterator
Gets an iterator for the elements in this bin.
-
#iterate_sinks ⇒ Gst::Iterator
Gets an iterator for all elements in the bin that have the #GST_ELEMENT_FLAG_SINK flag set.
-
#iterate_sorted ⇒ Gst::Iterator
Gets an iterator for the elements in this bin in topologically sorted order.
-
#iterate_sources ⇒ Gst::Iterator
Gets an iterator for all elements in the bin that have the #GST_ELEMENT_FLAG_SOURCE flag set.
-
#message_forward=(message_forward) ⇒ Boolean
Forward all children messages, even those that would normally be filtered by the bin.
-
#message_forward? ⇒ Boolean
Forward all children messages, even those that would normally be filtered by the bin.
-
#recalculate_latency ⇒ Boolean
Queries bin for the current latency and reconfigures this latency on all the elements using a LATENCY event.
-
#remove(element) ⇒ Boolean
Removes the element from the bin, unparenting it as well.
-
#remove_many(element_1, array) ⇒ nil
Removes a list of elements from a bin.
-
#suppressed_flags ⇒ Gst::ElementFlags
The bin's suppressed Gst::ElementFlags.
-
#suppressed_flags=(flags) ⇒ nil
Suppresses the given flags on the bin.
-
#sync_children_states ⇒ Boolean
Synchronizes the state of every child of bin with the state of bin.
Methods inherited from Element
#>>, [], #abort_state, #add_metadata, #add_pad, #add_pad_template, #add_property_deep_notify_watch, #add_property_notify_watch, #add_static_metadata, #add_static_pad_template, #add_static_pad_template_with_gtype, #base_time, #base_time=, #bus, #bus=, #call_async, #change_state, #clock, #clock=, #context=, #contexts, #continue_state, #create_all_pads, #current_clock_time, #current_running_time, #decorate_stream_id, #decorate_stream_id_printf, #decorate_stream_id_printf_valist, #factory, #flags, #flags_raw, #foreach_pad, #foreach_sink_pad, #foreach_src_pad, #get_compatible_pad, #get_compatible_pad_template, #get_context, #get_context_unlocked, #get_metadata, #get_pad_template, #get_request_pad, #get_state, #get_static_pad, #is_locked_state, #iterate_pads, #iterate_sink_pads, #iterate_src_pads, #link_elements, #link_filtered, #link_many, #link_pads, #link_pads_filtered, #link_pads_full, #locked_state=, #lost_state, make_from_uri, #message_full, #message_full_with_details, #no_more_pads, #pad_template_list, #pause, #play, #post_message, #provide_clock, #query, #query_convert, #query_duration, #query_position, #ready, register, #release_request_pad, #remove_pad, #remove_property_notify_watch, #request_pad, #request_pad_simple, #seek, #seek_simple, #send_event, #set_metadata, #set_static_metadata, #start_time, #start_time=, #state=, state_change_return_get_name, state_get_name, #stop, #sync_state_with_parent, type_set_skip_documentation, #unlink, #unlink_many, #unlink_pads
Methods inherited from Object
#add_control_binding, check_uniqueness, #control_bindings_disabled=, #control_rate, #control_rate=, default_deep_notify, #default_error, #get_control_binding, #get_g_value_array, #get_value, #get_value_array, #has_active_control_bindings, #has_ancestor, #has_as_ancestor, #has_as_parent, #name, #name=, #parent, #parent=, #path_string, #ref, ref_sink, #remove_control_binding, replace, #set_control_binding_disabled, #suggest_next_sync, #sync_values, #unparent, #unref
Constructor Details
#initialize(name) ⇒ Gst::Element
Creates a new bin with the given name.
Instance Method Details
#<<(element) ⇒ Object
29 30 31 32 |
# File 'lib/gst/bin.rb', line 29 def <<(element) add_element(element) self end |
#add_elements(*elements) ⇒ Object Also known as: add
22 23 24 25 26 |
# File 'lib/gst/bin.rb', line 22 def add_elements(*elements) elements.each do |element| add_element(element) end end |
#add_many(element_1, array) ⇒ nil
Adds a nil-terminated list of elements to a bin. This function is equivalent to calling gst_bin_add() for each member of the list. The return value of each gst_bin_add() is ignored.
#async_handling=(async_handling) ⇒ Boolean
If set to true, the bin will handle asynchronous state changes. This should be used only if the bin subclass is modifying the state of its children on its own.
#async_handling? ⇒ Boolean
If set to true, the bin will handle asynchronous state changes. This should be used only if the bin subclass is modifying the state of its children on its own.
#each(options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/gst/bin.rb', line 34 def each(={}) return to_enum(:each, ) unless block_given? if [:recurse] iterator = iterate_recurse elsif [:sink] iterator = iterate_sinks elsif [:sorted] iterator = iterate_sorted elsif [:sources] iterator = iterate_sources elsif [:interface] iterator = iterate_all_by_interface([:interface]) else iterator = iterate_elements end loop do result, element = iterator.next case result when IteratorResult::DONE break when IteratorResult::OK yield(element.value) when IteratorResult::RESYNC iterator.resync when IteratorResult::ERROR raise "failed to iterate" end end end |
#find_unlinked_pad(direction) ⇒ Gst::Pad
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 nil 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. direction.
#get_by_interface(iface) ⇒ Gst::Element
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 gst_bin_iterate_all_by_interface(). This function recurses into child bins. implementing the interface
#get_by_name(name) ⇒ Gst::Element
Gets the element with the given name from a bin. This function recurses into child bins. name
#get_by_name_recurse_up(name) ⇒ Gst::Element
Gets the element with the given name from this bin. If the element is not found, a recursion is performed on the parent bin. name
#iterate_all_by_element_factory_name(factory_name) ⇒ Gst::Iterator
Looks for all elements inside the bin with the given element factory name. The function recurses inside child bins. The iterator will yield a series of Gst::Element.
#iterate_all_by_interface(iface) ⇒ Gst::Iterator
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.
#iterate_elements ⇒ Gst::Iterator
Gets an iterator for the elements in this bin.
#iterate_recurse ⇒ Gst::Iterator
Gets an iterator for the elements in this bin. This iterator recurses into GstBin children.
#iterate_sinks ⇒ Gst::Iterator
Gets an iterator for all elements in the bin that have the #GST_ELEMENT_FLAG_SINK flag set.
#iterate_sorted ⇒ Gst::Iterator
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.
#iterate_sources ⇒ Gst::Iterator
Gets an iterator for all elements in the bin that have the #GST_ELEMENT_FLAG_SOURCE flag set.
#message_forward=(message_forward) ⇒ Boolean
Forward all children messages, even those that would normally be filtered by the bin. This can be interesting when one wants to be notified of the EOS state of individual elements, for example.
The messages are converted to an ELEMENT message with the bin as the
source. The structure of the message is named GstBinForwarded and contains
a field named message that contains the original forwarded Gst::Message.
#message_forward? ⇒ Boolean
Forward all children messages, even those that would normally be filtered by the bin. This can be interesting when one wants to be notified of the EOS state of individual elements, for example.
The messages are converted to an ELEMENT message with the bin as the
source. The structure of the message is named GstBinForwarded and contains
a field named message that contains the original forwarded Gst::Message.
#recalculate_latency ⇒ Boolean
Queries bin for the current latency and reconfigures this latency on all the elements using 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 Gst::Bin::do-latency signal so any custom latency calculations will be performed.
#remove(element) ⇒ Boolean
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 you want the element to still exist after removing, you need to call gst_object_ref() before 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. the bin does not want to remove the element.
#remove_many(element_1, array) ⇒ nil
Removes a list of elements from a bin. This function is equivalent to calling gst_bin_remove() with each member of the list.
#suppressed_flags ⇒ Gst::ElementFlags
Returns the bin's suppressed Gst::ElementFlags.
#suppressed_flags=(flags) ⇒ nil
Suppresses the given flags on the bin. Gst::ElementFlags of a child element are propagated when it is added to the bin. When suppressed flags are set, those specified flags will not be propagated to the bin.
#sync_children_states ⇒ Boolean
Synchronizes the state of every child of bin with the state of bin. See also gst_element_sync_state_with_parent().