-
public void abort_state ()
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.
-
public bool add_pad (owned Pad pad)
Adds a pad (link point) to element. pad's parent will be set to
element; see set_parent for refcounting information. Pads are not
automatically activated so elements should perform the needed steps to activate the pad in case this pad is added in the PAUSED or
PLAYING state. See set_active for more information about activating pads. The
pad and the element should be unlocked when calling this function. This function will emit the
pad_added signal on the element. a pad with the same name already existed
or the pad already had another parent. MT safe.
-
public virtual StateChangeReturn change_state (StateChange transition)
Perform transition on element. This function must be called with
STATE_LOCK held and is mainly used internally.
-
public StateChangeReturn continue_state (StateChangeReturn ret)
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 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. MT safe.
-
public void create_all_pads ()
Creates a pad for each pad template that is always available. This function is only useful during
object intialization of subclasses of Element.
-
public void found_tags (owned TagList list)
Posts a message to the bus that new tags were found, and pushes an event to all sourcepads. Takes
ownership of the list. This is a utility method for elements. Applications should use the
TagSetter interface.
-
public void found_tags_for_pad (Pad pad, owned TagList list)
Posts a message to the bus that new tags were found and pushes the tags as event. Takes ownership of
the list. This is a utility method for elements. Applications should use the
TagSetter interface.
-
public ClockTime get_base_time ()
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.
-
public Bus? get_bus ()
Returns the bus of the element. Note that only a Pipeline
will provide a bus for the application. MT safe.
-
public Clock? get_clock ()
Gets the currently configured clock of the element. This is the clock as was last set with
set_clock. MT safe.
-
public Pad? get_compatible_pad (Pad pad, Caps? caps)
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. if one
cannot be found. unref after usage.
-
public weak PadTemplate? get_compatible_pad_template (PadTemplate compattempl)
Retrieves a pad template from element that is compatible with compattempl.
Pads from compatible templates can be linked together. was found. No unreferencing is necessary.
-
public weak ElementFactory? get_factory ()
Retrieves the factory that was used to create this element. element. no refcounting is needed.
-
public virtual Index? get_index ()
Gets the index from the element. element. unref after usage. MT safe.
-
public Pad? get_pad (string name)
-
public virtual weak QueryType[]? get_query_types ()
Get an array of query types from the element. If the element doesn't implement a query types
function, the query will be forwarded to the peer of a random linked sink pad. be freed or modified. MT safe.
-
public Pad? get_request_pad (string name)
Retrieves a pad from the element by name. This version only retrieves request pads. The pad should
be released with release_request_pad. This method is slow and
will be deprecated in the future. New code should use request_pad with
the requested template. Release after usage.
-
public ClockTime get_start_time ()
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
Pipeline. MT safe.
-
public virtual StateChangeReturn get_state (out State state, out State pending, ClockTime timeout)
Gets the state of the element. For elements that performed an ASYNC state change, as reported by
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 SUCCESS or
FAILURE respectively. For elements that did not return
ASYNC, this function returns the current and pending state
immediately. This function returns 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
PLAYING. While the state change return is equivalent to
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. and the last state change succeeded,
ASYNC if the element is still performing a state change or
FAILURE if the last state change failed. MT safe.
-
public Pad? get_static_pad (string name)
Retrieves a pad from element by name. This version only retrieves already-existing
(i.e. 'static') pads. unref after usage. MT safe.
-
public bool implements_interface (Type iface_type)
Test whether the given element implements a certain interface of type iface_type, and test whether
it is supported for this specific instance.
-
public bool is_indexable ()
Queries if the element can be indexed. MT safe.
-
public bool is_locked_state ()
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 NULL. MT safe.
-
public Iterator<Pad> iterate_pads ()
Retrieves an iterattor of element's pads. The iterator should be freed after usage.
after use. MT safe.
-
public Iterator<Pad> iterate_sink_pads ()
Retrieves an iterator of element's sink pads. after use. MT safe.
-
public Iterator<Pad> iterate_src_pads ()
Retrieves an iterator of element's source pads. after use. MT safe.
-
public bool link (Element dest)
Links src to dest. 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.
Such pads need to be released manualy when unlinking. If multiple links are possible, only one is established. Make sure you have
added your elements to a bin or pipeline with add before trying to link them.
-
public bool link_filtered (Element dest, Caps filter)
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 add before trying to link them.
-
public bool link_many (Element element_2, ...)
Chain together a series of elements. Uses link.
Make sure you have added your elements to a bin or pipeline with add before trying
to link them.
-
public bool link_pads (string srcpadname, Element dest, string destpadname)
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.
-
public bool link_pads_filtered (string srcpadname, Element dest, string destpadname, Caps filter)
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 null, makes sure that the caps of the link is a subset of caps.
-
public bool link_pads_full (string srcpadname, Element dest, string destpadname, PadLinkCheck flags)
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
link_pads_full with flags ==
PAD_LINK_CHECK_DEFAULT is the same as calling
link_pads and the recommended way of linking pads with safety checks
applied. This is a convenience function for link_full.
-
public void lost_state ()
Brings the element to the lost state. This function calls
lost_state_full with the new_base_time set to true.
This function is used internally and should normally not be called from plugins or applications. MT safe.
-
public void lost_state_full (bool new_base_time)
Brings the element to the lost state. The current state of the element is copied to the pending
state so that any call to get_state will return
ASYNC. An ASYNC_START message is posted with indication to
distribute a new base_time to the element when new_base_time is true. 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 PAUSED or
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. MT safe.
-
public void message_full (MessageType type, Quark domain, int code, owned string? text, owned string? debug, string file, string function, int line)
Post an error, warning or info message on the bus from inside an element.
INFO. MT safe.
-
public bool post_message (owned Message message)
Post a message on the element's 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.
-
public virtual Clock? provide_clock ()
Get the clock provided by the given element.
-
public bool provides_clock ()
Query if the element provides a clock. A Clock
provided by an element can be used as the global Clock for the pipeline. An
element that can provide a clock is only required to do so in the PAUSED state, this means when it is fully negotiated and has
allocated the resources to operate the clock. MT safe.
-
public virtual bool query (Query query)
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.
-
public bool query_convert (Format src_format, int64 src_val, ref Format dest_format, out int64 dest_val)
Queries an element to convert src_val in src_format to dest_format
.
-
public bool query_duration (ref Format format, out int64 duration)
Queries an element for the total stream duration.
-
public bool query_position (ref Format format, out int64 cur)
Queries an element for the stream position. If one repeatedly calls this function one can also
create and reuse it in query.
-
public virtual void release_pad (Pad pad)
-
public void release_request_pad (Pad pad)
-
public bool remove_pad (Pad pad)
Removes pad from element. pad will be destroyed if it has not
been referenced elsewhere using unparent. This function is used by plugin
developers and should not be used by applications. Pads that were dynamically requested from elements with
get_request_pad should be released with the
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 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
pad_removed signal on the element. pad does not belong to the provided
element. MT safe.
-
public virtual weak Pad request_new_pad (PadTemplate templ, string? name)
-
public virtual weak Pad request_new_pad_full (PadTemplate templ, string name, Caps caps)
-
public weak Pad request_pad (PadTemplate templ, string name, Caps caps)
Retrieves a request pad from the element according to the provided template. If the caps
are specified and the element implements thew new request_new_pad_full virtual method, the element will use them to select
which pad to create. The pad should be released with
release_request_pad. Release after usage.
-
public bool requires_clock ()
Query if the element requires a clock. MT safe.
-
public bool seek (double rate, Format format, SeekFlags flags, SeekType cur_type, int64 cur, SeekType stop_type, int64 stop)
Sends a seek event to an element. See
Event.seek for the details of the parameters. The seek event is sent to the element using
send_event. MT safe.
-
public bool seek_simple (Format format, SeekFlags seek_flags, int64 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. 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
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.
executed instantly though)
-
public virtual bool send_event (owned Event event)
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 upstream events or a random linked source pad for downstream events. This function takes
owership of the provided event so you should ref it if you want to reuse the event
after this call. MT safe.
-
public void set_base_time (ClockTime time)
-
public virtual void set_bus (Bus? bus)
Sets the bus of the element. Increases the refcount on the bus. For internal use only, unless you're
testing elements. MT safe.
-
public virtual bool set_clock (Clock? clock)
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 MT safe.
-
public virtual void set_index (Index? index)
Set index on the element. The refcount of the index will be increased, any previously
set index is unreffed. MT safe.
-
public bool set_locked_state (bool locked_state)
Locks the state of an element, so state changes of the parent don't affect this element anymore. MT
safe. or the elements state-locking needed no change.
-
public void set_start_time (ClockTime time)
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
Pipeline will manage the start_time and base_time on its children. Setting the
start_time to 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.
-
public virtual StateChangeReturn set_state (State state)
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
ASYNC, in which case the element will perform the remainder of
the state change asynchronously in another thread. An application can use
get_state to wait for the completion of the state change or it can
wait for a state change message on the bus. State changes to READY or
NULL never return
ASYNC. MT safe.
-
public virtual void state_changed (State oldstate, State newstate, State pending)
-
public bool sync_state_with_parent ()
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.
-
public void unlink (Element dest)
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 link, it could have created an
requestpad, which has to be released using release_request_pad.
-
public void unlink_many (Element element_2, ...)
Unlinks a series of elements. Uses unlink.
-
public void unlink_pads (string srcpadname, Element dest, string destpadname)
Unlinks the two named pads of the source and destination elements. This is a convenience function
for unlink.