Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Exported types
- Methods
- abortState
- addPad
- addPropertyDeepNotifyWatch
- addPropertyNotifyWatch
- callAsync
- changeState
- continueState
- createAllPads
- decorateStreamId
- foreachPad
- foreachSinkPad
- foreachSrcPad
- getBaseTime
- getBus
- getClock
- getCompatiblePad
- getCompatiblePadTemplate
- getContext
- getContextUnlocked
- getContexts
- getCurrentClockTime
- getCurrentRunningTime
- getFactory
- getMetadata
- getPadTemplate
- getPadTemplateList
- getRequestPad
- getStartTime
- getState
- getStaticPad
- isLockedState
- iteratePads
- iterateSinkPads
- iterateSrcPads
- link
- linkFiltered
- linkPads
- linkPadsFiltered
- linkPadsFull
- lostState
- makeFromUri
- messageFull
- messageFullWithDetails
- noMorePads
- postMessage
- provideClock
- query
- queryConvert
- queryDuration
- queryPosition
- register
- releaseRequestPad
- removePad
- removePropertyNotifyWatch
- requestPad
- requestPadSimple
- seek
- seekSimple
- sendEvent
- setBaseTime
- setBus
- setClock
- setContext
- setLockedState
- setStartTime
- setState
- stateChangeReturnGetName
- stateGetName
- syncStateWithParent
- typeSetSkipDocumentation
- unlink
- unlinkPads
- Signals
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
- newtype Element = Element (ManagedPtr Element)
- class (GObject o, IsDescendantOf Element o) => IsElement o
- toElement :: (MonadIO m, IsElement o) => o -> m Element
- elementAbortState :: (HasCallStack, MonadIO m, IsElement a) => a -> m ()
- elementAddPad :: (HasCallStack, MonadIO m, IsElement a, IsPad b) => a -> b -> m Bool
- elementAddPropertyDeepNotifyWatch :: (HasCallStack, MonadIO m, IsElement a) => a -> Maybe Text -> Bool -> m CULong
- elementAddPropertyNotifyWatch :: (HasCallStack, MonadIO m, IsElement a) => a -> Maybe Text -> Bool -> m CULong
- elementCallAsync :: (HasCallStack, MonadIO m, IsElement a) => a -> ElementCallAsyncFunc -> m ()
- elementChangeState :: (HasCallStack, MonadIO m, IsElement a) => a -> StateChange -> m StateChangeReturn
- elementContinueState :: (HasCallStack, MonadIO m, IsElement a) => a -> StateChangeReturn -> m StateChangeReturn
- elementCreateAllPads :: (HasCallStack, MonadIO m, IsElement a) => a -> m ()
- elementDecorateStreamId :: (HasCallStack, MonadIO m, IsElement a) => a -> Text -> m Text
- elementForeachPad :: (HasCallStack, MonadIO m, IsElement a) => a -> ElementForeachPadFunc -> m Bool
- elementForeachSinkPad :: (HasCallStack, MonadIO m, IsElement a) => a -> ElementForeachPadFunc -> m Bool
- elementForeachSrcPad :: (HasCallStack, MonadIO m, IsElement a) => a -> ElementForeachPadFunc -> m Bool
- elementGetBaseTime :: (HasCallStack, MonadIO m, IsElement a) => a -> m Word64
- elementGetBus :: (HasCallStack, MonadIO m, IsElement a) => a -> m (Maybe Bus)
- elementGetClock :: (HasCallStack, MonadIO m, IsElement a) => a -> m (Maybe Clock)
- elementGetCompatiblePad :: (HasCallStack, MonadIO m, IsElement a, IsPad b) => a -> b -> Maybe Caps -> m (Maybe Pad)
- elementGetCompatiblePadTemplate :: (HasCallStack, MonadIO m, IsElement a, IsPadTemplate b) => a -> b -> m (Maybe PadTemplate)
- elementGetContext :: (HasCallStack, MonadIO m, IsElement a) => a -> Text -> m (Maybe Context)
- elementGetContextUnlocked :: (HasCallStack, MonadIO m, IsElement a) => a -> Text -> m (Maybe Context)
- elementGetContexts :: (HasCallStack, MonadIO m, IsElement a) => a -> m [Context]
- elementGetCurrentClockTime :: (HasCallStack, MonadIO m, IsElement a) => a -> m Word64
- elementGetCurrentRunningTime :: (HasCallStack, MonadIO m, IsElement a) => a -> m Word64
- elementGetFactory :: (HasCallStack, MonadIO m, IsElement a) => a -> m (Maybe ElementFactory)
- elementGetMetadata :: (HasCallStack, MonadIO m, IsElement a) => a -> Text -> m Text
- elementGetPadTemplate :: (HasCallStack, MonadIO m, IsElement a) => a -> Text -> m (Maybe PadTemplate)
- elementGetPadTemplateList :: (HasCallStack, MonadIO m, IsElement a) => a -> m [PadTemplate]
- elementGetRequestPad :: (HasCallStack, MonadIO m, IsElement a) => a -> Text -> m (Maybe Pad)
- elementGetStartTime :: (HasCallStack, MonadIO m, IsElement a) => a -> m Word64
- elementGetState :: (HasCallStack, MonadIO m, IsElement a) => a -> Word64 -> m (StateChangeReturn, State, State)
- elementGetStaticPad :: (HasCallStack, MonadIO m, IsElement a) => a -> Text -> m (Maybe Pad)
- elementIsLockedState :: (HasCallStack, MonadIO m, IsElement a) => a -> m Bool
- elementIteratePads :: (HasCallStack, MonadIO m, IsElement a) => a -> m Iterator
- elementIterateSinkPads :: (HasCallStack, MonadIO m, IsElement a) => a -> m Iterator
- elementIterateSrcPads :: (HasCallStack, MonadIO m, IsElement a) => a -> m Iterator
- elementLink :: (HasCallStack, MonadIO m, IsElement a, IsElement b) => a -> b -> m Bool
- elementLinkFiltered :: (HasCallStack, MonadIO m, IsElement a, IsElement b) => a -> b -> Maybe Caps -> m Bool
- elementLinkPads :: (HasCallStack, MonadIO m, IsElement a, IsElement b) => a -> Maybe Text -> b -> Maybe Text -> m Bool
- elementLinkPadsFiltered :: (HasCallStack, MonadIO m, IsElement a, IsElement b) => a -> Maybe Text -> b -> Maybe Text -> Maybe Caps -> m Bool
- elementLinkPadsFull :: (HasCallStack, MonadIO m, IsElement a, IsElement b) => a -> Maybe Text -> b -> Maybe Text -> [PadLinkCheck] -> m Bool
- elementLostState :: (HasCallStack, MonadIO m, IsElement a) => a -> m ()
- elementMakeFromUri :: (HasCallStack, MonadIO m) => URIType -> Text -> Maybe Text -> m Element
- elementMessageFull :: (HasCallStack, MonadIO m, IsElement a) => a -> [MessageType] -> Word32 -> Int32 -> Maybe Text -> Maybe Text -> Text -> Text -> Int32 -> m ()
- elementMessageFullWithDetails :: (HasCallStack, MonadIO m, IsElement a) => a -> [MessageType] -> Word32 -> Int32 -> Maybe Text -> Maybe Text -> Text -> Text -> Int32 -> Structure -> m ()
- elementNoMorePads :: (HasCallStack, MonadIO m, IsElement a) => a -> m ()
- elementPostMessage :: (HasCallStack, MonadIO m, IsElement a) => a -> Message -> m Bool
- elementProvideClock :: (HasCallStack, MonadIO m, IsElement a) => a -> m (Maybe Clock)
- elementQuery :: (HasCallStack, MonadIO m, IsElement a) => a -> Query -> m Bool
- elementQueryConvert :: (HasCallStack, MonadIO m, IsElement a) => a -> Format -> Int64 -> Format -> m (Bool, Int64)
- elementQueryDuration :: (HasCallStack, MonadIO m, IsElement a) => a -> Format -> m (Bool, Int64)
- elementQueryPosition :: (HasCallStack, MonadIO m, IsElement a) => a -> Format -> m (Bool, Int64)
- elementRegister :: (HasCallStack, MonadIO m, IsPlugin a) => Maybe a -> Text -> Word32 -> GType -> m Bool
- elementReleaseRequestPad :: (HasCallStack, MonadIO m, IsElement a, IsPad b) => a -> b -> m ()
- elementRemovePad :: (HasCallStack, MonadIO m, IsElement a, IsPad b) => a -> b -> m Bool
- elementRemovePropertyNotifyWatch :: (HasCallStack, MonadIO m, IsElement a) => a -> CULong -> m ()
- elementRequestPad :: (HasCallStack, MonadIO m, IsElement a, IsPadTemplate b) => a -> b -> Maybe Text -> Maybe Caps -> m (Maybe Pad)
- elementRequestPadSimple :: (HasCallStack, MonadIO m, IsElement a) => a -> Text -> m (Maybe Pad)
- elementSeek :: (HasCallStack, MonadIO m, IsElement a) => a -> Double -> Format -> [SeekFlags] -> SeekType -> Int64 -> SeekType -> Int64 -> m Bool
- elementSeekSimple :: (HasCallStack, MonadIO m, IsElement a) => a -> Format -> [SeekFlags] -> Int64 -> m Bool
- elementSendEvent :: (HasCallStack, MonadIO m, IsElement a) => a -> Event -> m Bool
- elementSetBaseTime :: (HasCallStack, MonadIO m, IsElement a) => a -> Word64 -> m ()
- elementSetBus :: (HasCallStack, MonadIO m, IsElement a, IsBus b) => a -> Maybe b -> m ()
- elementSetClock :: (HasCallStack, MonadIO m, IsElement a, IsClock b) => a -> Maybe b -> m Bool
- elementSetContext :: (HasCallStack, MonadIO m, IsElement a) => a -> Context -> m ()
- elementSetLockedState :: (HasCallStack, MonadIO m, IsElement a) => a -> Bool -> m Bool
- elementSetStartTime :: (HasCallStack, MonadIO m, IsElement a) => a -> Word64 -> m ()
- elementSetState :: (HasCallStack, MonadIO m, IsElement a) => a -> State -> m StateChangeReturn
- elementStateChangeReturnGetName :: (HasCallStack, MonadIO m) => StateChangeReturn -> m Text
- elementStateGetName :: (HasCallStack, MonadIO m) => State -> m Text
- elementSyncStateWithParent :: (HasCallStack, MonadIO m, IsElement a) => a -> m Bool
- elementTypeSetSkipDocumentation :: (HasCallStack, MonadIO m) => GType -> m ()
- elementUnlink :: (HasCallStack, MonadIO m, IsElement a, IsElement b) => a -> b -> m ()
- elementUnlinkPads :: (HasCallStack, MonadIO m, IsElement a, IsElement b) => a -> Text -> b -> Text -> m ()
- type ElementNoMorePadsCallback = IO ()
- afterElementNoMorePads :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementNoMorePadsCallback) -> m SignalHandlerId
- onElementNoMorePads :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementNoMorePadsCallback) -> m SignalHandlerId
- type ElementPadAddedCallback = Pad -> IO ()
- afterElementPadAdded :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementPadAddedCallback) -> m SignalHandlerId
- onElementPadAdded :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementPadAddedCallback) -> m SignalHandlerId
- type ElementPadRemovedCallback = Pad -> IO ()
- afterElementPadRemoved :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementPadRemovedCallback) -> m SignalHandlerId
- onElementPadRemoved :: (IsElement a, MonadIO m) => a -> ((?self :: a) => ElementPadRemovedCallback) -> m SignalHandlerId
Exported types
Memory-managed wrapper type.
Instances
Eq Element Source # | |
GObject Element Source # | |
Defined in GI.Gst.Objects.Element | |
ManagedPtrNewtype Element Source # | |
Defined in GI.Gst.Objects.Element toManagedPtr :: Element -> ManagedPtr Element | |
TypedObject Element Source # | |
Defined in GI.Gst.Objects.Element | |
HasParentTypes Element Source # | |
Defined in GI.Gst.Objects.Element | |
IsGValue (Maybe Element) Source # | Convert |
Defined in GI.Gst.Objects.Element gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Element -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Element) | |
type ParentTypes Element Source # | |
Defined in GI.Gst.Objects.Element |
class (GObject o, IsDescendantOf Element o) => IsElement o Source #
Instances
(GObject o, IsDescendantOf Element o) => IsElement o Source # | |
Defined in GI.Gst.Objects.Element |
Methods
Click to display all available methods, including inherited ones
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a, IsPad b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: 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 #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Maybe Text |
|
-> Bool |
|
-> m CULong | Returns: a watch id, which can be used in connection with
|
No description available in the introspection data.
Since: 1.10
addPropertyNotifyWatch
elementAddPropertyNotifyWatch Source #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Maybe Text |
|
-> Bool |
|
-> m CULong | Returns: a watch id, which can be used in connection with
|
No description available in the introspection data.
Since: 1.10
callAsync
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> ElementCallAsyncFunc |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> StateChange |
|
-> m StateChangeReturn | Returns: the |
Perform transition
on element
.
This function must be called with STATE_LOCK held and is mainly used internally.
continueState
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> StateChangeReturn |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Text |
|
-> m Text | Returns: A stream-id for |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> ElementForeachPadFunc |
|
-> m Bool | Returns: |
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 #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> ElementForeachPadFunc |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> ElementForeachPadFunc |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m (Maybe Bus) | Returns: the element's MT safe. |
Returns the bus of the element. Note that only a Pipeline
will provide a
bus for the application.
getClock
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m (Maybe Clock) | Returns: the 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 #
:: (HasCallStack, MonadIO m, IsElement a, IsPad b) | |
=> a |
|
-> b |
|
-> Maybe Caps |
|
-> m (Maybe Pad) | Returns: the |
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 #
:: (HasCallStack, MonadIO m, IsElement a, IsPadTemplate b) | |
=> a |
|
-> b |
|
-> m (Maybe PadTemplate) | Returns: a compatible |
Retrieves a pad template from element
that is compatible with compattempl
.
Pads from compatible templates can be linked together.
getContext
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Text |
|
-> m (Maybe Context) | Returns: A |
Gets the context with contextType
set on the element or NULL.
MT safe.
Since: 1.8
getContextUnlocked
elementGetContextUnlocked Source #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Text |
|
-> m (Maybe Context) | Returns: A |
Gets the context with contextType
set on the element or NULL.
Since: 1.8
getContexts
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m [Context] | Returns: List of |
Gets the contexts set on the element.
MT safe.
Since: 1.8
getCurrentClockTime
elementGetCurrentClockTime Source #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m (Maybe ElementFactory) | Returns: the |
Retrieves the factory that was used to create this element.
getMetadata
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Text |
|
-> m Text | Returns: the metadata for |
Get metadata with key
in klass
.
Since: 1.14
getPadTemplate
elementGetPadTemplate Source #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Text |
|
-> m (Maybe PadTemplate) | Returns: the |
Retrieves a padtemplate from element
with the given name.
Since: 1.14
getPadTemplateList
elementGetPadTemplateList Source #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m [PadTemplate] | Returns: the |
Retrieves a list of the pad templates associated with element
. The
list must not be modified by the calling code.
Since: 1.14
getRequestPad
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Text |
|
-> m (Maybe Pad) | Returns: requested |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Word64 |
|
-> m (StateChangeReturn, State, State) | Returns: 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Text |
|
-> m (Maybe Pad) | Returns: the requested MT safe. |
Retrieves a pad from element
by name. This version only retrieves
already-existing (i.e. 'static') pads.
isLockedState
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m Iterator | 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 #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m Iterator | 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 #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m Iterator | 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
:: (HasCallStack, MonadIO m, IsElement a, IsElement b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsElement a, IsElement b) | |
=> a |
|
-> b |
|
-> Maybe Caps |
|
-> m Bool |
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
:: (HasCallStack, MonadIO m, IsElement a, IsElement b) | |
=> a |
|
-> Maybe Text |
|
-> b |
|
-> Maybe Text |
|
-> m Bool |
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 #
:: (HasCallStack, MonadIO m, IsElement a, IsElement b) | |
=> a |
|
-> Maybe Text |
|
-> b |
|
-> Maybe Text |
|
-> Maybe Caps |
|
-> m Bool |
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
:: (HasCallStack, MonadIO m, IsElement a, IsElement b) | |
=> a |
|
-> Maybe Text |
|
-> b |
|
-> Maybe Text |
|
-> [PadLinkCheck] |
|
-> m Bool |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> URIType |
|
-> Text |
|
-> Maybe Text |
|
-> m Element | Returns: a new element or |
Creates an element for handling the given URI.
messageFull
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> [MessageType] |
|
-> Word32 |
|
-> Int32 |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Text |
|
-> Text |
|
-> Int32 |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> [MessageType] |
|
-> Word32 |
|
-> Int32 |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Text |
|
-> Text |
|
-> Int32 |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Message |
|
-> m Bool | Returns: 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m (Maybe Clock) | Returns: the GstClock provided by the
element or 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Query |
|
-> m Bool | Returns: 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Format |
|
-> Int64 |
|
-> Format |
|
-> m (Bool, Int64) | Returns: |
Queries an element to convert srcVal
in srcFormat
to destFormat
.
queryDuration
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Format |
|
-> m (Bool, Int64) | Returns: |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Format |
|
-> m (Bool, Int64) | Returns: |
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
:: (HasCallStack, MonadIO m, IsPlugin a) | |
=> Maybe a |
|
-> Text |
|
-> Word32 |
|
-> GType |
|
-> m Bool |
Create a new elementfactory capable of instantiating objects of the
type
and add the factory to plugin
.
releaseRequestPad
elementReleaseRequestPad Source #
:: (HasCallStack, MonadIO m, IsElement a, IsPad b) | |
=> a |
|
-> b |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a, IsPad b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: 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 #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> CULong |
|
-> m () |
No description available in the introspection data.
Since: 1.10
requestPad
:: (HasCallStack, MonadIO m, IsElement a, IsPadTemplate b) | |
=> a |
|
-> b |
|
-> Maybe Text |
|
-> Maybe Caps |
|
-> m (Maybe Pad) | Returns: requested |
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 #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Text |
|
-> m (Maybe Pad) | Returns: requested |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Double |
|
-> Format |
|
-> [SeekFlags] |
|
-> SeekType |
|
-> Int64 |
|
-> SeekType |
|
-> Int64 |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Format |
|
-> [SeekFlags] |
|
-> Int64 |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Event |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Word64 |
|
-> m () |
Set the base time of an element. See elementGetBaseTime
.
MT safe.
setBus
:: (HasCallStack, MonadIO m, IsElement a, IsBus b) | |
=> a |
|
-> Maybe b |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a, IsClock b) | |
=> a |
|
-> Maybe b |
|
-> m Bool | Returns: 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Context |
|
-> m () |
Sets the context of the element. Increases the refcount of the context.
MT safe.
setLockedState
elementSetLockedState Source #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Bool |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> Word64 |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> State |
|
-> m StateChangeReturn | Returns: Result of the state change using 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 #
:: (HasCallStack, MonadIO m) | |
=> StateChangeReturn |
|
-> m Text | Returns: a string with the name of the state result. |
Gets a string representing the given state change result.
stateGetName
:: (HasCallStack, MonadIO m) | |
=> State |
|
-> m Text | Returns: a string with the name of the state. |
Gets a string representing the given state.
syncStateWithParent
elementSyncStateWithParent Source #
:: (HasCallStack, MonadIO m, IsElement a) | |
=> a |
|
-> m Bool | Returns: 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 #
:: (HasCallStack, MonadIO m) | |
=> GType |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a, IsElement b) | |
=> a |
|
-> b |
|
-> 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
:: (HasCallStack, MonadIO m, IsElement a, IsElement b) | |
=> a |
|
-> Text |
|
-> b |
|
-> Text |
|
-> 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 #
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 #
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