Class: Gst::Element
- Defined in:
- lib/gst/element.rb
Overview
GStreamer element class. Override the vmethods to implement the element functionality.
Direct Known Subclasses
Bin, GstAudio::AudioDecoder, GstAudio::AudioEncoder, GstBase::Aggregator, GstBase::BaseParse, GstBase::BaseSink, GstBase::BaseSrc, GstBase::BaseTransform
Class Method Summary collapse
- .[](name) ⇒ Object
-
.make_from_uri(type, uri, elementname) ⇒ Gst::Element
Creates an element for handling the given URI.
-
.register(plugin, name, rank, type) ⇒ Boolean
Create a new elementfactory capable of instantiating objects of the type and add the factory to plugin.
-
.state_change_return_get_name(state_ret) ⇒ String
Gets a string representing the given state change result.
-
.state_get_name(state) ⇒ String
Gets a string representing the given state.
-
.type_set_skip_documentation(type) ⇒ nil
Marks type as "documentation should be skipped".
Instance Method Summary collapse
- #>>(element) ⇒ Object
-
#abort_state ⇒ nil
Abort the state change of the element.
-
#add_metadata(key, value) ⇒ nil
Set key with value as metadata in klass.
-
#add_pad(pad) ⇒ Boolean
Adds a pad (link point) to element.
-
#add_pad_template(templ) ⇒ nil
Adds a padtemplate to an element class.
-
#add_property_deep_notify_watch(property_name, include_value) ⇒ Gst::gulong
A watch id, which can be used in connection with gst_element_remove_property_notify_watch() to remove the watch again.
-
#add_property_notify_watch(property_name, include_value) ⇒ Gst::gulong
A watch id, which can be used in connection with gst_element_remove_property_notify_watch() to remove the watch again.
-
#add_static_metadata(key, value) ⇒ nil
Set key with value as metadata in klass.
-
#add_static_pad_template(static_templ) ⇒ nil
Adds a pad template to an element class based on the static pad template templ.
-
#add_static_pad_template_with_gtype(static_templ, pad_type) ⇒ nil
Adds a pad template to an element class based on the static pad template templ.
-
#base_time ⇒ Gst::ClockTime
Returns the base time of the element.
-
#base_time=(time) ⇒ nil
Set the base time of an element.
-
#bus ⇒ Gst::Bus
Returns the bus of the element.
-
#bus=(bus) ⇒ nil
Sets the bus of the element.
-
#call_async(func, user_data, destroy_notify) ⇒ nil
Calls func from another thread and passes user_data to it.
-
#change_state(transition) ⇒ Gst::StateChangeReturn
Perform transition on element.
-
#clock ⇒ Gst::Clock
Gets the currently configured clock of the element.
-
#clock=(clock) ⇒ Boolean
Sets the clock for the element.
-
#context=(context) ⇒ nil
Sets the context of the element.
-
#contexts ⇒ GLib::List<Gst::Context>
Gets the contexts set on the element.
-
#continue_state(ret) ⇒ Gst::StateChangeReturn
Commit the state change of the element and proceed to the next pending state if any.
-
#create_all_pads ⇒ nil
Creates a pad for each pad template that is always available.
-
#current_clock_time ⇒ Gst::ClockTime
Returns the current clock time of the element, as in, the time of the element's clock, or GST_CLOCK_TIME_NONE if there is no clock.
-
#current_running_time ⇒ Gst::ClockTime
Returns the running time of the element.
-
#decorate_stream_id(stream_id) ⇒ String
Creates a stream-id for element by combining the upstream information with the stream_id.
-
#decorate_stream_id_printf(format, array) ⇒ String
Creates a stream-id for element by combining the upstream information with the format.
-
#decorate_stream_id_printf_valist(format, var_args) ⇒ String
Creates a stream-id for element by combining the upstream information with the format.
-
#factory ⇒ Gst::ElementFactory
Retrieves the factory that was used to create this element.
- #flags ⇒ Object
- #flags_raw ⇒ Object
-
#foreach_pad(func, user_data) ⇒ Boolean
Call func with user_data for each of element's pads.
-
#foreach_sink_pad(func, user_data) ⇒ Boolean
Call func with user_data for each of element's sink pads.
-
#foreach_src_pad(func, user_data) ⇒ Boolean
Call func with user_data for each of element's source pads.
-
#get_compatible_pad(pad, caps) ⇒ Gst::Pad
Looks for an unlinked pad to which the given pad can link.
-
#get_compatible_pad_template(compattempl) ⇒ Gst::PadTemplate
Retrieves a pad template from element that is compatible with compattempl.
-
#get_context(context_type) ⇒ Gst::Context
Gets the context with context_type set on the element or NULL.
-
#get_context_unlocked(context_type) ⇒ Gst::Context
Gets the context with context_type set on the element or NULL.
-
#get_metadata(key) ⇒ String
Get metadata with key in klass.
-
#get_pad_template(name) ⇒ Gst::PadTemplate
Retrieves a padtemplate from element_class with the given name.
-
#get_request_pad(name) ⇒ Gst::Pad
The name of this function is confusing to people learning GStreamer.
-
#get_state(state, pending, timeout) ⇒ Gst::StateChangeReturn
Gets the state of the element.
-
#get_static_pad(name) ⇒ Gst::Pad
Retrieves a pad from element by name.
-
#is_locked_state ⇒ Boolean
Checks if the state of an element is locked.
-
#iterate_pads ⇒ Gst::Iterator
Retrieves an iterator of element's pads.
-
#iterate_sink_pads ⇒ Gst::Iterator
Retrieves an iterator of element's sink pads.
-
#iterate_src_pads ⇒ Gst::Iterator
Retrieves an iterator of element's source pads.
- #link_elements(*elements) ⇒ Object (also: #link)
-
#link_filtered(dest, filter) ⇒ Boolean
Links src to dest using the given caps as filtercaps.
-
#link_many(element_2, array) ⇒ Boolean
Chain together a series of elements.
-
#link_pads(srcpadname, dest, destpadname) ⇒ Boolean
Links the two named pads of the source and destination elements.
-
#link_pads_filtered(srcpadname, dest, destpadname, filter) ⇒ Boolean
Links the two named pads of the source and destination elements.
-
#link_pads_full(srcpadname, dest, destpadname, flags) ⇒ Boolean
Links the two named pads of the source and destination elements.
-
#locked_state=(locked_state) ⇒ Boolean
Locks the state of an element, so state changes of the parent don't affect this element anymore.
-
#lost_state ⇒ nil
Brings the element to the lost state.
-
#message_full(type, domain, code, text, debug, file, function, line) ⇒ nil
Post an error, warning or info message on the bus from inside an element.
-
#message_full_with_details(type, domain, code, text, debug, file, function, line, structure) ⇒ nil
Post an error, warning or info message on the bus from inside an element.
-
#no_more_pads ⇒ nil
Use this function to signal that the element does not expect any more pads to show up in the current pipeline.
-
#pad_template_list ⇒ GLib::List<Gst::PadTemplate>
Retrieves a list of the pad templates associated with element_class.
- #pause ⇒ Object
- #play ⇒ Object
-
#post_message(message) ⇒ Boolean
Post a message on the element's Gst::Bus.
-
#provide_clock ⇒ Gst::Clock
Get the clock provided by the given element.
-
#query(query) ⇒ Boolean
Performs a query on the given element.
-
#query_convert(src_format, src_val, dest_format, dest_val) ⇒ Boolean
Queries an element to convert src_val in src_format to dest_format.
-
#query_duration(format, duration) ⇒ Boolean
Queries an element (usually top-level pipeline or playbin element) for the total stream duration in nanoseconds.
-
#query_position(format, cur) ⇒ Boolean
Queries an element (usually top-level pipeline or playbin element) for the stream position in nanoseconds.
- #ready ⇒ Object
-
#release_request_pad(pad) ⇒ nil
Makes the element free the previously requested pad as obtained with gst_element_request_pad().
-
#remove_pad(pad) ⇒ Boolean
Removes pad from element.
- #remove_property_notify_watch(watch_id) ⇒ nil
-
#request_pad(templ, name, caps) ⇒ Gst::Pad
Retrieves a request pad from the element according to the provided template.
-
#request_pad_simple(name) ⇒ Gst::Pad
Retrieves a pad from the element by name (e.g. "src_%d").
-
#seek(rate, format, flags, start_type, start, stop_type, stop) ⇒ Boolean
Sends a seek event to an element.
-
#seek_simple(format, seek_flags, seek_pos) ⇒ Boolean
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.
-
#send_event(event) ⇒ Boolean
Sends an event to an element.
-
#set_metadata(longname, classification, description, author) ⇒ nil
Sets the detailed information for a Gst::ElementClass.
-
#set_static_metadata(longname, classification, description, author) ⇒ nil
Sets the detailed information for a Gst::ElementClass.
-
#start_time ⇒ Gst::ClockTime
Returns the start time of the element.
-
#start_time=(time) ⇒ nil
Set the start time of an element.
-
#state=(state) ⇒ Gst::StateChangeReturn
Sets the state of the element.
- #stop ⇒ Object
-
#sync_state_with_parent ⇒ Boolean
Tries to change the state of the element to the same as its parent.
-
#unlink(dest) ⇒ nil
Unlinks all source pads of the source element with all sink pads of the sink element to which they are linked.
-
#unlink_many(element_2, array) ⇒ nil
Unlinks a series of elements.
-
#unlink_pads(srcpadname, dest, destpadname) ⇒ nil
Unlinks the two named pads of the source and destination elements.
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
Class Method Details
.[](name) ⇒ Object
20 21 22 |
# File 'lib/gst/element.rb', line 20 def [](name) ElementFactory.make(name) end |
.make_from_uri(type, uri, elementname) ⇒ Gst::Element
Creates an element for handling the given URI. could be created
.register(plugin, name, rank, type) ⇒ Boolean
Create a new elementfactory capable of instantiating objects of the type and add the factory to plugin.
.state_change_return_get_name(state_ret) ⇒ String
Gets a string representing the given state change result.
.state_get_name(state) ⇒ String
Gets a string representing the given state.
.type_set_skip_documentation(type) ⇒ nil
Marks type as "documentation should be skipped". Can be useful for dynamically registered element to be excluded from plugin documentation system.
Example:
GType my_type;
GTypeInfo my_type_info;
// Fill "my_type_info"
...
my_type = g_type_register_static (GST_TYPE_MY_ELEMENT, "my-type-name",
&my_type_info, 0);
gst_element_type_set_skip_documentation (my_type);
gst_element_register (plugin, "my-plugin-feature-name", rank, my_type);
Instance Method Details
#>>(element) ⇒ Object
49 50 51 52 |
# File 'lib/gst/element.rb', line 49 def >>(element) link_element(element) element end |
#abort_state ⇒ nil
Abort the state change of the element. This function is used by elements that do asynchronous state changes and find out something is wrong.
This function should be called with the STATE_LOCK held.
MT safe.
#add_metadata(key, value) ⇒ nil
Set key with value as metadata in klass.
#add_pad(pad) ⇒ Boolean
Adds a pad (link point) to element. pad's parent will be set to element; see gst_object_set_parent() for refcounting information.
Pads are automatically activated when added in the PAUSED or PLAYING state.
The pad and the element should be unlocked when calling this function.
This function will emit the Gst::Element::pad-added signal on the element. a pad with the same name already existed or the pad already had another parent.
MT safe.
#add_pad_template(templ) ⇒ nil
Adds a padtemplate to an element class. This is mainly used in the _class_init functions of classes. If a pad template with the same name as an already existing one is added the old one is replaced by the new one.
templ's reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink())
#add_property_deep_notify_watch(property_name, include_value) ⇒ Gst::gulong
Returns a watch id, which can be used in connection with gst_element_remove_property_notify_watch() to remove the watch again.
#add_property_notify_watch(property_name, include_value) ⇒ Gst::gulong
Returns a watch id, which can be used in connection with gst_element_remove_property_notify_watch() to remove the watch again.
#add_static_metadata(key, value) ⇒ nil
Set key with value as metadata in klass.
Same as gst_element_class_add_metadata(), but value must be a static string or an inlined string, as it will not be copied. (GStreamer plugins will be made resident once loaded, so this function can be used even from dynamically loaded plugins.)
#add_static_pad_template(static_templ) ⇒ nil
Adds a pad template to an element class based on the static pad template templ. This is mainly used in the _class_init functions of element implementations. If a pad template with the same name already exists, the old one is replaced by the new one.
#add_static_pad_template_with_gtype(static_templ, pad_type) ⇒ nil
Adds a pad template to an element class based on the static pad template templ. This is mainly used in the _class_init functions of element implementations. If a pad template with the same name already exists, the old one is replaced by the new one.
#base_time ⇒ Gst::ClockTime
Returns the base time of the element. The base time is the absolute time of the clock when this element was last put to PLAYING. Subtracting the base time from the clock time gives the running time of the element. MT safe.
#base_time=(time) ⇒ nil
Set the base time of an element. See gst_element_get_base_time().
MT safe.
#bus ⇒ Gst::Bus
Returns the bus of the element. Note that only a Gst::Pipeline will provide a bus for the application. usage.
MT safe.
#bus=(bus) ⇒ nil
Sets the bus of the element. Increases the refcount on the bus. For internal use only, unless you're testing elements.
MT safe.
#call_async(func, user_data, destroy_notify) ⇒ nil
Calls func from another thread and passes user_data to it. This is to be used for cases when a state change has to be performed from a streaming thread, directly via gst_element_set_state() or indirectly e.g. via SEEK events.
Calling those functions directly from the streaming thread will cause deadlocks in many situations, as they might involve waiting for the streaming thread to shut down from this very streaming thread.
MT safe.
#change_state(transition) ⇒ Gst::StateChangeReturn
Perform transition on element.
This function must be called with STATE_LOCK held and is mainly used internally.
#clock ⇒ Gst::Clock
Gets the currently configured clock of the element. This is the clock as was last set with gst_element_set_clock().
Elements in a pipeline will only have their clock set when the pipeline is in the PLAYING state. MT safe.
#clock=(clock) ⇒ Boolean
Sets the clock for the element. This function increases the refcount on the clock. Any previously set clock on the object is unreffed. clock when it, for example, is not able to slave its internal clock to the clock or when it requires a specific clock to operate.
MT safe.
#context=(context) ⇒ nil
Sets the context of the element. Increases the refcount of the context.
MT safe.
#contexts ⇒ GLib::List<Gst::Context>
Gets the contexts set on the element.
MT safe.
#continue_state(ret) ⇒ Gst::StateChangeReturn
Commit the state change of the element and proceed to the next pending state if any. This function is used by elements that do asynchronous state changes. The core will normally call this method automatically when an element returned %GST_STATE_CHANGE_SUCCESS from the state change function.
If after calling this method the element still has not reached the pending state, the next state change is performed.
This method is used internally and should normally not be called by plugins or applications.
This function must be called with STATE_LOCK held. MT safe.
#create_all_pads ⇒ nil
Creates a pad for each pad template that is always available. This function is only useful during object initialization of subclasses of Gst::Element.
#current_clock_time ⇒ Gst::ClockTime
Returns the current clock time of the element, as in, the time of the element's clock, or GST_CLOCK_TIME_NONE if there is no clock. no clock.
#current_running_time ⇒ Gst::ClockTime
Returns the running time of the element. The running time is the element's clock time minus its base time. Will return GST_CLOCK_TIME_NONE if the element has no clock, or if its base time has not been set. element has no clock or its base time has not been set.
#decorate_stream_id(stream_id) ⇒ String
Creates a stream-id for element by combining the upstream information with the stream_id.
This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending stream_id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.
Since stream IDs are sorted alphabetically, any numbers in the stream ID should be printed with a fixed number of characters, preceded by 0's, such as by using the format %03u instead of %u.
#decorate_stream_id_printf(format, array) ⇒ String
Creates a stream-id for element by combining the upstream information with the format.
This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending the stream-id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.
Since stream IDs are sorted alphabetically, any numbers in the stream ID should be printed with a fixed number of characters, preceded by 0's, such as by using the format %03u instead of %u.
#decorate_stream_id_printf_valist(format, var_args) ⇒ String
Creates a stream-id for element by combining the upstream information with the format.
This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending format to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.
Since stream IDs are sorted alphabetically, any numbers in the stream ID should be printed with a fixed number of characters, preceded by 0's, such as by using the format %03u instead of %u.
#factory ⇒ Gst::ElementFactory
Retrieves the factory that was used to create this element.
#flags ⇒ Object
55 56 57 |
# File 'lib/gst/element.rb', line 55 def flags ElementFlags.new(flags_raw) end |
#flags_raw ⇒ Object
54 |
# File 'lib/gst/element.rb', line 54 alias_method :flags_raw, :flags |
#foreach_pad(func, user_data) ⇒ Boolean
Call func with user_data for each of element's pads. func will be called exactly once for each pad that exists at the time of this call, unless one of the calls to func returns false in which case we will stop iterating pads and return early. If new pads are added or pads are removed while pads are being iterated, this will not be taken into account until next time this function is used.
#foreach_sink_pad(func, user_data) ⇒ Boolean
Call func with user_data for each of element's sink pads. func will be called exactly once for each sink pad that exists at the time of this call, unless one of the calls to func returns false in which case we will stop iterating pads and return early. If new sink pads are added or sink pads are removed while the sink pads are being iterated, this will not be taken into account until next time this function is used.
#foreach_src_pad(func, user_data) ⇒ Boolean
Call func with user_data for each of element's source pads. func will be called exactly once for each source pad that exists at the time of this call, unless one of the calls to func returns false in which case we will stop iterating pads and return early. If new source pads are added or source pads are removed while the source pads are being iterated, this will not be taken into account until next time this function is used.
#get_compatible_pad(pad, caps) ⇒ Gst::Pad
Looks for an unlinked pad to which the given pad can link. It is not guaranteed that linking the pads will work, though it should work in most cases.
This function will first attempt to find a compatible unlinked ALWAYS pad, and if none can be found, it will request a compatible REQUEST pad by looking at the templates of element.
#get_compatible_pad_template(compattempl) ⇒ Gst::PadTemplate
Retrieves a pad template from element that is compatible with compattempl. Pads from compatible templates can be linked together.
#get_context(context_type) ⇒ Gst::Context
Gets the context with context_type set on the element or NULL.
MT safe.
#get_context_unlocked(context_type) ⇒ Gst::Context
Gets the context with context_type set on the element or NULL.
#get_metadata(key) ⇒ String
Get metadata with key in klass.
#get_pad_template(name) ⇒ Gst::PadTemplate
Retrieves a padtemplate from element_class with the given name.
If you use this function in the GInstanceInitFunc of an object class that has subclasses, make sure to pass the g_class parameter of the GInstanceInitFunc here.
#get_request_pad(name) ⇒ Gst::Pad
The name of this function is confusing to people learning GStreamer. gst_element_request_pad_simple() aims at making it more explicit it is a simplified gst_element_request_pad().
#get_state(state, pending, timeout) ⇒ Gst::StateChangeReturn
Gets the state of the element.
For elements that performed an ASYNC state change, as reported by gst_element_set_state(), this function will block up to the specified timeout value for the state change to complete. If the element completes the state change or goes into an error, this function returns immediately with a return value of %GST_STATE_CHANGE_SUCCESS or %GST_STATE_CHANGE_FAILURE respectively.
For elements that did not return %GST_STATE_CHANGE_ASYNC, this function returns the current and pending state immediately.
This function returns %GST_STATE_CHANGE_NO_PREROLL if the element successfully changed its state but is not able to provide data yet. This mostly happens for live sources that only produce data in %GST_STATE_PLAYING. While the state change return is equivalent to %GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that some sink elements might not be able to complete their state change because an element is not producing data to complete the preroll. When setting the element to playing, the preroll will complete and playback will start. MT safe.
#get_static_pad(name) ⇒ Gst::Pad
Retrieves a pad from element by name. This version only retrieves already-existing (i.e. 'static') pads. MT safe.
#is_locked_state ⇒ Boolean
Checks if the state of an element is locked. If the state of an element is locked, state changes of the parent don't affect the element. This way you can leave currently unused elements inside bins. Just lock their state before changing the state from #GST_STATE_NULL.
MT safe.
#iterate_pads ⇒ Gst::Iterator
Retrieves an iterator of element's pads. The iterator should be freed after usage. Also more specialized iterators exists such as gst_element_iterate_src_pads() or gst_element_iterate_sink_pads().
The order of pads returned by the iterator will be the order in which the pads were added to the element. MT safe.
#iterate_sink_pads ⇒ Gst::Iterator
Retrieves an iterator of element's sink pads.
The order of pads returned by the iterator will be the order in which the pads were added to the element. MT safe.
#iterate_src_pads ⇒ Gst::Iterator
Retrieves an iterator of element's source pads.
The order of pads returned by the iterator will be the order in which the pads were added to the element. MT safe.
#link_elements(*elements) ⇒ Object Also known as: link
42 43 44 45 46 |
# File 'lib/gst/element.rb', line 42 def link_elements(*elements) elements.each do |element| link_element(element) end end |
#link_filtered(dest, filter) ⇒ Boolean
Links src to dest using the given caps as filtercaps. The link must be from source to destination; the other direction will not be tried. The function looks for existing pads that aren't linked yet. It will request new pads if necessary. If multiple links are possible, only one is established.
Make sure you have added your elements to a bin or pipeline with gst_bin_add() before trying to link them.
#link_many(element_2, array) ⇒ Boolean
Chain together a series of elements. Uses gst_element_link(). Make sure you have added your elements to a bin or pipeline with gst_bin_add() before trying to link them.
#link_pads(srcpadname, dest, destpadname) ⇒ Boolean
Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails. or nil for any pad.
#link_pads_filtered(srcpadname, dest, destpadname, filter) ⇒ Boolean
Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails. If caps is not nil, makes sure that the caps of the link is a subset of caps.
#link_pads_full(srcpadname, dest, destpadname, flags) ⇒ Boolean
Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails.
Calling gst_element_link_pads_full() with flags == %GST_PAD_LINK_CHECK_DEFAULT is the same as calling gst_element_link_pads() and the recommended way of linking pads with safety checks applied.
This is a convenience function for gst_pad_link_full(). or nil for any pad.
#locked_state=(locked_state) ⇒ Boolean
Locks the state of an element, so state changes of the parent don't affect this element anymore.
Note that this is racy if the state lock of the parent bin is not taken. The parent bin might've just checked the flag in another thread and as the next step proceed to change the child element's state.
MT safe. or the elements state-locking needed no change.
#lost_state ⇒ nil
Brings the element to the lost state. The current state of the element is copied to the pending state so that any call to gst_element_get_state() will return %GST_STATE_CHANGE_ASYNC.
An ASYNC_START message is posted. If the element was PLAYING, it will go to PAUSED. The element will be restored to its PLAYING state by the parent pipeline when it prerolls again.
This is mostly used for elements that lost their preroll buffer in the %GST_STATE_PAUSED or %GST_STATE_PLAYING state after a flush, they will go to their pending state again when a new preroll buffer is queued. This function can only be called when the element is currently not in error or an async state change.
This function is used internally and should normally not be called from plugins or applications.
#message_full(type, domain, code, text, debug, file, function, line) ⇒ nil
Post an error, warning or info message on the bus from inside an element.
type must be of #GST_MESSAGE_ERROR, #GST_MESSAGE_WARNING or #GST_MESSAGE_INFO.
MT safe.
#message_full_with_details(type, domain, code, text, debug, file, function, line, structure) ⇒ nil
Post an error, warning or info message on the bus from inside an element.
type must be of #GST_MESSAGE_ERROR, #GST_MESSAGE_WARNING or #GST_MESSAGE_INFO.
#no_more_pads ⇒ nil
Use this function to signal that the element does not expect any more pads to show up in the current pipeline. This function should be called whenever pads have been added by the element itself. Elements with #GST_PAD_SOMETIMES pad templates use this in combination with autopluggers to figure out that the element is done initializing its pads.
This function emits the Gst::Element::no-more-pads signal.
MT safe.
#pad_template_list ⇒ GLib::List<Gst::PadTemplate>
Retrieves a list of the pad templates associated with element_class. The list must not be modified by the calling code.
If you use this function in the GInstanceInitFunc of an object class that has subclasses, make sure to pass the g_class parameter of the GInstanceInitFunc here.
#pause ⇒ Object
33 34 35 |
# File 'lib/gst/element.rb', line 33 def pause set_state(State::PAUSED) end |
#post_message(message) ⇒ Boolean
Post a message on the element's Gst::Bus. This function takes ownership of the message; if you want to access the message after this call, you should add an additional reference before calling. false if the element did not have a bus.
MT safe.
#provide_clock ⇒ Gst::Clock
Get the clock provided by the given element.
An element is only required to provide a clock in the PAUSED state. Some elements can provide a clock in other states. element or nil if no clock could be provided. Unref after usage.
MT safe.
#query(query) ⇒ Boolean
Performs a query on the given element.
For elements that don't implement a query handler, this function forwards the query to a random srcpad or to the peer of a random linked sinkpad of this element.
Please note that some queries might need a running pipeline to work. MT safe.
#query_convert(src_format, src_val, dest_format, dest_val) ⇒ Boolean
Queries an element to convert src_val in src_format to dest_format.
#query_duration(format, duration) ⇒ Boolean
Queries an element (usually top-level pipeline or playbin element) for the total stream duration in nanoseconds. This query will only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application will receive an ASYNC_DONE message on the pipeline bus when that is the case.
If the duration changes for some reason, you will get a DURATION_CHANGED message on the pipeline bus, in which case you should re-query the duration using this function.
#query_position(format, cur) ⇒ Boolean
Queries an element (usually top-level pipeline or playbin element) for the stream position in nanoseconds. This will be a value between 0 and the stream duration (if the stream duration is known). This query will usually only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application will receive an ASYNC_DONE message on the pipeline bus when that is the case.
If one repeatedly calls this function one can also create a query and reuse it in gst_element_query().
#release_request_pad(pad) ⇒ nil
Makes the element free the previously requested pad as obtained with gst_element_request_pad().
This does not unref the pad. If the pad was created by using gst_element_request_pad(), gst_element_release_request_pad() needs to be followed by gst_object_unref() to free the pad.
MT safe.
#remove_pad(pad) ⇒ Boolean
Removes pad from element. pad will be destroyed if it has not been referenced elsewhere using gst_object_unparent().
This function is used by plugin developers and should not be used by applications. Pads that were dynamically requested from elements with gst_element_request_pad() should be released with the gst_element_release_request_pad() function instead.
Pads are not automatically deactivated so elements should perform the needed steps to deactivate the pad in case this pad is removed in the PAUSED or PLAYING state. See gst_pad_set_active() for more information about deactivating pads.
The pad and the element should be unlocked when calling this function.
This function will emit the Gst::Element::pad-removed signal on the element. pad does not belong to the provided element.
MT safe.
#remove_property_notify_watch(watch_id) ⇒ nil
#request_pad(templ, name, caps) ⇒ Gst::Pad
Retrieves a request pad from the element according to the provided template. Pad templates can be looked up using gst_element_factory_get_static_pad_templates().
The pad should be released with gst_element_release_request_pad(). to retrieve. Can be nil. request. Can be nil.
#request_pad_simple(name) ⇒ Gst::Pad
Retrieves a pad from the element by name (e.g. "src_%d"). This version only retrieves request pads. The pad should be released with gst_element_release_request_pad().
This method is slower than manually getting the pad template and calling gst_element_request_pad() if the pads should have a specific name (e.g. name is "src_1" instead of "src_%u").
Note that this function was introduced in GStreamer 1.20 in order to provide a better name to gst_element_get_request_pad(). Prior to 1.20, users should use gst_element_get_request_pad() which provides the same functionality.
#seek(rate, format, flags, start_type, start, stop_type, stop) ⇒ Boolean
Sends a seek event to an element. See gst_event_new_seek() for the details of the parameters. The seek event is sent to the element using gst_element_send_event().
MT safe. preroll, which will emit %GST_MESSAGE_ASYNC_DONE.
#seek_simple(format, seek_flags, seek_pos) ⇒ Boolean
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. For more complex operations like segment seeks (e.g. for looping) or changing the playback rate or seeking relative to the last configured playback segment you should use gst_element_seek().
In a completely prerolled PAUSED or PLAYING pipeline, seeking is always guaranteed to return true on a seekable media type or false when the media type is certainly not seekable (such as a live stream).
Some elements allow for seeking in the READY state, in this case they will store the seek event and execute it when they are put to PAUSED. If the element supports seek in READY, it will always return true when it receives the event in the READY state. preroll, which will emit %GST_MESSAGE_ASYNC_DONE.
#send_event(event) ⇒ Boolean
Sends an event to an element. If the element doesn't implement an event handler, the event will be pushed on a random linked sink pad for downstream events or a random linked source pad for upstream events.
This function takes ownership of the provided event so you should gst_event_ref() it if you want to reuse the event after this call.
MT safe. as flushing seeks and steps) will emit %GST_MESSAGE_ASYNC_DONE.
#set_metadata(longname, classification, description, author) ⇒ nil
Sets the detailed information for a Gst::ElementClass.
This function is for use in _class_init functions only. separated with slashes ('/'). See draft-klass.txt of the design docs for more details and common types. E.g: "Sink/File" E.g: "Write stream to a file" multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"
#set_static_metadata(longname, classification, description, author) ⇒ nil
Sets the detailed information for a Gst::ElementClass.
This function is for use in _class_init functions only.
Same as gst_element_class_set_metadata(), but longname, classification, description, and author must be static strings or inlined strings, as they will not be copied. (GStreamer plugins will be made resident once loaded, so this function can be used even from dynamically loaded plugins.) separated with slashes ('/'). See draft-klass.txt of the design docs for more details and common types. E.g: "Sink/File" E.g: "Write stream to a file" multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"
#start_time ⇒ Gst::ClockTime
Returns the start time of the element. The start time is the running time of the clock when this element was last put to PAUSED.
Usually the start_time is managed by a toplevel element such as Gst::Pipeline.
MT safe.
#start_time=(time) ⇒ nil
Set the start time of an element. The start time of the element is the running time of the element when it last went to the PAUSED state. In READY or after a flushing seek, it is set to 0.
Toplevel elements like Gst::Pipeline will manage the start_time and base_time on its children. Setting the start_time to #GST_CLOCK_TIME_NONE on such a toplevel element will disable the distribution of the base_time to the children and can be useful if the application manages the base_time itself, for example if you want to synchronize capture from multiple pipelines, and you can also ensure that the pipelines have the same clock.
MT safe.
#state=(state) ⇒ Gst::StateChangeReturn
Sets the state of the element. This function will try to set the requested state by going through all the intermediary states and calling the class's state change function for each.
This function can return #GST_STATE_CHANGE_ASYNC, in which case the element will perform the remainder of the state change asynchronously in another thread. An application can use gst_element_get_state() to wait for the completion of the state change or it can wait for a %GST_MESSAGE_ASYNC_DONE or %GST_MESSAGE_STATE_CHANGED on the bus.
State changes to %GST_STATE_READY or %GST_STATE_NULL never return #GST_STATE_CHANGE_ASYNC. MT safe.
#sync_state_with_parent ⇒ Boolean
Tries to change the state of the element to the same as its parent. If this function returns false, the state of element is undefined. MT safe.
#unlink(dest) ⇒ nil
Unlinks all source pads of the source element with all sink pads of the sink element to which they are linked.
If the link has been made using gst_element_link(), it could have created an requestpad, which has to be released using gst_element_release_request_pad().
#unlink_many(element_2, array) ⇒ nil
Unlinks a series of elements. Uses gst_element_unlink().
#unlink_pads(srcpadname, dest, destpadname) ⇒ nil
Unlinks the two named pads of the source and destination elements.
This is a convenience function for gst_pad_unlink().