gi-gst-1.0.25: 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.Pad

Description

A Element is linked to other elements via "pads", which are extremely light-weight generic link points.

Pads have a PadDirection, source pads produce data, sink pads consume data.

Pads are typically created from a PadTemplate with padNewFromTemplate and are then added to a Element. This usually happens when the element is created but it can also happen dynamically based on the data that the element is processing or based on the pads that the application requests.

Pads without pad templates can be created with padNew, which takes a direction and a name as an argument. If the name is Nothing, then a guaranteed unique name will be assigned to it.

A Element creating a pad will typically use the various gst_pad_set_*_function\() calls to register callbacks for events, queries or dataflow on the pads.

gst_pad_get_parent() will retrieve the Element that owns the pad.

After two pads are retrieved from an element by elementGetStaticPad, the pads can be linked with padLink. (For quick links, you can also use elementLink, which will make the obvious link for you if it's straightforward.). Pads can be unlinked again with padUnlink. padGetPeer can be used to check what the pad is linked to.

Before dataflow is possible on the pads, they need to be activated with padSetActive.

padQuery and padPeerQuery can be used to query various properties of the pad and the stream.

To send a Event on a pad, use padSendEvent and padPushEvent. Some events will be sticky on the pad, meaning that after they pass on the pad they can be queried later with padGetStickyEvent and padStickyEventsForeach. padGetCurrentCaps and padHasCurrentCaps are convenience functions to query the current sticky CAPS event on a pad.

GstElements will use padPush and padPullRange to push out or pull in a buffer.

The dataflow, events and queries that happen on a pad can be monitored with probes that can be installed with padAddProbe. padIsBlocked can be used to check if a block probe is installed on the pad. padIsBlocking checks if the blocking probe is currently blocking the pad. padRemoveProbe is used to remove a previously installed probe and unblock blocking probes if any.

Pad have an offset that can be retrieved with padGetOffset. This offset will be applied to the running_time of all data passing over the pad. padSetOffset can be used to change the offset.

Convenience functions exist to start, pause and stop the task on a pad with padStartTask, padPauseTask and padStopTask respectively.

Synopsis

Exported types

newtype Pad Source #

Memory-managed wrapper type.

Constructors

Pad (ManagedPtr Pad) 

Instances

Instances details
Eq Pad Source # 
Instance details

Defined in GI.Gst.Objects.Pad

Methods

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

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

GObject Pad Source # 
Instance details

Defined in GI.Gst.Objects.Pad

ManagedPtrNewtype Pad Source # 
Instance details

Defined in GI.Gst.Objects.Pad

TypedObject Pad Source # 
Instance details

Defined in GI.Gst.Objects.Pad

Methods

glibType :: IO GType #

HasParentTypes Pad Source # 
Instance details

Defined in GI.Gst.Objects.Pad

IsGValue (Maybe Pad) Source #

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

Instance details

Defined in GI.Gst.Objects.Pad

type ParentTypes Pad Source # 
Instance details

Defined in GI.Gst.Objects.Pad

class (GObject o, IsDescendantOf Pad o) => IsPad o Source #

Type class for types which can be safely cast to Pad, for instance with toPad.

Instances

Instances details
(GObject o, IsDescendantOf Pad o) => IsPad o Source # 
Instance details

Defined in GI.Gst.Objects.Pad

toPad :: (MonadIO m, IsPad o) => o -> m Pad Source #

Cast to Pad, 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

activateMode, addControlBinding, addProbe, bindProperty, bindPropertyFull, canLink, chain, chainList, checkReconfigure, createStreamId, defaultError, eventDefault, forceFloating, forward, freezeNotify, getv, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, hasCurrentCaps, isActive, isBlocked, isBlocking, isFloating, isLinked, iterateInternalLinks, iterateInternalLinksDefault, link, linkFull, linkMaybeGhosting, linkMaybeGhostingFull, markReconfigure, needsReconfigure, notify, notifyByPspec, pauseTask, peerQuery, peerQueryAcceptCaps, peerQueryCaps, peerQueryConvert, peerQueryDuration, peerQueryPosition, proxyQueryAcceptCaps, proxyQueryCaps, pullRange, push, pushEvent, pushList, query, queryAcceptCaps, queryCaps, queryConvert, queryDefault, queryDuration, queryPosition, ref, refSink, removeControlBinding, removeProbe, runDispose, sendEvent, startTask, stealData, stealQdata, stickyEventsForeach, stopTask, storeStickyEvent, suggestNextSync, syncValues, thawNotify, unlink, unparent, unref, useFixedCaps, watchClosure.

Getters

getAllowedCaps, getControlBinding, getControlRate, getCurrentCaps, getData, getDirection, getElementPrivate, getGValueArray, getLastFlowReturn, getName, getOffset, getPadTemplate, getPadTemplateCaps, getParent, getParentElement, getPathString, getPeer, getProperty, getQdata, getRange, getSingleInternalLink, getStickyEvent, getStream, getStreamId, getTaskState, getValue.

Setters

setActivateFunctionFull, setActivatemodeFunctionFull, setActive, setChainFunctionFull, setChainListFunctionFull, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setData, setDataFull, setElementPrivate, setEventFullFunctionFull, setEventFunctionFull, setGetrangeFunctionFull, setIterateInternalLinksFunctionFull, setLinkFunctionFull, setName, setOffset, setParent, setProperty, setQueryFunctionFull, setUnlinkFunctionFull.

activateMode

padActivateMode Source #

Arguments

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

pad: the Pad to activate or deactivate.

-> PadMode

mode: the requested activation mode

-> Bool

active: whether or not the pad should be active.

-> m Bool

Returns: True if the operation was successful.

MT safe.

Activates or deactivates the given pad in mode via dispatching to the pad's activatemodefunc. For use from within pad activation functions only.

If you don't know what this is, you probably don't want to call it.

addProbe

padAddProbe Source #

Arguments

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

pad: the Pad to add the probe to

-> [PadProbeType]

mask: the probe mask

-> PadProbeCallback

callback: PadProbeCallback that will be called with notifications of the pad state

-> m CULong

Returns: an id or 0 if no probe is pending. The id can be used to remove the probe with padRemoveProbe. When using GST_PAD_PROBE_TYPE_IDLE it can happen that the probe can be run immediately and if the probe returns GST_PAD_PROBE_REMOVE this functions returns 0.

MT safe.

Be notified of different states of pads. The provided callback is called for every state that matches mask.

Probes are called in groups: First GST_PAD_PROBE_TYPE_BLOCK probes are called, then others, then finally GST_PAD_PROBE_TYPE_IDLE. The only exception here are GST_PAD_PROBE_TYPE_IDLE probes that are called immediately if the pad is already idle while calling padAddProbe. In each of the groups, probes are called in the order in which they were added.

canLink

padCanLink Source #

Arguments

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

srcpad: the source Pad.

-> b

sinkpad: the sink Pad.

-> m Bool

Returns: True if the pads can be linked.

Checks if the source pad and the sink pad are compatible so they can be linked.

chain

padChain Source #

Arguments

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

pad: a sink Pad, returns GST_FLOW_ERROR if not.

-> Buffer

buffer: the Buffer to send, return GST_FLOW_ERROR if not.

-> m FlowReturn

Returns: a FlowReturn from the pad.

MT safe.

Chain a buffer to pad.

The function returns GST_FLOW_FLUSHING if the pad was flushing.

If the buffer type is not acceptable for pad (as negotiated with a preceding GST_EVENT_CAPS event), this function returns GST_FLOW_NOT_NEGOTIATED.

The function proceeds calling the chain function installed on pad (see gst_pad_set_chain_function()) and the return value of that function is returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad has no chain function.

In all cases, success or failure, the caller loses its reference to buffer after calling this function.

chainList

padChainList Source #

Arguments

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

pad: a sink Pad, returns GST_FLOW_ERROR if not.

-> BufferList

list: the BufferList to send, return GST_FLOW_ERROR if not.

-> m FlowReturn

Returns: a FlowReturn from the pad.

Chain a bufferlist to pad.

The function returns GST_FLOW_FLUSHING if the pad was flushing.

If pad was not negotiated properly with a CAPS event, this function returns GST_FLOW_NOT_NEGOTIATED.

The function proceeds calling the chainlist function installed on pad (see gst_pad_set_chain_list_function()) and the return value of that function is returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad has no chainlist function.

In all cases, success or failure, the caller loses its reference to list after calling this function.

MT safe.

checkReconfigure

padCheckReconfigure Source #

Arguments

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

pad: the Pad to check

-> m Bool

Returns: True is the GST_PAD_FLAG_NEED_RECONFIGURE flag was set on pad.

Check and clear the GST_PAD_FLAG_NEED_RECONFIGURE flag on pad and return True if the flag was set.

createStreamId

padCreateStreamId Source #

Arguments

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

pad: A source Pad

-> b

parent: Parent Element of pad

-> Maybe Text

streamId: The stream-id

-> m Text

Returns: A stream-id for pad. free after usage.

Creates a stream-id for the source Pad pad by combining the upstream information with the optional streamId of the stream of pad. pad must have a parent Element and which must have zero or one sinkpad. streamId can only be Nothing if the parent element of pad has only a single source pad.

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.

eventDefault

padEventDefault Source #

Arguments

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

pad: a Pad to call the default event handler on.

-> Maybe b

parent: the parent of pad or Nothing

-> Event

event: the Event to handle.

-> m Bool

Returns: True if the event was sent successfully.

Invokes the default event handler for the given pad.

The EOS event will pause the task associated with pad before it is forwarded to all internally linked pads,

The event is sent to all pads internally linked to pad. This function takes ownership of event.

forward

padForward Source #

Arguments

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

pad: a Pad

-> PadForwardFunction

forward: a PadForwardFunction

-> m Bool

Returns: True if one of the dispatcher functions returned True.

Calls forward for all internally linked pads of pad. This function deals with dynamically changing internal pads and will make sure that the forward function is only called once for each pad.

When forward returns True, no further pads will be processed.

getAllowedCaps

padGetAllowedCaps Source #

Arguments

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

pad: a Pad.

-> m (Maybe Caps)

Returns: the allowed Caps of the pad link. Unref the caps when you no longer need it. This function returns Nothing when pad has no peer.

MT safe.

Gets the capabilities of the allowed media types that can flow through pad and its peer.

The allowed capabilities is calculated as the intersection of the results of calling padQueryCaps on pad and its peer. The caller owns a reference on the resulting caps.

getCurrentCaps

padGetCurrentCaps Source #

Arguments

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

pad: a Pad to get the current capabilities of.

-> m (Maybe Caps)

Returns: the current caps of the pad with incremented ref-count or Nothing when pad has no caps. Unref after usage.

Gets the capabilities currently configured on pad with the last GST_EVENT_CAPS event.

getDirection

padGetDirection Source #

Arguments

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

pad: a Pad to get the direction of.

-> m PadDirection

Returns: the PadDirection of the pad.

MT safe.

Gets the direction of the pad. The direction of the pad is decided at construction time so this function does not take the LOCK.

getElementPrivate

padGetElementPrivate Source #

Arguments

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

pad: the Pad to get the private data of.

-> m (Ptr ())

Returns: a gpointer to the private data.

Gets the private data of a pad. No locking is performed in this function.

getLastFlowReturn

padGetLastFlowReturn Source #

Arguments

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

pad: the Pad

-> m FlowReturn 

Gets the FlowReturn return from the last data passed by this pad.

Since: 1.4

getOffset

padGetOffset Source #

Arguments

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

pad: a Pad

-> m Int64

Returns: the offset.

Get the offset applied to the running time of pad. pad has to be a source pad.

getPadTemplate

padGetPadTemplate Source #

Arguments

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

pad: a Pad.

-> m (Maybe PadTemplate)

Returns: the PadTemplate from which this pad was instantiated, or Nothing if this pad has no template. Unref after usage.

Gets the template for pad.

getPadTemplateCaps

padGetPadTemplateCaps Source #

Arguments

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

pad: a Pad to get the template capabilities from.

-> m Caps

Returns: the Caps of this pad template. Unref after usage.

Gets the capabilities for pad's template.

getParentElement

padGetParentElement Source #

Arguments

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

pad: a pad

-> m (Maybe Element)

Returns: the parent of the pad. The caller has a reference on the parent, so unref when you're finished with it.

MT safe.

Gets the parent of pad, cast to a Element. If a pad has no parent or its parent is not an element, return Nothing.

getPeer

padGetPeer Source #

Arguments

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

pad: a Pad to get the peer of.

-> m (Maybe Pad)

Returns: the peer Pad. Unref after usage.

MT safe.

Gets the peer of pad. This function refs the peer pad so you need to unref it after use.

getRange

padGetRange Source #

Arguments

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

pad: a src Pad, returns GST_FLOW_ERROR if not.

-> Word64

offset: The start offset of the buffer

-> Word32

size: The length of the buffer

-> m (FlowReturn, Buffer)

Returns: a FlowReturn from the pad.

MT safe.

When pad is flushing this function returns GST_FLOW_FLUSHING immediately and buffer is Nothing.

Calls the getrange function of pad, see PadGetRangeFunction for a description of a getrange function. If pad has no getrange function installed (see gst_pad_set_getrange_function()) this function returns GST_FLOW_NOT_SUPPORTED.

If buffer points to a variable holding Nothing, a valid new Buffer will be placed in buffer when this function returns GST_FLOW_OK. The new buffer must be freed with gst_buffer_unref() after usage.

When buffer points to a variable that points to a valid Buffer, the buffer will be filled with the result data when this function returns GST_FLOW_OK. If the provided buffer is larger than size, only size bytes will be filled in the result buffer and its size will be updated accordingly.

Note that less than size bytes can be returned in buffer when, for example, an EOS condition is near or when buffer is not large enough to hold size bytes. The caller should check the result buffer size to get the result size.

When this function returns any other result value than GST_FLOW_OK, buffer will be unchanged.

This is a lowlevel function. Usually padPullRange is used.

getSingleInternalLink

padGetSingleInternalLink Source #

Arguments

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

pad: the Pad to get the internal link of.

-> m (Maybe Pad)

Returns: a Pad, or Nothing if pad has none or more than one internal links. Unref returned pad with objectUnref.

If there is a single internal link of the given pad, this function will return it. Otherwise, it will return NULL.

Since: 1.18

getStickyEvent

padGetStickyEvent Source #

Arguments

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

pad: the Pad to get the event from.

-> EventType

eventType: the EventType that should be retrieved.

-> Word32

idx: the index of the event

-> m (Maybe Event)

Returns: a Event of type eventType or Nothing when no event of eventType was on pad. Unref after usage.

Returns a new reference of the sticky event of type eventType from the event.

getStream

padGetStream Source #

Arguments

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

pad: A source Pad

-> m (Maybe Stream)

Returns: the current Stream for pad, or Nothing. unref the returned stream when no longer needed.

Returns the current Stream for the pad, or Nothing if none has been set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around padGetStickyEvent and eventParseStream.

Since: 1.10

getStreamId

padGetStreamId Source #

Arguments

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

pad: A source Pad

-> m (Maybe Text)

Returns: a newly-allocated copy of the stream-id for pad, or Nothing. free the returned string when no longer needed.

Returns the current stream-id for the pad, or Nothing if none has been set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around padGetStickyEvent and eventParseStreamStart.

The returned stream-id string should be treated as an opaque string, its contents should not be interpreted.

Since: 1.2

getTaskState

padGetTaskState Source #

Arguments

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

pad: the Pad to get task state from

-> m TaskState

Returns: The current state of pad's task.

Get pad task state. If no task is currently set, GST_TASK_STOPPED is returned.

Since: 1.12

hasCurrentCaps

padHasCurrentCaps Source #

Arguments

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

pad: a Pad to check

-> m Bool

Returns: True when pad has caps associated with it.

Check if pad has caps set on it with a GST_EVENT_CAPS event.

isActive

padIsActive Source #

Arguments

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

pad: the Pad to query

-> m Bool

Returns: True if the pad is active.

MT safe.

Query if a pad is active

isBlocked

padIsBlocked Source #

Arguments

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

pad: the Pad to query

-> m Bool

Returns: True if the pad is blocked.

MT safe.

Checks if the pad is blocked or not. This function returns the last requested state of the pad. It is not certain that the pad is actually blocking at this point (see padIsBlocking).

isBlocking

padIsBlocking Source #

Arguments

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

pad: the Pad to query

-> m Bool

Returns: True if the pad is blocking.

MT safe.

Checks if the pad is blocking or not. This is a guaranteed state of whether the pad is actually blocking on a Buffer or a Event.

isLinked

padIsLinked Source #

Arguments

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

pad: pad to check

-> m Bool

Returns: True if the pad is linked, False otherwise.

MT safe.

Checks if a pad is linked to another pad or not.

iterateInternalLinks

padIterateInternalLinks Source #

Arguments

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

pad: the GstPad to get the internal links of.

-> m (Maybe Iterator)

Returns: a new Iterator of Pad or Nothing when the pad does not have an iterator function configured. Use iteratorFree after usage.

Gets an iterator for the pads to which the given pad is linked to inside of the parent element.

Each Pad element yielded by the iterator will have its refcount increased, so unref after use.

Free-function: gst_iterator_free

iterateInternalLinksDefault

padIterateInternalLinksDefault Source #

Arguments

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

pad: the Pad to get the internal links of.

-> Maybe b

parent: the parent of pad or Nothing

-> m (Maybe Iterator)

Returns: a Iterator of Pad, or Nothing if pad has no parent. Unref each returned pad with objectUnref.

Iterate the list of pads to which the given pad is linked to inside of the parent element. This is the default handler, and thus returns an iterator of all of the pads inside the parent element with opposite direction.

The caller must free this iterator after use with iteratorFree.

link

padLink Source #

Arguments

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

srcpad: the source Pad to link.

-> b

sinkpad: the sink Pad to link.

-> m PadLinkReturn

Returns: A result code indicating if the connection worked or what went wrong.

MT Safe.

Links the source pad and the sink pad.

linkFull

padLinkFull Source #

Arguments

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

srcpad: the source Pad to link.

-> b

sinkpad: the sink Pad to link.

-> [PadLinkCheck]

flags: the checks to validate when linking

-> m PadLinkReturn

Returns: A result code indicating if the connection worked or what went wrong.

Links the source pad and the sink pad.

This variant of gst_pad_link provides a more granular control on the checks being done when linking. While providing some considerable speedups the caller of this method must be aware that wrong usage of those flags can cause severe issues. Refer to the documentation of PadLinkCheck for more information.

MT Safe.

linkGetName

padLinkGetName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PadLinkReturn

ret: a PadLinkReturn to get the name of.

-> m Text

Returns: a static string with the name of the pad-link return.

Gets a string representing the given pad-link return.

Since: 1.4

linkMaybeGhosting

padLinkMaybeGhosting Source #

Arguments

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

src: a Pad

-> b

sink: a Pad

-> m Bool

Returns: whether the link succeeded.

Links src to sink, creating any GhostPad's in between as necessary.

This is a convenience function to save having to create and add intermediate GhostPad's as required for linking across Bin boundaries.

If src or sink pads don't have parent elements or do not share a common ancestor, the link will fail.

Since: 1.10

linkMaybeGhostingFull

padLinkMaybeGhostingFull Source #

Arguments

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

src: a Pad

-> b

sink: a Pad

-> [PadLinkCheck]

flags: some PadLinkCheck flags

-> m Bool

Returns: whether the link succeeded.

Links src to sink, creating any GhostPad's in between as necessary.

This is a convenience function to save having to create and add intermediate GhostPad's as required for linking across Bin boundaries.

If src or sink pads don't have parent elements or do not share a common ancestor, the link will fail.

Calling padLinkMaybeGhostingFull with flags == PadLinkCheckDefault is the recommended way of linking pads with safety checks applied.

Since: 1.10

markReconfigure

padMarkReconfigure Source #

Arguments

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

pad: the Pad to mark

-> m () 

Mark a pad for needing reconfiguration. The next call to padCheckReconfigure will return True after this call.

needsReconfigure

padNeedsReconfigure Source #

Arguments

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

pad: the Pad to check

-> m Bool

Returns: True is the GST_PAD_FLAG_NEED_RECONFIGURE flag is set on pad.

Check the GST_PAD_FLAG_NEED_RECONFIGURE flag on pad and return True if the flag was set.

new

padNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Maybe Text

name: the name of the new pad.

-> PadDirection

direction: the PadDirection of the pad.

-> m (Maybe Pad)

Returns: a new Pad.

MT safe.

Creates a new pad with the given name in the given direction. If name is Nothing, a guaranteed unique name (across all pads) will be assigned. This function makes a copy of the name so you can safely free the name.

newFromStaticTemplate

padNewFromStaticTemplate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StaticPadTemplate

templ: the StaticPadTemplate to use

-> Text

name: the name of the pad

-> m (Maybe Pad)

Returns: a new Pad.

Creates a new pad with the given name from the given static template. If name is Nothing, a guaranteed unique name (across all pads) will be assigned. This function makes a copy of the name so you can safely free the name.

newFromTemplate

padNewFromTemplate Source #

Arguments

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

templ: the pad template to use

-> Maybe Text

name: the name of the pad

-> m (Maybe Pad)

Returns: a new Pad.

Creates a new pad with the given name from the given template. If name is Nothing, a guaranteed unique name (across all pads) will be assigned. This function makes a copy of the name so you can safely free the name.

pauseTask

padPauseTask Source #

Arguments

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

pad: the Pad to pause the task of

-> m Bool

Returns: a True if the task could be paused or False when the pad has no task.

Pause the task of pad. This function will also wait until the function executed by the task is finished if this function is not called from the task function.

peerQuery

padPeerQuery Source #

Arguments

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

pad: a Pad to invoke the peer query on.

-> Query

query: the Query to perform.

-> m Bool

Returns: True if the query could be performed. This function returns False if pad has no peer.

Performs padQuery on the peer of pad.

The caller is responsible for both the allocation and deallocation of the query structure.

peerQueryAcceptCaps

padPeerQueryAcceptCaps Source #

Arguments

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

pad: a Pad to check the peer of

-> Caps

caps: a Caps to check on the pad

-> m Bool

Returns: True if the peer of pad can accept the caps or pad has no peer.

Check if the peer of pad accepts caps. If pad has no peer, this function returns True.

peerQueryCaps

padPeerQueryCaps Source #

Arguments

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

pad: a Pad to get the capabilities of.

-> Maybe Caps

filter: a Caps filter, or Nothing.

-> m Caps

Returns: the caps of the peer pad with incremented ref-count. When there is no peer pad, this function returns filter or, when filter is Nothing, ANY caps.

Gets the capabilities of the peer connected to this pad. Similar to padQueryCaps.

When called on srcpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on sinkpads filter contains the caps accepted by downstream in the preferred order. filter might be Nothing but if it is not Nothing the returned caps will be a subset of filter.

peerQueryConvert

padPeerQueryConvert Source #

Arguments

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

pad: a Pad, on whose peer pad to invoke the convert query on. Must be a sink pad.

-> 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 the peer pad of a given sink pad to convert srcVal in srcFormat to destFormat.

peerQueryDuration

padPeerQueryDuration Source #

Arguments

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

pad: a Pad on whose peer pad to invoke the duration query on. Must be a sink pad.

-> Format

format: the Format requested

-> m (Bool, Int64)

Returns: True if the query could be performed.

Queries the peer pad of a given sink pad for the total stream duration.

peerQueryPosition

padPeerQueryPosition Source #

Arguments

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

pad: a Pad on whose peer to invoke the position query on. Must be a sink pad.

-> Format

format: the Format requested

-> m (Bool, Int64)

Returns: True if the query could be performed.

Queries the peer of a given sink pad for the stream position.

proxyQueryAcceptCaps

padProxyQueryAcceptCaps Source #

Arguments

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

pad: a Pad to proxy.

-> Query

query: an ACCEPT_CAPS Query.

-> m Bool

Returns: True if query could be executed

Checks if all internally linked pads of pad accepts the caps in query and returns the intersection of the results.

This function is useful as a default accept caps query function for an element that can handle any stream format, but requires caps that are acceptable for all opposite pads.

proxyQueryCaps

padProxyQueryCaps Source #

Arguments

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

pad: a Pad to proxy.

-> Query

query: a CAPS Query.

-> m Bool

Returns: True if query could be executed

Calls padQueryCaps for all internally linked pads of pad and returns the intersection of the results.

This function is useful as a default caps query function for an element that can handle any stream format, but requires all its pads to have the same caps. Two such elements are tee and adder.

pullRange

padPullRange Source #

Arguments

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

pad: a sink Pad, returns GST_FLOW_ERROR if not.

-> Word64

offset: The start offset of the buffer

-> Word32

size: The length of the buffer

-> m (FlowReturn, Buffer)

Returns: a FlowReturn from the peer pad.

MT safe.

Pulls a buffer from the peer pad or fills up a provided buffer.

This function will first trigger the pad block signal if it was installed.

When pad is not linked GST_FLOW_NOT_LINKED is returned else this function returns the result of padGetRange on the peer pad. See padGetRange for a list of return values and for the semantics of the arguments of this function.

If buffer points to a variable holding Nothing, a valid new Buffer will be placed in buffer when this function returns GST_FLOW_OK. The new buffer must be freed with gst_buffer_unref() after usage. When this function returns any other result value, buffer will still point to Nothing.

When buffer points to a variable that points to a valid Buffer, the buffer will be filled with the result data when this function returns GST_FLOW_OK. When this function returns any other result value, buffer will be unchanged. If the provided buffer is larger than size, only size bytes will be filled in the result buffer and its size will be updated accordingly.

Note that less than size bytes can be returned in buffer when, for example, an EOS condition is near or when buffer is not large enough to hold size bytes. The caller should check the result buffer size to get the result size.

push

padPush Source #

Arguments

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

pad: a source Pad, returns GST_FLOW_ERROR if not.

-> Buffer

buffer: the Buffer to push returns GST_FLOW_ERROR if not.

-> m FlowReturn

Returns: a FlowReturn from the peer pad.

MT safe.

Pushes a buffer to the peer of pad.

This function will call installed block probes before triggering any installed data probes.

The function proceeds calling padChain on the peer pad and returns the value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will be returned.

In all cases, success or failure, the caller loses its reference to buffer after calling this function.

pushEvent

padPushEvent Source #

Arguments

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

pad: a Pad to push the event to.

-> Event

event: the Event to send to the pad.

-> m Bool

Returns: True if the event was handled.

MT safe.

Sends the event to the peer of the given pad. This function is mainly used by elements to send events to their peer elements.

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.

pushList

padPushList Source #

Arguments

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

pad: a source Pad, returns GST_FLOW_ERROR if not.

-> BufferList

list: the BufferList to push returns GST_FLOW_ERROR if not.

-> m FlowReturn

Returns: a FlowReturn from the peer pad.

MT safe.

Pushes a buffer list to the peer of pad.

This function will call installed block probes before triggering any installed data probes.

The function proceeds calling the chain function on the peer pad and returns the value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will be returned. If the peer pad does not have any installed chainlist function every group buffer of the list will be merged into a normal Buffer and chained via padChain.

In all cases, success or failure, the caller loses its reference to list after calling this function.

query

padQuery Source #

Arguments

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

pad: a Pad to invoke the default query on.

-> Query

query: the Query to perform.

-> m Bool

Returns: True if the query could be performed.

Dispatches a query to a pad. The query should have been allocated by the caller via one of the type-specific allocation functions. The element that the pad belongs to is responsible for filling the query with an appropriate response, which should then be parsed with a type-specific query parsing function.

Again, the caller is responsible for both the allocation and deallocation of the query structure.

Please also note that some queries might need a running pipeline to work.

queryAcceptCaps

padQueryAcceptCaps Source #

Arguments

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

pad: a Pad to check

-> Caps

caps: a Caps to check on the pad

-> m Bool

Returns: True if the pad can accept the caps.

Check if the given pad accepts the caps.

queryCaps

padQueryCaps Source #

Arguments

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

pad: a Pad to get the capabilities of.

-> Maybe Caps

filter: suggested Caps, or Nothing

-> m Caps

Returns: the caps of the pad with incremented ref-count.

Gets the capabilities this pad can produce or consume. Note that this method doesn't necessarily return the caps set by sending a eventNewCaps - use padGetCurrentCaps for that instead. gst_pad_query_caps returns all possible caps a pad can operate with, using the pad's CAPS query function, If the query fails, this function will return filter, if not Nothing, otherwise ANY.

When called on sinkpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on srcpads filter contains the caps accepted by downstream in the preferred order. filter might be Nothing but if it is not Nothing the returned caps will be a subset of filter.

Note that this function does not return writable Caps, use gst_caps_make_writable() before modifying the caps.

queryConvert

padQueryConvert Source #

Arguments

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

pad: a Pad 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 a pad to convert srcVal in srcFormat to destFormat.

queryDefault

padQueryDefault Source #

Arguments

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

pad: a Pad to call the default query handler on.

-> Maybe b

parent: the parent of pad or Nothing

-> Query

query: the Query to handle.

-> m Bool

Returns: True if the query was performed successfully.

Invokes the default query handler for the given pad. The query is sent to all pads internally linked to pad. Note that if there are many possible sink pads that are internally linked to pad, only one will be sent the query. Multi-sinkpad elements should implement custom query handlers.

queryDuration

padQueryDuration Source #

Arguments

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

pad: a Pad to invoke the duration query on.

-> Format

format: the Format requested

-> m (Bool, Int64)

Returns: True if the query could be performed.

Queries a pad for the total stream duration.

queryPosition

padQueryPosition Source #

Arguments

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

pad: a Pad to invoke the position query on.

-> Format

format: the Format requested

-> m (Bool, Int64)

Returns: True if the query could be performed.

Queries a pad for the stream position.

removeProbe

padRemoveProbe Source #

Arguments

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

pad: the Pad with the probe

-> CULong

id: the probe id to remove

-> m () 

Remove the probe with id from pad.

MT safe.

sendEvent

padSendEvent Source #

Arguments

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

pad: a Pad to send the event to.

-> Event

event: the Event to send to the pad.

-> m Bool

Returns: True if the event was handled.

Sends the event to the pad. This function can be used by applications to send events in the pipeline.

If pad is a source pad, event should be an upstream event. If pad is a sink pad, event should be a downstream event. For example, you would not send a GST_EVENT_EOS on a src pad; EOS events only propagate downstream. Furthermore, some downstream events have to be serialized with data flow, like EOS, while some can travel out-of-band, like GST_EVENT_FLUSH_START. If the event needs to be serialized with data flow, this function will take the pad's stream lock while calling its event function.

To find out whether an event type is upstream, downstream, or downstream and serialized, see EventTypeFlags, eventTypeGetFlags, GST_EVENT_IS_UPSTREAM, GST_EVENT_IS_DOWNSTREAM, and GST_EVENT_IS_SERIALIZED. Note that in practice that an application or plugin doesn't need to bother itself with this information; the core handles all necessary locks and checks.

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.

setActivateFunctionFull

padSetActivateFunctionFull Source #

Arguments

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

pad: a Pad.

-> PadActivateFunction

activate: the PadActivateFunction to set.

-> m () 

Sets the given activate function for pad. The activate function will dispatch to padActivateMode to perform the actual activation. Only makes sense to set on sink pads.

Call this function if your sink pad can start a pull-based task.

setActivatemodeFunctionFull

padSetActivatemodeFunctionFull Source #

Arguments

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

pad: a Pad.

-> PadActivateModeFunction

activatemode: the PadActivateModeFunction to set.

-> m () 

Sets the given activate_mode function for the pad. An activate_mode function prepares the element for data passing.

setActive

padSetActive Source #

Arguments

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

pad: the Pad to activate or deactivate.

-> Bool

active: whether or not the pad should be active.

-> m Bool

Returns: True if the operation was successful.

MT safe.

Activates or deactivates the given pad. Normally called from within core state change functions.

If active, makes sure the pad is active. If it is already active, either in push or pull mode, just return. Otherwise dispatches to the pad's activate function to perform the actual activation.

If not active, calls padActivateMode with the pad's current mode and a False argument.

setChainFunctionFull

padSetChainFunctionFull Source #

Arguments

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

pad: a sink Pad.

-> PadChainFunction

chain: the PadChainFunction to set.

-> m () 

Sets the given chain function for the pad. The chain function is called to process a Buffer input buffer. see PadChainFunction for more details.

setChainListFunctionFull

padSetChainListFunctionFull Source #

Arguments

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

pad: a sink Pad.

-> PadChainListFunction

chainlist: the PadChainListFunction to set.

-> m () 

Sets the given chain list function for the pad. The chainlist function is called to process a BufferList input buffer list. See PadChainListFunction for more details.

setElementPrivate

padSetElementPrivate Source #

Arguments

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

pad: the Pad to set the private data of.

-> Ptr ()

priv: The private data to attach to the pad.

-> m () 

Set the given private data gpointer on the pad. This function can only be used by the element that owns the pad. No locking is performed in this function.

setEventFullFunctionFull

padSetEventFullFunctionFull Source #

Arguments

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

pad: a Pad of either direction.

-> PadEventFullFunction

event: the PadEventFullFunction to set.

-> m () 

Sets the given event handler for the pad.

Since: 1.8

setEventFunctionFull

padSetEventFunctionFull Source #

Arguments

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

pad: a Pad of either direction.

-> PadEventFunction

event: the PadEventFunction to set.

-> m () 

Sets the given event handler for the pad.

setGetrangeFunctionFull

padSetGetrangeFunctionFull Source #

Arguments

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

pad: a source Pad.

-> PadGetRangeFunction

get: the PadGetRangeFunction to set.

-> m () 

Sets the given getrange function for the pad. The getrange function is called to produce a new Buffer to start the processing pipeline. see PadGetRangeFunction for a description of the getrange function.

setIterateInternalLinksFunctionFull

padSetIterateInternalLinksFunctionFull Source #

Arguments

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

pad: a Pad of either direction.

-> PadIterIntLinkFunction

iterintlink: the PadIterIntLinkFunction to set.

-> m () 

Sets the given internal link iterator function for the pad.

setLinkFunctionFull

padSetLinkFunctionFull Source #

Arguments

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

pad: a Pad.

-> PadLinkFunction

link: the PadLinkFunction to set.

-> m () 

Sets the given link function for the pad. It will be called when the pad is linked with another pad.

The return value GST_PAD_LINK_OK should be used when the connection can be made.

The return value GST_PAD_LINK_REFUSED should be used when the connection cannot be made for some reason.

If link is installed on a source pad, it should call the PadLinkFunction of the peer sink pad, if present.

setOffset

padSetOffset Source #

Arguments

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

pad: a Pad

-> Int64

offset: the offset

-> m () 

Set the offset that will be applied to the running time of pad.

setQueryFunctionFull

padSetQueryFunctionFull Source #

Arguments

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

pad: a Pad of either direction.

-> PadQueryFunction

query: the PadQueryFunction to set.

-> m () 

Set the given query function for the pad.

setUnlinkFunctionFull

padSetUnlinkFunctionFull Source #

Arguments

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

pad: a Pad.

-> PadUnlinkFunction

unlink: the PadUnlinkFunction to set.

-> m () 

Sets the given unlink function for the pad. It will be called when the pad is unlinked.

Note that the pad's lock is already held when the unlink function is called, so most pad functions cannot be called from within the callback.

startTask

padStartTask Source #

Arguments

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

pad: the Pad to start the task of

-> TaskFunction

func: the task function to call

-> m Bool

Returns: a True if the task could be started.

Starts a task that repeatedly calls func with userData. This function is mostly used in pad activation functions to start the dataflow. The GST_PAD_STREAM_LOCK of pad will automatically be acquired before func is called.

stickyEventsForeach

padStickyEventsForeach Source #

Arguments

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

pad: the Pad that should be used for iteration.

-> PadStickyEventsForeachFunction

foreachFunc: the PadStickyEventsForeachFunction that should be called for every event.

-> m () 

Iterates all sticky events on pad and calls foreachFunc for every event. If foreachFunc returns False the iteration is immediately stopped.

stopTask

padStopTask Source #

Arguments

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

pad: the Pad to stop the task of

-> m Bool

Returns: a True if the task could be stopped or False on error.

Stop the task of pad. This function will also make sure that the function executed by the task will effectively stop if not called from the GstTaskFunction.

This function will deadlock if called from the GstTaskFunction of the task. Use taskPause instead.

Regardless of whether the pad has a task, the stream lock is acquired and released so as to ensure that streaming through this pad has finished.

storeStickyEvent

padStoreStickyEvent Source #

Arguments

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

pad: a Pad

-> Event

event: a Event

-> m FlowReturn

Returns: GST_FLOW_OK on success, GST_FLOW_FLUSHING when the pad was flushing or GST_FLOW_EOS when the pad was EOS.

Store the sticky event on pad

Since: 1.2

unlink

padUnlink Source #

Arguments

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

srcpad: the source Pad to unlink.

-> b

sinkpad: the sink Pad to unlink.

-> m Bool

Returns: True if the pads were unlinked. This function returns False if the pads were not linked together.

MT safe.

Unlinks the source pad from the sink pad. Will emit the unlinked signal on both pads.

useFixedCaps

padUseFixedCaps Source #

Arguments

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

pad: the pad to use

-> m () 

A helper function you can use that sets the FIXED_CAPS flag This way the default CAPS query will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps.

The negotiated caps are the caps of the last CAPS event that passed on the pad. Use this function on a pad that, once it negotiated to a CAPS, cannot be renegotiated to something else.

Properties

caps

No description available in the introspection data.

getPadCaps :: (MonadIO m, IsPad o) => o -> m (Maybe Caps) Source #

Get the value of the “caps” property. When overloading is enabled, this is equivalent to

get pad #caps

direction

No description available in the introspection data.

constructPadDirection :: (IsPad o, MonadIO m) => PadDirection -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “direction” property. This is rarely needed directly, but it is used by new.

getPadDirection :: (MonadIO m, IsPad o) => o -> m PadDirection Source #

Get the value of the “direction” property. When overloading is enabled, this is equivalent to

get pad #direction

offset

The offset that will be applied to the running time of the pad.

Since: 1.6

constructPadOffset :: (IsPad o, MonadIO m) => Int64 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “offset” property. This is rarely needed directly, but it is used by new.

getPadOffset :: (MonadIO m, IsPad o) => o -> m Int64 Source #

Get the value of the “offset” property. When overloading is enabled, this is equivalent to

get pad #offset

setPadOffset :: (MonadIO m, IsPad o) => o -> Int64 -> m () Source #

Set the value of the “offset” property. When overloading is enabled, this is equivalent to

set pad [ #offset := value ]

template

No description available in the introspection data.

clearPadTemplate :: (MonadIO m, IsPad o) => o -> m () Source #

Set the value of the “template” property to Nothing. When overloading is enabled, this is equivalent to

clear #template

constructPadTemplate :: (IsPad o, MonadIO m, IsPadTemplate a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “template” property. This is rarely needed directly, but it is used by new.

getPadTemplate :: (MonadIO m, IsPad o) => o -> m (Maybe PadTemplate) Source #

Get the value of the “template” property. When overloading is enabled, this is equivalent to

get pad #template

setPadTemplate :: (MonadIO m, IsPad o, IsPadTemplate a) => o -> a -> m () Source #

Set the value of the “template” property. When overloading is enabled, this is equivalent to

set pad [ #template := value ]

Signals

linked

type PadLinkedCallback Source #

Arguments

 = Pad

peer: the peer pad that has been connected

-> IO () 

Signals that a pad has been linked to the peer pad.

afterPadLinked :: (IsPad a, MonadIO m) => a -> ((?self :: a) => PadLinkedCallback) -> m SignalHandlerId Source #

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

after pad #linked 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.

onPadLinked :: (IsPad a, MonadIO m) => a -> ((?self :: a) => PadLinkedCallback) -> m SignalHandlerId Source #

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

on pad #linked callback

unlinked

type PadUnlinkedCallback Source #

Arguments

 = Pad

peer: the peer pad that has been disconnected

-> IO () 

Signals that a pad has been unlinked from the peer pad.

afterPadUnlinked :: (IsPad a, MonadIO m) => a -> ((?self :: a) => PadUnlinkedCallback) -> m SignalHandlerId Source #

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

after pad #unlinked 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.

onPadUnlinked :: (IsPad a, MonadIO m) => a -> ((?self :: a) => PadUnlinkedCallback) -> m SignalHandlerId Source #

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

on pad #unlinked callback