gi-gst-1.0.30: GStreamer bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gst.Objects.Element

Description

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 Element subclasses.

The name of a 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.

Elements can have pads (of the type Pad). These pads link to pads on other elements. Buffer flow between these linked pads. A Element has a List of Pad structures for all their input (or sink) and output (or source) pads. Core and plug-in writers can add and remove pads with elementAddPad and elementRemovePad.

An existing pad of an element can be retrieved by name with elementGetStaticPad. A new dynamic pad can be created using elementRequestPad with a PadTemplate. An iterator of all pads can be retrieved with elementIteratePads.

Elements can be linked through their pads. If the link is straightforward, use the elementLink convenience function to link two elements, or gst_element_link_many() for more elements in a row. Use elementLinkFiltered to link two elements constrained by a specified set of Caps. For finer control, use elementLinkPads and elementLinkPadsFiltered to specify the pads to link on each element by name.

Each element has a state (see State). You can get and set the state of an element with elementGetState and elementSetState. Setting a state triggers a StateChange. To get a string representation of a State, use elementStateGetName.

You can get and set a Clock on an element using elementGetClock and elementSetClock. Some elements can provide a clock for the pipeline if the GST_ELEMENT_FLAG_PROVIDE_CLOCK flag is set. With the elementProvideClock 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 elementSetClock.

Note that clock selection and distribution is normally handled by the toplevel Pipeline so the clock functions are only to be used in very specific situations.

Synopsis

Exported types

newtype Element Source #

Memory-managed wrapper type.

Constructors

Element (ManagedPtr Element) 

Instances

Instances details
Eq Element Source # 
Instance details

Defined in GI.Gst.Objects.Element

Methods

(==) :: Element -> Element -> Bool #

(/=) :: Element -> Element -> Bool #

GObject Element Source # 
Instance details

Defined in GI.Gst.Objects.Element

ManagedPtrNewtype Element Source # 
Instance details

Defined in GI.Gst.Objects.Element

Methods

toManagedPtr :: Element -> ManagedPtr Element

TypedObject Element Source # 
Instance details

Defined in GI.Gst.Objects.Element

Methods

glibType :: IO GType

HasParentTypes Element Source # 
Instance details

Defined in GI.Gst.Objects.Element

IsGValue (Maybe Element) Source #

Convert Element to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gst.Objects.Element

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Element -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Element)

type ParentTypes Element Source # 
Instance details

Defined in GI.Gst.Objects.Element

type ParentTypes Element = '[Object, Object]

class (GObject o, IsDescendantOf Element o) => IsElement o Source #

Type class for types which can be safely cast to Element, for instance with toElement.

Instances

Instances details
(GObject o, IsDescendantOf Element o) => IsElement o Source # 
Instance details

Defined in GI.Gst.Objects.Element

toElement :: (MonadIO m, IsElement o) => o -> m Element Source #

Cast to Element, for types for which this is known to be safe. For general casts, use castTo.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

abortState, addControlBinding, addPad, addPropertyDeepNotifyWatch, addPropertyNotifyWatch, bindProperty, bindPropertyFull, callAsync, changeState, continueState, createAllPads, decorateStreamId, defaultError, forceFloating, foreachPad, foreachSinkPad, foreachSrcPad, freezeNotify, getv, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, isFloating, isLockedState, iteratePads, iterateSinkPads, iterateSrcPads, link, linkFiltered, linkPads, linkPadsFiltered, linkPadsFull, lostState, messageFull, messageFullWithDetails, noMorePads, notify, notifyByPspec, postMessage, provideClock, query, queryConvert, queryDuration, queryPosition, ref, refSink, releaseRequestPad, removeControlBinding, removePad, removePropertyNotifyWatch, requestPad, requestPadSimple, runDispose, seek, seekSimple, sendEvent, stealData, stealQdata, suggestNextSync, syncStateWithParent, syncValues, thawNotify, unlink, unlinkPads, unparent, unref, watchClosure.

Getters

getBaseTime, getBus, getClock, getCompatiblePad, getCompatiblePadTemplate, getContext, getContextUnlocked, getContexts, getControlBinding, getControlRate, getCurrentClockTime, getCurrentRunningTime, getData, getFactory, getGValueArray, getMetadata, getName, getPadTemplate, getPadTemplateList, getParent, getPathString, getProperty, getQdata, getRequestPad, getStartTime, getState, getStaticPad, getValue.

Setters

setBaseTime, setBus, setClock, setContext, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setData, setDataFull, setLockedState, setName, setParent, setProperty, setStartTime, setState.

abortState

elementAbortState Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to abort the state of.

-> m () 

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.

addPad

elementAddPad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsPad b) 
=> a

element: a Element to add the pad to.

-> b

pad: the Pad to add to the element.

-> m Bool

Returns: True 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.

Adds a pad (link point) to element. pad's parent will be set to element; see objectSetParent 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 Element::padAdded signal on the element.

addPropertyDeepNotifyWatch

elementAddPropertyDeepNotifyWatch Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to watch (recursively) for property changes

-> Maybe Text

propertyName: name of property to watch for changes, or NULL to watch all properties

-> Bool

includeValue: whether to include the new property value in the message

-> m CULong

Returns: a watch id, which can be used in connection with elementRemovePropertyNotifyWatch to remove the watch again.

No description available in the introspection data.

Since: 1.10

addPropertyNotifyWatch

elementAddPropertyNotifyWatch Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to watch for property changes

-> Maybe Text

propertyName: name of property to watch for changes, or NULL to watch all properties

-> Bool

includeValue: whether to include the new property value in the message

-> m CULong

Returns: a watch id, which can be used in connection with elementRemovePropertyNotifyWatch to remove the watch again.

No description available in the introspection data.

Since: 1.10

callAsync

elementCallAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element

-> ElementCallAsyncFunc

func: Function to call asynchronously from another thread

-> m () 

Calls func from another thread and passes userData to it. This is to be used for cases when a state change has to be performed from a streaming thread, directly via elementSetState 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.

Since: 1.10

changeState

elementChangeState Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element

-> StateChange

transition: the requested transition

-> m StateChangeReturn

Returns: the StateChangeReturn of the state transition.

Perform transition on element.

This function must be called with STATE_LOCK held and is mainly used internally.

continueState

elementContinueState Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to continue the state change of.

-> StateChangeReturn

ret: The previous state return value

-> m StateChangeReturn

Returns: The result of the commit state change.

MT safe.

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

createAllPads

elementCreateAllPads Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to create pads for

-> m () 

Creates a pad for each pad template that is always available. This function is only useful during object initialization of subclasses of Element.

decorateStreamId

elementDecorateStreamId Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: The Element to create a stream-id for

-> Text

streamId: The stream-id

-> m Text

Returns: A stream-id for element.

Creates a stream-id for element by combining the upstream information with the streamId.

This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending streamId 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.

Since: 1.24

foreachPad

elementForeachPad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to iterate pads of

-> ElementForeachPadFunc

func: function to call for each pad

-> m Bool

Returns: False if element had no pads or if one of the calls to func returned False.

Call func with userData 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.

Since: 1.14

foreachSinkPad

elementForeachSinkPad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to iterate sink pads of

-> ElementForeachPadFunc

func: function to call for each sink pad

-> m Bool

Returns: False if element had no sink pads or if one of the calls to func returned False.

Call func with userData 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.

Since: 1.14

foreachSrcPad

elementForeachSrcPad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to iterate source pads of

-> ElementForeachPadFunc

func: function to call for each source pad

-> m Bool

Returns: False if element had no source pads or if one of the calls to func returned False.

Call func with userData 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.

Since: 1.14

getBaseTime

elementGetBaseTime Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> m Word64

Returns: the base time of the element.

MT safe.

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.

getBus

elementGetBus Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to get the bus of.

-> m (Maybe Bus)

Returns: the element's Bus. unref after usage.

MT safe.

Returns the bus of the element. Note that only a Pipeline will provide a bus for the application.

getClock

elementGetClock Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to get the clock of.

-> m (Maybe Clock)

Returns: the Clock of the element. unref after usage.

MT safe.

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

Elements in a pipeline will only have their clock set when the pipeline is in the PLAYING state.

getCompatiblePad

elementGetCompatiblePad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsPad b) 
=> a

element: a Element in which the pad should be found.

-> b

pad: the Pad to find a compatible one for.

-> Maybe Caps

caps: the Caps to use as a filter.

-> m (Maybe Pad)

Returns: the Pad to which a link can be made, or Nothing if one cannot be found. objectUnref after usage.

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.

getCompatiblePadTemplate

elementGetCompatiblePadTemplate Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsPadTemplate b) 
=> a

element: a Element to get a compatible pad template for

-> b

compattempl: the PadTemplate to find a compatible template for

-> m (Maybe PadTemplate)

Returns: a compatible PadTemplate, or Nothing if none was found. No unreferencing is necessary.

Retrieves a pad template from element that is compatible with compattempl. Pads from compatible templates can be linked together.

getContext

elementGetContext Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to get the context of.

-> Text

contextType: a name of a context to retrieve

-> m (Maybe Context)

Returns: A Context or NULL

Gets the context with contextType set on the element or NULL.

MT safe.

Since: 1.8

getContextUnlocked

elementGetContextUnlocked Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to get the context of.

-> Text

contextType: a name of a context to retrieve

-> m (Maybe Context)

Returns: A Context or NULL

Gets the context with contextType set on the element or NULL.

Since: 1.8

getContexts

elementGetContexts Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to set the context of.

-> m [Context]

Returns: List of Context

Gets the contexts set on the element.

MT safe.

Since: 1.8

getCurrentClockTime

elementGetCurrentClockTime Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> m Word64

Returns: the clock time of the element, or GST_CLOCK_TIME_NONE if there is no clock.

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.

Since: 1.18

getCurrentRunningTime

elementGetCurrentRunningTime Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> m Word64

Returns: the running time of the element, or GST_CLOCK_TIME_NONE if the element has no clock or its base time has not been set.

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.

Since: 1.18

getFactory

elementGetFactory Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to request the element factory of.

-> m (Maybe ElementFactory)

Returns: the ElementFactory used for creating this element or Nothing if element has not been registered (static element). no refcounting is needed.

Retrieves the factory that was used to create this element.

getMetadata

elementGetMetadata Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: class to get metadata for

-> Text

key: the key to get

-> m Text

Returns: the metadata for key.

Get metadata with key in klass.

Since: 1.14

getPadTemplate

elementGetPadTemplate Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to get the pad template of.

-> Text

name: the name of the PadTemplate to get.

-> m (Maybe PadTemplate)

Returns: the PadTemplate with the given name, or Nothing if none was found. No unreferencing is necessary.

Retrieves a padtemplate from element with the given name.

Since: 1.14

getPadTemplateList

elementGetPadTemplateList Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to get pad templates of.

-> m [PadTemplate]

Returns: the List of pad templates.

Retrieves a list of the pad templates associated with element. The list must not be modified by the calling code.

Since: 1.14

getRequestPad

elementGetRequestPad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to find a request pad of.

-> Text

name: the name of the request Pad to retrieve.

-> m (Maybe Pad)

Returns: requested Pad if found, otherwise Nothing. Release after usage.

Deprecated: (Since version 1.20)Prefer using elementRequestPadSimple whichprovides the exact same functionality.

The name of this function is confusing to people learning GStreamer. elementRequestPadSimple aims at making it more explicit it is a simplified elementRequestPad.

getStartTime

elementGetStartTime Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> m Word64

Returns: the start time of the element.

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.

getState

elementGetState Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to get the state of.

-> Word64

timeout: a GstClockTime to specify the timeout for an async state change or CLOCK_TIME_NONE for infinite timeout.

-> m (StateChangeReturn, State, State)

Returns: StateChangeReturnSuccess if the element has no more pending state and the last state change succeeded, StateChangeReturnAsync if the element is still performing a state change or StateChangeReturnFailure if the last state change failed.

MT safe.

Gets the state of the element.

For elements that performed an ASYNC state change, as reported by elementSetState, 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 StateChangeReturnSuccess or StateChangeReturnFailure respectively.

For elements that did not return StateChangeReturnAsync, this function returns the current and pending state immediately.

This function returns StateChangeReturnNoPreroll 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 StatePlaying. While the state change return is equivalent to StateChangeReturnSuccess, 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.

getStaticPad

elementGetStaticPad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to find a static pad of.

-> Text

name: the name of the static Pad to retrieve.

-> m (Maybe Pad)

Returns: the requested Pad if found, otherwise Nothing. unref after usage.

MT safe.

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

isLockedState

elementIsLockedState Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> m Bool

Returns: True, if the element's state is locked.

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.

iteratePads

elementIteratePads Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to iterate pads of.

-> m Iterator

Returns: the Iterator of Pad.

MT safe.

Retrieves an iterator of element's pads. The iterator should be freed after usage. Also more specialized iterators exists such as elementIterateSrcPads or elementIterateSinkPads.

The order of pads returned by the iterator will be the order in which the pads were added to the element.

iterateSinkPads

elementIterateSinkPads Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> m Iterator

Returns: the Iterator of Pad.

MT safe.

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.

iterateSrcPads

elementIterateSrcPads Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> m Iterator

Returns: the Iterator of Pad.

MT safe.

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.

link

elementLink Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsElement b) 
=> a

src: a Element containing the source pad.

-> b

dest: the Element containing the destination pad.

-> m Bool

Returns: True if the elements could be linked, False otherwise.

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 manually when unlinking. If multiple links are possible, only one is established.

Make sure you have added your elements to a bin or pipeline with binAdd before trying to link them.

linkFiltered

elementLinkFiltered Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsElement b) 
=> a

src: a Element containing the source pad.

-> b

dest: the Element containing the destination pad.

-> Maybe Caps

filter: the Caps to filter the link, or Nothing for no filter.

-> m Bool

Returns: True if the pads could be linked, False otherwise.

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 binAdd before trying to link them.

linkPads

elementLinkPads Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsElement b) 
=> a

src: a Element containing the source pad.

-> Maybe Text

srcpadname: the name of the Pad in source element or Nothing for any pad.

-> b

dest: the Element containing the destination pad.

-> Maybe Text

destpadname: the name of the Pad in destination element, or Nothing for any pad.

-> m Bool

Returns: True if the pads could be linked, False otherwise.

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.

linkPadsFiltered

elementLinkPadsFiltered Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsElement b) 
=> a

src: a Element containing the source pad.

-> Maybe Text

srcpadname: the name of the Pad in source element or Nothing for any pad.

-> b

dest: the Element containing the destination pad.

-> Maybe Text

destpadname: the name of the Pad in destination element or Nothing for any pad.

-> Maybe Caps

filter: the Caps to filter the link, or Nothing for no filter.

-> m Bool

Returns: True if the pads could be linked, False otherwise.

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

linkPadsFull

elementLinkPadsFull Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsElement b) 
=> a

src: a Element containing the source pad.

-> Maybe Text

srcpadname: the name of the Pad in source element or Nothing for any pad.

-> b

dest: the Element containing the destination pad.

-> Maybe Text

destpadname: the name of the Pad in destination element, or Nothing for any pad.

-> [PadLinkCheck]

flags: the PadLinkCheck to be performed when linking pads.

-> m Bool

Returns: True if the pads could be linked, False otherwise.

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 elementLinkPadsFull with flags == PadLinkCheckDefault is the same as calling elementLinkPads and the recommended way of linking pads with safety checks applied.

This is a convenience function for padLinkFull.

lostState

elementLostState Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element the state is lost of

-> m () 

Brings the element to the lost state. The current state of the element is copied to the pending state so that any call to elementGetState will return StateChangeReturnAsync.

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 StatePaused or StatePlaying 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.

makeFromUri

elementMakeFromUri Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> URIType

type: Whether to create a source or a sink

-> Text

uri: URI to create an element for

-> Maybe Text

elementname: Name of created element, can be Nothing.

-> m Element

Returns: a new element or Nothing if none could be created (Can throw GError)

Creates an element for handling the given URI.

messageFull

elementMessageFull Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to send message from

-> [MessageType]

type: the MessageType

-> Word32

domain: the GStreamer GError domain this message belongs to

-> Int32

code: the GError code belonging to the domain

-> Maybe Text

text: an allocated text string to be used as a replacement for the default message connected to code, or Nothing

-> Maybe Text

debug: an allocated debug message to be used as a replacement for the default debugging information, or Nothing

-> Text

file: the source code file where the error was generated

-> Text

function: the source code function where the error was generated

-> Int32

line: the source code line where the error was generated

-> m () 

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.

messageFullWithDetails

elementMessageFullWithDetails Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to send message from

-> [MessageType]

type: the MessageType

-> Word32

domain: the GStreamer GError domain this message belongs to

-> Int32

code: the GError code belonging to the domain

-> Maybe Text

text: an allocated text string to be used as a replacement for the default message connected to code, or Nothing

-> Maybe Text

debug: an allocated debug message to be used as a replacement for the default debugging information, or Nothing

-> Text

file: the source code file where the error was generated

-> Text

function: the source code function where the error was generated

-> Int32

line: the source code line where the error was generated

-> Structure

structure: optional details structure

-> m () 

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.

Since: 1.10

noMorePads

elementNoMorePads Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element

-> m () 

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 Element::noMorePads signal.

MT safe.

postMessage

elementPostMessage Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element posting the message

-> Message

message: a Message to post

-> m Bool

Returns: True if the message was successfully posted. The function returns False if the element did not have a bus.

MT safe.

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.

provideClock

elementProvideClock Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to query

-> m (Maybe Clock)

Returns: the GstClock provided by the element or Nothing if no clock could be provided. Unref after usage.

MT safe.

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.

query

elementQuery Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to perform the query on.

-> Query

query: the Query.

-> m Bool

Returns: True if the query could be performed.

MT safe.

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.

queryConvert

elementQueryConvert Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to invoke the convert query on.

-> Format

srcFormat: a Format to convert from.

-> Int64

srcVal: a value to convert.

-> Format

destFormat: the Format to convert to.

-> m (Bool, Int64)

Returns: True if the query could be performed.

Queries an element to convert srcVal in srcFormat to destFormat.

queryDuration

elementQueryDuration Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to invoke the duration query on.

-> Format

format: the Format requested

-> m (Bool, Int64)

Returns: True if the query could be performed.

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.

queryPosition

elementQueryPosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to invoke the position query on.

-> Format

format: the Format requested

-> m (Bool, Int64)

Returns: True if the query could be performed.

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

register

elementRegister Source #

Arguments

:: (HasCallStack, MonadIO m, IsPlugin a) 
=> Maybe a

plugin: Plugin to register the element with, or Nothing for a static element.

-> Text

name: name of elements of this type

-> Word32

rank: rank of element (higher rank means more importance when autoplugging)

-> GType

type: GType of element to register

-> m Bool

Returns: True, if the registering succeeded, False on error

Create a new elementfactory capable of instantiating objects of the type and add the factory to plugin.

releaseRequestPad

elementReleaseRequestPad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsPad b) 
=> a

element: a Element to release the request pad of.

-> b

pad: the Pad to release.

-> m () 

Makes the element free the previously requested pad as obtained with elementRequestPad.

This does not unref the pad. If the pad was created by using elementRequestPad, elementReleaseRequestPad needs to be followed by objectUnref to free the pad.

MT safe.

removePad

elementRemovePad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsPad b) 
=> a

element: a Element to remove pad from.

-> b

pad: the Pad to remove from the element.

-> m Bool

Returns: True if the pad could be removed. Can return False if the pad does not belong to the provided element.

MT safe.

Removes pad from element. pad will be destroyed if it has not been referenced elsewhere using objectUnparent.

This function is used by plugin developers and should not be used by applications. Pads that were dynamically requested from elements with elementRequestPad should be released with the elementReleaseRequestPad 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 padSetActive for more information about deactivating pads.

The pad and the element should be unlocked when calling this function.

This function will emit the Element::padRemoved signal on the element.

removePropertyNotifyWatch

elementRemovePropertyNotifyWatch Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element being watched for property changes

-> CULong

watchId: watch id to remove

-> m () 

No description available in the introspection data.

Since: 1.10

requestPad

elementRequestPad Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsPadTemplate b) 
=> a

element: a Element to find a request pad of.

-> b

templ: a PadTemplate of which we want a pad of.

-> Maybe Text

name: the name of the request Pad to retrieve. Can be Nothing.

-> Maybe Caps

caps: the caps of the pad we want to request. Can be Nothing.

-> m (Maybe Pad)

Returns: requested Pad if found, otherwise Nothing. Release after usage.

Retrieves a request pad from the element according to the provided template. Pad templates can be looked up using elementFactoryGetStaticPadTemplates.

The pad should be released with elementReleaseRequestPad.

requestPadSimple

elementRequestPadSimple Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to find a request pad of.

-> Text

name: the name of the request Pad to retrieve.

-> m (Maybe Pad)

Returns: requested Pad if found, otherwise Nothing. Release after usage.

Retrieves a pad from the element by name (e.g. "src_%d"). This version only retrieves request pads. The pad should be released with elementReleaseRequestPad.

This method is slower than manually getting the pad template and calling elementRequestPad 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 elementGetRequestPad. Prior to 1.20, users should use elementGetRequestPad which provides the same functionality.

Since: 1.20

seek

elementSeek Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to send the event to.

-> Double

rate: The new playback rate

-> Format

format: The format of the seek values

-> [SeekFlags]

flags: The optional seek flags.

-> SeekType

startType: The type and flags for the new start position

-> Int64

start: The value of the new start position

-> SeekType

stopType: The type and flags for the new stop position

-> Int64

stop: The value of the new stop position

-> m Bool

Returns: True if the event was handled. Flushing seeks will trigger a preroll, which will emit MessageTypeAsyncDone.

Sends a seek event to an element. See eventNewSeek for the details of the parameters. The seek event is sent to the element using elementSendEvent.

MT safe.

seekSimple

elementSeekSimple Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to seek on

-> Format

format: a Format to execute the seek in, such as GST_FORMAT_TIME

-> [SeekFlags]

seekFlags: seek options; playback applications will usually want to use GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT here

-> Int64

seekPos: 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 SECOND to convert seconds to nanoseconds or with MSECOND to convert milliseconds to nanoseconds.

-> m Bool

Returns: True if the seek operation succeeded. Flushing seeks will trigger a preroll, which will emit MessageTypeAsyncDone.

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

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.

sendEvent

elementSendEvent Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to send the event to.

-> Event

event: the Event to send to the element.

-> m Bool

Returns: True if the event was handled. Events that trigger a preroll (such as flushing seeks and steps) will emit MessageTypeAsyncDone.

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.

setBaseTime

elementSetBaseTime Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> Word64

time: the base time to set.

-> m () 

Set the base time of an element. See elementGetBaseTime.

MT safe.

setBus

elementSetBus Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsBus b) 
=> a

element: a Element to set the bus of.

-> Maybe b

bus: the Bus to set.

-> m () 

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

MT safe.

setClock

elementSetClock Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsClock b) 
=> a

element: a Element to set the clock for.

-> Maybe b

clock: the Clock to set for the element.

-> m Bool

Returns: True 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.

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

setContext

elementSetContext Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to set the context of.

-> Context

context: the Context to set.

-> m () 

Sets the context of the element. Increases the refcount of the context.

MT safe.

setLockedState

elementSetLockedState Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element

-> Bool

lockedState: True to lock the element's state

-> m Bool

Returns: True if the state was changed, False if bad parameters were given or the elements state-locking needed no change.

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.

setStartTime

elementSetStartTime Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> Word64

time: the base time to set.

-> m () 

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.

setState

elementSetState Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element to change state of.

-> State

state: the element's new State.

-> m StateChangeReturn

Returns: Result of the state change using StateChangeReturn.

MT safe.

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 elementGetState to wait for the completion of the state change or it can wait for a MessageTypeAsyncDone or MessageTypeStateChanged on the bus.

State changes to StateReady or StateNull never return GST_STATE_CHANGE_ASYNC.

stateChangeReturnGetName

elementStateChangeReturnGetName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StateChangeReturn

stateRet: a StateChangeReturn to get the name of.

-> m Text

Returns: a string with the name of the state result.

Gets a string representing the given state change result.

stateGetName

elementStateGetName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> State

state: a State to get the name of.

-> m Text

Returns: a string with the name of the state.

Gets a string representing the given state.

syncStateWithParent

elementSyncStateWithParent Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a) 
=> a

element: a Element.

-> m Bool

Returns: True, if the element's state could be synced to the parent's state.

MT safe.

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.

typeSetSkipDocumentation

elementTypeSetSkipDocumentation Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GType

type: a GType of element

-> m () 

Marks type as "documentation should be skipped". Can be useful for dynamically registered element to be excluded from plugin documentation system.

Example:

c code

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);

Since: 1.20

unlink

elementUnlink Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsElement b) 
=> a

src: the source Element to unlink.

-> b

dest: the sink Element to unlink.

-> m () 

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 elementLink, it could have created an requestpad, which has to be released using elementReleaseRequestPad.

unlinkPads

elementUnlinkPads Source #

Arguments

:: (HasCallStack, MonadIO m, IsElement a, IsElement b) 
=> a

src: a (transfer none): Element containing the source pad.

-> Text

srcpadname: the name of the Pad in source element.

-> b

dest: a Element containing the destination pad.

-> Text

destpadname: the name of the Pad in destination element.

-> m () 

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

This is a convenience function for padUnlink.

Signals

noMorePads

type ElementNoMorePadsCallback = IO () Source #

This signals that the element will not generate more dynamic pads. Note that this signal will usually be emitted from the context of the streaming thread.

afterElementNoMorePads :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementNoMorePadsCallback) -> m SignalHandlerId Source #

Connect a signal handler for the noMorePads signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after element #noMorePads callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onElementNoMorePads :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementNoMorePadsCallback) -> m SignalHandlerId Source #

Connect a signal handler for the noMorePads signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on element #noMorePads callback

padAdded

type ElementPadAddedCallback Source #

Arguments

 = Pad

newPad: the pad that has been added

-> IO () 

a new Pad has been added to the element. Note that this signal will usually be emitted from the context of the streaming thread. Also keep in mind that if you add new elements to the pipeline in the signal handler you will need to set them to the desired target state with elementSetState or elementSyncStateWithParent.

afterElementPadAdded :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementPadAddedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the padAdded signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after element #padAdded callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onElementPadAdded :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementPadAddedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the padAdded signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on element #padAdded callback

padRemoved

type ElementPadRemovedCallback Source #

Arguments

 = Pad

oldPad: the pad that has been removed

-> IO () 

a Pad has been removed from the element

afterElementPadRemoved :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementPadRemovedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the padRemoved signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after element #padRemoved callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onElementPadRemoved :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementPadRemovedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the padRemoved signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on element #padRemoved callback