gst.element
Module for [Element] class
Types 3
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 #GstElement subclasses.
The name of a #GstElement 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.
Elements can have pads (of the type #GstPad). These pads link to pads on other elements. #GstBuffer flow between these linked pads. A #GstElement has a #GList of #GstPad 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.Element.addPad] and [gst.element.Element.removePad].
An existing pad of an element can be retrieved by name with [gst.element.Element.getStaticPad]. A new dynamic pad can be created using [gst.element.Element.requestPad] with a #GstPadTemplate. An iterator of all pads can be retrieved with [gst.element.Element.iteratePads].
Elements can be linked through their pads. If the link is straightforward, use the [gst.element.Element.link] convenience function to link two elements, or [gst.element.Element.linkMany] for more elements in a row. Use [gst.element.Element.linkFiltered] to link two elements constrained by a specified set of #GstCaps. For finer control, use [gst.element.Element.linkPads] and [gst.element.Element.linkPadsFiltered] to specify the pads to link on each element by name.
Each element has a state (see #GstState). You can get and set the state of an element with [gst.element.Element.getState] and [gst.element.Element.setState]. Setting a state triggers a #GstStateChange. To get a string representation of a #GstState, use [gst.element.Element.stateGetName].
You can get and set a #GstClock on an element using [gst.element.Element.getClock] and [gst.element.Element.setClock]. Some elements can provide a clock for the pipeline if the #GST_ELEMENT_FLAG_PROVIDE_CLOCK flag is set. With the [gst.element.Element.provideClock] method one can retrieve the clock provided by such an element. Not all elements require a clock to operate correctly. If the #GST_ELEMENT_FLAG_REQUIRE_CLOCK() flag is set, a clock should be set on the element with [gst.element.Element.setClock].
Note that clock selection and distribution is normally handled by the toplevel #GstPipeline so the clock functions are only to be used in very specific situations.
Element self()Returns `this`, for use in `with` statements.ElementGidBuilder builder()Get builder for [gst.element.Element] Returns: New builder objectgst.element.Element makeFromUri(gst.types.URIType type, string uri, string elementname = null)Creates an element for handling the given URI.bool register(gst.plugin.Plugin plugin, string name, uint rank, gobject.types.GType type)Create a new elementfactory capable of instantiating objects of the type and add the factory to plugin.string stateChangeReturnGetName(gst.types.StateChangeReturn stateRet)Gets a string representing the given state change result.string stateGetName(gst.types.State state)Gets a string representing the given state.void typeSetSkipDocumentation(gobject.types.GType type)Marks type as "documentation should be skipped". Can be useful for dynamically registered element to be excluded from plugin documentation system.void abortState()Abort the state change of the element. This function is used by elements that do asynchronous state changes and find out something is wrong.bool addPad(gst.pad.Pad pad)Adds a pad (link point) to element. pad's parent will be set to element; see [gst.object.ObjectWrap.setParent] for refcounting information.gulong addPropertyDeepNotifyWatch(string propertyName, bool includeValue)gulong addPropertyNotifyWatch(string propertyName, bool includeValue)void callAsync(gst.types.ElementCallAsyncFunc func)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.Element.setState] ...gst.types.StateChangeReturn changeState(gst.types.StateChange transition)Perform transition on element.gst.types.StateChangeReturn continueState(gst.types.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 au...void createAllPads()Creates a pad for each pad template that is always available. This function is only useful during object initialization of subclasses of #GstElement.string decorateStreamId(string streamId)Creates a stream-id for element by combining the upstream information with the stream_id.bool foreachPad(gst.types.ElementForeachPadFunc func)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 ...bool foreachSinkPad(gst.types.ElementForeachPadFunc func)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 w...bool foreachSrcPad(gst.types.ElementForeachPadFunc func)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 ...gst.types.ClockTime getBaseTime()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...gst.bus.Bus getBus()Returns the bus of the element. Note that only a #GstPipeline will provide a bus for the application. Returns: the element's #GstBus. unref after usage.gst.clock.Clock getClock()Gets the currently configured clock of the element. This is the clock as was last set with [gst.element.Element.setClock].gst.pad.Pad getCompatiblePad(gst.pad.Pad pad, gst.caps.Caps caps = null)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.gst.pad_template.PadTemplate getCompatiblePadTemplate(gst.pad_template.PadTemplate compattempl)Retrieves a pad template from element that is compatible with compattempl. Pads from compatible templates can be linked together.gst.context.Context getContext(string contextType)Gets the context with context_type set on the element or NULL.gst.context.Context getContextUnlocked(string contextType)Gets the context with context_type set on the element or NULL.gst.context.Context[] getContexts()Gets the contexts set on the element.gst.types.ClockTime getCurrentClockTime()Returns the current clock time of the element, as in, the time of the element's clock, or GSTCLOCKTIMENONE if there is no clock. Returns: the clock time of the element, or GSTCLOCKTIMENONE if there...gst.types.ClockTime getCurrentRunningTime()Returns the running time of the element. The running time is the element's clock time minus its base time. Will return GSTCLOCKTIMENONE if the element has no clock, or if its base time has not been...gst.element_factory.ElementFactory getFactory()Retrieves the factory that was used to create this element. Returns: the #GstElementFactory used for creating this element or null if element has not been registered (static element). no refcountin...string getMetadata(string key)Get metadata with key in klass.gst.pad_template.PadTemplate getPadTemplate(string name)Retrieves a padtemplate from element with the given name.gst.pad_template.PadTemplate[] getPadTemplateList()Retrieves a list of the pad templates associated with element. The list must not be modified by the calling code. Returns: the #GList of pad templates.gst.pad.Pad getRequestPad(string name)The name of this function is confusing to people learning GStreamer. [gst.element.Element.requestPadSimple] aims at making it more explicit it is a simplified [gst.element.Element.requestPad].gst.types.ClockTime getStartTime()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.gst.types.StateChangeReturn getState(out gst.types.State state, out gst.types.State pending, gst.types.ClockTime timeout)Gets the state of the element.gst.pad.Pad getStaticPad(string name)Retrieves a pad from element by name. This version only retrieves already-existing (i.e. 'static') pads.bool isLockedState()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...gst.iterator.Iterator iteratePads()Retrieves an iterator of element's pads. The iterator should be freed after usage. Also more specialized iterators exists such as [gst.element.Element.iterateSrcPads] or [gst.element.Element.iterat...gst.iterator.Iterator iterateSinkPads()Retrieves an iterator of element's sink pads.gst.iterator.Iterator iterateSrcPads()Retrieves an iterator of element's source pads.bool link(gst.element.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 neces...bool linkFiltered(gst.element.Element dest, gst.caps.Caps filter = null)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...bool linkPads(string srcpadname, gst.element.Element dest, string destpadname = null)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...bool linkPadsFiltered(string srcpadname, gst.element.Element dest, string destpadname = null, gst.caps.Caps filter = null)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 ...bool linkPadsFull(string srcpadname, gst.element.Element dest, string destpadname, gst.types.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...void lostState()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.Element.getState] will return [gst.types.StateChangeReturn.Asy...void messageFull(gst.types.MessageType type, glib.types.Quark domain, int code, string text, string debug_, string file, string function_, int line)Post an error, warning or info message on the bus from inside an element.void messageFullWithDetails(gst.types.MessageType type, glib.types.Quark domain, int code, string text, string debug_, string file, string function_, int line, gst.structure.Structure structure)Post an error, warning or info message on the bus from inside an element.void noMorePads()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. El...bool postMessage(gst.message.Message message)Post a message on the element's #GstBus. 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.gst.clock.Clock provideClock()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. Returns: the GstClock provide...bool query(gst.query.Query query)Performs a query on the given element.bool queryConvert(gst.types.Format srcFormat, long srcVal, gst.types.Format destFormat, out long destVal)Queries an element to convert srcval in srcformat to dest_format.bool queryDuration(gst.types.Format format, out long duration)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 PLA...bool queryPosition(gst.types.Format format, out long cur)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). ...void releaseRequestPad(gst.pad.Pad pad)Makes the element free the previously requested pad as obtained with [gst.element.Element.requestPad].bool removePad(gst.pad.Pad pad)Removes pad from element. pad will be destroyed if it has not been referenced elsewhere using [gst.object.ObjectWrap.unparent].void removePropertyNotifyWatch(gulong watchId)gst.pad.Pad requestPad(gst.pad_template.PadTemplate templ, string name = null, gst.caps.Caps caps = null)Retrieves a request pad from the element according to the provided template. Pad templates can be looked up using [gst.element_factory.ElementFactory.getStaticPadTemplates].gst.pad.Pad requestPadSimple(string name)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.Element.releaseRequestPad].bool seek(double rate, gst.types.Format format, gst.types.SeekFlags flags, gst.types.SeekType startType, long start, gst.types.SeekType stopType, long stop)Sends a seek event to an element. See [gst.event.Event.newSeek] for the details of the parameters. The seek event is sent to the element using [gst.element.Element.sendEvent].bool seekSimple(gst.types.Format format, gst.types.SeekFlags seekFlags, long seekPos)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)...bool sendEvent(gst.event.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 downstream events or a random linked source pad for upstrea...void setBaseTime(gst.types.ClockTime time)Set the base time of an element. See [gst.element.Element.getBaseTime].void setBus(gst.bus.Bus bus = null)Sets the bus of the element. Increases the refcount on the bus. For internal use only, unless you're testing elements.bool setClock(gst.clock.Clock clock = null)Sets the clock for the element. This function increases the refcount on the clock. Any previously set clock on the object is unreffed.void setContext(gst.context.Context context)Sets the context of the element. Increases the refcount of the context.bool setLockedState(bool lockedState)Locks the state of an element, so state changes of the parent don't affect this element anymore.void setStartTime(gst.types.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.gst.types.StateChangeReturn setState(gst.types.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.bool syncStateWithParent()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. Returns: true, if the element's state could be synced to the p...void unlink(gst.element.Element dest)Unlinks all source pads of the source element with all sink pads of the sink element to which they are linked.void unlinkPads(string srcpadname, gst.element.Element dest, string destpadname)Unlinks the two named pads of the source and destination elements.gulong connectNoMorePads(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gst.element.Element)))
&& Parameters!T.length < 2)Connect to `NoMorePads` signal.gulong connectPadAdded(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gst.pad.Pad)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gst.element.Element)))
&& Parameters!T.length < 3)Connect to `PadAdded` signal.gulong connectPadRemoved(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gst.pad.Pad)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gst.element.Element)))
&& Parameters!T.length < 3)Connect to `PadRemoved` signal.Fluent builder for [gst.element.Element]
Element build()