Next: , Previous: GstElementFactory, Up: Top


10 GstElement

Abstract base class for all pipeline elements

10.1 Overview

GstElement is the abstract base class needed to construct an element that can be used in a GStreamer pipeline. Please refer to the plugin writers guide for more information on creating <gst-element> subclasses.

The name of a <gst-element> can be get with gst-element-get-name and set with gst-element-set-name. For speed, gst-element-name can be used in the core when using the appropriate locking. Do not use this in plug-ins or applications in order to retain ABI compatibility.

All elements have pads (of the type <gst-pad>). These pads link to pads on other elements. <gst-buffer> flow between these linked pads. A <gst-element> has a <g-list> of <gst-pad> structures for all their input (or sink) and output (or source) pads. Core and plug-in writers can add and remove pads with gst-element-add-pad and gst-element-remove-pad.

A pad of an element can be retrieved by name with gst-element-get-pad. An iterator of all pads can be retrieved with gst-element-iterate-pads.

Elements can be linked through their pads. If the link is straightforward, use the gst-element-link convenience function to link two elements, or gst-element-link-many for more elements in a row. Use gst-element-link-filtered to link two elements constrained by a specified set of <gst-caps>. For finer control, use gst-element-link-pads and gst-element-link-pads-filtered to specify the pads to link on each element by name.

Each element has a state (see <gst-state>). You can get and set the state of an element with gst-element-get-state and gst-element-set-state. To get a string representation of a <gst-state>, use gst-element-state-get-name.

You can get and set a <gst-clock> on an element using gst-element-get-clock and gst-element-set-clock. Some elements can provide a clock for the pipeline if gst-element-provides-clock returns ‘#t’. With the gst-element-provide-clock method one can retrieve the clock provided by such an element. Not all elements require a clock to operate correctly. If gst-element-requires-clock returns ‘#t’, a clock should be set on the element with gst-element-set-clock.

Note that clock slection and distribution is normally handled by the toplevel <gst-pipeline> so the clock functions are only to be used in very specific situations.

Last reviewed on 2006-03-12 (0.10.5)

10.2 Usage

— Class: <gst-element>

This <gobject> class defines no properties, other than those defined by its superclasses.

— Signal on <gst-element>: pad-added (arg0 <gst-pad>)

a new <gst-pad> has been added to the element.

— Signal on <gst-element>: pad-removed (arg0 <gst-pad>)

a <gst-pad> has been removed from the element

— Signal on <gst-element>: no-more-pads

This signals that the element will not generate more dynamic pads.

— Function: gst-element-class-add-pad-template (klass <gst-element-class>) (templ <gst-pad-template>)

Adds a padtemplate to an element class. This is mainly used in the _base_init functions of classes.

klass
the <gst-element-class> to add the pad template to.
templ
a <gst-pad-template> to add to the element class.
— Function: gst-element-class-get-pad-template (klass <gst-element-class>) (klass mchars)   (ret <gst-pad-template>)

Retrieves a padtemplate from element-class with the given name.

If you use this function in the <g-instance-init-func> of an object class that has subclasses, make sure to pass the g_class parameter of the <g-instance-init-func> here.

element-class
a <gst-element-class> to get the pad template of.
name
the name of the <gst-pad-template> to get.
ret
the <gst-pad-template> with the given name, or ‘#f’ if none was found. No unreferencing is necessary.
— Function: gst-element-class-set-details (klass <gst-element-class>) (details <gst-element-details*>)

Sets the detailed information for a <gst-element-class>.

This function is for use in _base_init functions only.

The details are copied.

klass
class to set details for
details
details to set
— Function: gst-element-add-pad (self <gst-element>) (pad <gst-pad>)   (ret bool)
— Method: add-pad

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 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 gst-pad-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 <gst-element::pad-added> signal on the element.

element
a <gst-element> to add the pad to.
pad
the <gst-pad> to add to the element.
ret
#t’ if the pad could be added. This function can fail when a pad with the same name already existed or the pad already had another parent. MT safe.
— Function: gst-element-get-pad (self <gst-element>) (name mchars)   (ret <gst-pad>)
— Method: get-pad

Retrieves a pad from element by name. Tries gst-element-get-static-pad first, then gst-element-get-request-pad.

Usage of this function is not recommended as it is unclear if the reference to the result pad should be released with gst-object-unref in case of a static pad or gst-element-release-request-pad in case of a request pad.

element
a <gst-element>.
name
the name of the pad to retrieve.
ret
the <gst-pad> if found, otherwise ‘#f’. Unref or Release after usage, depending on the type of the pad.
— Function: gst-element-create-all-pads (self <gst-element>)
— Method: 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 <gst-element>.

element
a <gst-element> to create pads for
— Function: gst-element-get-compatible-pad (self <gst-element>) (pad <gst-pad>) (caps <gst-caps>)   (ret <gst-pad>)
— Method: get-compatible-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.

element
a <gst-element> in which the pad should be found.
pad
the <gst-pad> to find a compatible one for.
caps
the <gst-caps> to use as a filter.
ret
the <gst-pad> to which a link can be made, or ‘#f’ if one cannot be found.
— Function: gst-element-get-request-pad (self <gst-element>) (name mchars)   (ret <gst-pad>)
— Method: get-request-pad

Retrieves a pad from the element by name. This version only retrieves request pads. The pad should be released with gst-element-release-request-pad.

element
a <gst-element> to find a request pad of.
name
the name of the request <gst-pad> to retrieve.
ret
requested <gst-pad> if found, otherwise ‘#f’. Release after usage.
— Function: gst-element-get-static-pad (self <gst-element>) (name mchars)   (ret <gst-pad>)
— Method: get-static-pad

Retrieves a pad from element by name. This version only retrieves already-existing (i.e. 'static') pads.

element
a <gst-element> to find a static pad of.
name
the name of the static <gst-pad> to retrieve.
ret
the requested <gst-pad> if found, otherwise ‘#f’. unref after usage. MT safe.
— Function: gst-element-no-more-pads (self <gst-element>)
— Method: no-more-pads

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.

element
a <gst-element>
— Function: gst-element-release-request-pad (self <gst-element>) (pad <gst-pad>)
— Method: release-request-pad

Makes the element free the previously requested pad as obtained with gst-element-get-request-pad.

MT safe.

element
a <gst-element> to release the request pad of.
pad
the <gst-pad> to release.
— Function: gst-element-remove-pad (self <gst-element>) (pad <gst-pad>)   (ret bool)
— Method: remove-pad

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-get-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.

element
a <gst-element> to remove pad from.
pad
the <gst-pad> to remove from the element.
ret
#t’ if the pad could be removed. Can return ‘#f’ if the pad does not belong to the provided element. MT safe.
— Function: gst-element-iterate-pads (self <gst-element>)   (ret <gst-iterator*>)
— Method: iterate-pads

Retrieves an iterattor of element's pads. The iterator should be freed after usage.

element
a <gst-element> to iterate pads of.
ret
the <gst-iterator> of <gst-pad>. Unref each pad after use. MT safe.
— Function: gst-element-iterate-sink-pads (self <gst-element>)   (ret <gst-iterator*>)
— Method: iterate-sink-pads

Retrieves an iterator of element's sink pads.

element
a <gst-element>.
ret
the <gst-iterator> of <gst-pad>. Unref each pad after use. MT safe.
— Function: gst-element-iterate-src-pads (self <gst-element>)   (ret <gst-iterator*>)
— Method: iterate-src-pads

Retrieves an iterator of element's source pads.

element
a <gst-element>.
ret
the <gst-iterator> of <gst-pad>. Unref each pad after use. MT safe.
— Function: gst-element-link (self <gst-element>) (dest <gst-element>)   (ret bool)
— Method: link

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 gst-bin-add before trying to link them.

src
a <gst-element> containing the source pad.
dest
the <gst-element> containing the destination pad.
ret
TRUE if the elements could be linked, FALSE otherwise.
— Function: gst-element-unlink (self <gst-element>) (dest <gst-element>)
— Method: unlink

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.

src
the source <gst-element> to unlink.
dest
the sink <gst-element> to unlink.
— Function: gst-element-link-pads (self <gst-element>) (srcpadname mchars) (dest <gst-element>) (destpadname mchars)   (ret bool)
— Method: link-pads

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.

src
a <gst-element> containing the source pad.
srcpadname
the name of the <gst-pad> in source element or NULL for any pad.
dest
the <gst-element> containing the destination pad.
destpadname
the name of the <gst-pad> in destination element, or NULL for any pad.
ret
TRUE if the pads could be linked, FALSE otherwise.
— Function: gst-element-unlink-pads (self <gst-element>) (srcpadname mchars) (dest <gst-element>) (destpadname mchars)
— Method: unlink-pads

Unlinks the two named pads of the source and destination elements.

src
a <gst-element> containing the source pad.
srcpadname
the name of the <gst-pad> in source element.
dest
a <gst-element> containing the destination pad.
destpadname
the name of the <gst-pad> in destination element.
— Function: gst-element-link-pads-filtered (self <gst-element>) (srcpadname mchars) (dest <gst-element>) (destpadname mchars) (filter <gst-caps>)   (ret bool)
— Method: link-pads-filtered

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 #f, makes sure that the caps of the link is a subset of caps.

src
a <gst-element> containing the source pad.
srcpadname
the name of the <gst-pad> in source element or NULL for any pad.
dest
the <gst-element> containing the destination pad.
destpadname
the name of the <gst-pad> in destination element or NULL for any pad.
filter
the <gst-caps> to filter the link, or #f for no filter.
ret
TRUE if the pads could be linked, FALSE otherwise.
— Function: gst-element-link-filtered (self <gst-element>) (dest <gst-element>) (filter <gst-caps>)   (ret bool)
— Method: link-filtered

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.

src
a <gst-element> containing the source pad.
dest
the <gst-element> containing the destination pad.
filter
the <gst-caps> to filter the link, or #f for no filter.
ret
TRUE if the pads could be linked, FALSE otherwise.
— Function: gst-element-set-base-time (self <gst-element>) (time unsigned-long-long)
— Method: set-base-time

Set the base time of an element. See gst-element-get-base-time.

MT safe.

element
a <gst-element>.
time
the base time to set.
— Function: gst-element-get-base-time (self <gst-element>)   (ret unsigned-long-long)
— Method: 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 stream time of the element.

element
a <gst-element>.
ret
the base time of the element. MT safe.
— Function: gst-element-set-bus (self <gst-element>) (bus <gst-bus>)
— Method: set-bus

Sets the bus of the element. Increases the refcount on the bus. For internal use only, unless you're testing elements.

MT safe.

element
a <gst-element> to set the bus of.
bus
the <gst-bus> to set.
— Function: gst-element-get-bus (self <gst-element>)   (ret <gst-bus>)
— Method: get-bus

Returns the bus of the element. Note that only a <gst-pipeline> will provide a bus for the application.

element
a <gst-element> to get the bus of.
ret
the element's <gst-bus>. unref after usage. MT safe.
— Function: gst-element-get-factory (self <gst-element>)   (ret <gst-element-factory>)
— Method: get-factory

Retrieves the factory that was used to create this element.

element
a <gst-element> to request the element factory of.
ret
the <gst-element-factory> used for creating this element. no refcounting is needed.
— Function: gst-element-set-index (self <gst-element>) (index <gst-index>)
— Method: set-index

Set index on the element. The refcount of the index will be increased, any previously set index is unreffed.

MT safe.

element
a <gst-element>.
index
a <gst-index>.
— Function: gst-element-get-index (self <gst-element>)   (ret <gst-index>)
— Method: get-index

Gets the index from the element.

element
a <gst-element>.
ret
a <gst-index> or ‘#f’ when no index was set on the element. unref after usage. MT safe.
— Function: gst-element-is-indexable (self <gst-element>)   (ret bool)
— Method: is-indexable

Queries if the element can be indexed.

element
a <gst-element>.
ret
TRUE if the element can be indexed. MT safe.
— Function: gst-element-requires-clock (self <gst-element>)   (ret bool)
— Method: requires-clock

Query if the element requires a clock.

element
a <gst-element> to query
ret
#t’ if the element requires a clock MT safe.
— Function: gst-element-set-clock (self <gst-element>) (clock <gst-clock>)   (ret bool)
— Method: set-clock

Sets the clock for the element. This function increases the refcount on the clock. Any previously set clock on the object is unreffed.

element
a <gst-element> to set the clock for.
clock
the <gst-clock> to set for the element.
ret
#t’ if the element accepted the clock. An element can refuse a 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.
— Function: gst-element-get-clock (self <gst-element>)   (ret <gst-clock>)
— Method: get-clock

Gets the currently configured clock of the element. This is the clock as was last set with gst-element-set-clock.

element
a <gst-element> to get the clock of.
ret
the <gst-clock> of the element. unref after usage. MT safe.
— Function: gst-element-provides-clock (self <gst-element>)   (ret bool)
— Method: provides-clock

Query if the element provides a clock. A <gst-clock> provided by an element can be used as the global <gst-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.

element
a <gst-element> to query
ret
#t’ if the element provides a clock MT safe.
— Function: gst-element-provide-clock (self <gst-element>)   (ret <gst-clock>)
— Method: provide-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
a <gst-element> to query
ret
the GstClock provided by the element or ‘#f’ if no clock could be provided. Unref after usage. MT safe.
— Function: gst-element-set-state (self <gst-element>) (state <gst-state>)   (ret <gst-state-change-return>)
— Method: set-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 <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 state change message on the bus.

element
a <gst-element> to change state of.
state
the element's new <gst-state>.
ret
Result of the state change using <gst-state-change-return>. MT safe.
— Function: gst-element-get-state (self <gst-element>) (state <gst-state*>) (pending <gst-state*>) (timeout unsigned-long-long)   (ret <gst-state-change-return>)
— Method: get-state

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 the PLAYING state. 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.

element
a <gst-element> to get the state of.
state
a pointer to <gst-state> to hold the state. Can be ‘#f’.
pending
a pointer to <gst-state> to hold the pending state. Can be ‘#f’.
timeout
a <gst-clock-time> to specify the timeout for an async state change or ‘GST_CLOCK_TIME_NONE’ for infinite timeout.
ret
GST_STATE_CHANGE_SUCCESS’ if the element has no more pending state and the last state change succeeded, ‘GST_STATE_CHANGE_ASYNC’ if the element is still performing a state change or ‘GST_STATE_CHANGE_FAILURE’ if the last state change failed. MT safe.
— Function: gst-element-set-locked-state (self <gst-element>) (locked_state bool)   (ret bool)
— Method: set-locked-state

Locks the state of an element, so state changes of the parent don't affect this element anymore.

MT safe.

element
a <gst-element>
locked-state
TRUE to lock the element's state
ret
TRUE if the state was changed, FALSE if bad parameters were given or the elements state-locking needed no change.
— Function: gst-element-is-locked-state (self <gst-element>)   (ret bool)
— Method: 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 <gst-state-null>.

MT safe.

element
a <gst-element>.
ret
TRUE, if the element's state is locked.
— Function: gst-element-abort-state (self <gst-element>)
— Method: 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.

element
a <gst-element> to abort the state of.
— Function: gst-element-continue-state (self <gst-element>) (ret <gst-state-change-return>)   (ret <gst-state-change-return>)
— Method: continue-state

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.

element
a <gst-element> to continue the state change of.
ret
The previous state return value
ret
The result of the commit state change. MT safe.
— Function: gst-element-lost-state (self <gst-element>)
— Method: lost-state

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 with an indication to distribute a new base_time to the element. 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.

MT safe.

element
a <gst-element> the state is lost of
— Function: gst-element-state-get-name (state <gst-state>)   (ret mchars)

Gets a string representing the given state.

state
a <gst-state> to get the name of.
ret
a string with the name of the state.
— Function: gst-element-sync-state-with-parent (self <gst-element>)   (ret bool)
— Method: 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.

element
a <gst-element>.
ret
TRUE, if the element's state could be synced to the parent's state. MT safe.
— Function: gst-element-found-tags (self <gst-element>) (list <gst-tag-list*>)
— Method: found-tags

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 <gst-tag-setter> interface.

element
element for which we found the tags.
list
list of tags.
— Function: gst-element-found-tags-for-pad (self <gst-element>) (pad <gst-pad>) (list <gst-tag-list*>)
— Method: found-tags-for-pad

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 <gst-tag-setter> interface.

element
element for which to post taglist to bus.
pad
pad on which to push tag-event.
list
the taglist to post on the bus and create event from.
— Function: gst-element-message-full (self <gst-element>) (type <gst-message-type>) (domain unsigned-int) (code int) (text mchars) (debug mchars) (file mchars) (function mchars) (line int)
— Method: message-full

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.

element
a <gst-element> to send message from
type
the <gst-message-type>
domain
the GStreamer GError domain this message belongs to
code
the GError code belonging to the domain
text
an allocated text string to be used as a replacement for the default message connected to code, or ‘#f
debug
an allocated debug message to be used as a replacement for the default debugging information, or ‘#f
file
the source code file where the error was generated
function
the source code function where the error was generated
line
the source code line where the error was generated
— Function: gst-element-post-message (self <gst-element>) (message <gst-message>)   (ret bool)
— Method: post-message

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.

element
a <gst-element> posting the message
message
a <gst-message> to post
ret
#t’ if the message was successfully posted. The function returns ‘#f’ if the element did not have a bus. MT safe.
— Function: gst-element-get-query-types (self <gst-element>)   (ret <gst-query-type*>)
— Method: 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.

element
a <gst-element> to query
ret
An array of <gst-query-type> elements that should not be freed or modified. MT safe.
— Function: gst-element-query (self <gst-element>) (query <gst-query>)   (ret bool)
— Method: 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.

element
a <gst-element> to perform the query on.
query
the <gst-query>.
ret
TRUE if the query could be performed. MT safe.
— Function: gst-element-query-convert (self <gst-element>) (src_format <gst-format>) (src_val int64) (dest_format <gst-format*>)   (ret bool) (dest_val int64)
— Method: query-convert

Queries an element to convert src-val in src-format to dest-format.

element
a <gst-element> to invoke the convert query on.
src-format
a <gst-format> to convert from.
src-val
a value to convert.
dest-format
a pointer to the <gst-format> to convert to.
dest-val
a pointer to the result.
ret
TRUE if the query could be performed.
— Function: gst-element-query-position (self <gst-element>) (format <gst-format*>)   (ret bool) (cur int64)
— Method: query-position

Queries an element for the stream position.

element
a <gst-element> to invoke the position query on.
format
a pointer to the <gst-format> asked for. On return contains the <gst-format> used.
cur
A location in which to store the current position, or NULL.
ret
TRUE if the query could be performed.
— Function: gst-element-query-duration (self <gst-element>) (format <gst-format*>)   (ret bool) (duration int64)
— Method: query-duration

Queries an element for the total stream duration.

element
a <gst-element> to invoke the duration query on.
format
a pointer to the <gst-format> asked for. On return contains the <gst-format> used.
duration
A location in which to store the total duration, or NULL.
ret
TRUE if the query could be performed.
— Function: gst-element-send-event (self <gst-element>) (event <gst-event>)   (ret bool)
— Method: send-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 gst-event-ref it if you want to reuse the event after this call.

element
a <gst-element> to send the event to.
event
the <gst-event> to send to the element.
ret
#t’ if the event was handled. MT safe.
— Function: gst-element-seek-simple (self <gst-element>) (format <gst-format>) (seek_flags <gst-seek-flags>) (seek_pos int64)   (ret bool)
— Method: seek-simple

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 ‘#t’ on a seekable media type or ‘#f’ 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 ‘#t’ when it receives the event in the READY state.

element
a <gst-element> to seek on
format
a <gst-format> to execute the seek in, such as <gst-format-time>
seek-flags
seek options; playback applications will usually want to use GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT here
seek-pos
position to seek to (relative to the start); if you are doing a seek in <gst-format-time> this value is in nanoseconds - multiply with <gst-second> to convert seconds to nanoseconds or with <gst-msecond> to convert milliseconds to nanoseconds.
ret
#t’ if the seek operation succeeded (the seek might not always be executed instantly though)

Since 0.10.7

— Function: gst-element-seek (self <gst-element>) (rate double) (format <gst-format>) (flags <gst-seek-flags>) (cur_type <gst-seek-type>) (cur int64) (stop_type <gst-seek-type>) (stop int64)   (ret bool)
— Method: seek

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.

element
a <gst-element> to send the event to.
rate
The new playback rate
format
The format of the seek values
flags
The optional seek flags.
cur-type
The type and flags for the new current position
cur
The value of the new current position
stop-type
The type and flags for the new stop position
stop
The value of the new stop position
ret
#t’ if the event was handled. MT safe.