Pad

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

Pads have a #GstPadDirection, source pads produce data, sink pads consume data.

Pads are typically created from a #GstPadTemplate with gst_pad_new_from_template() and are then added to a #GstElement. 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 gst_pad_new(), which takes a direction and a name as an argument. If the name is %NULL, then a guaranteed unique name will be assigned to it.

A #GstElement 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 #GstElement that owns the pad.

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

Before dataflow is possible on the pads, they need to be activated with gst_pad_set_active().

gst_pad_query() and gst_pad_peer_query() can be used to query various properties of the pad and the stream.

To send a #GstEvent on a pad, use gst_pad_send_event() and gst_pad_push_event(). Some events will be sticky on the pad, meaning that after they pass on the pad they can be queried later with gst_pad_get_sticky_event() and gst_pad_sticky_events_foreach(). gst_pad_get_current_caps() and gst_pad_has_current_caps() are convenience functions to query the current sticky CAPS event on a pad.

GstElements will use gst_pad_push() and gst_pad_pull_range() 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 gst_pad_add_probe(). gst_pad_is_blocked() can be used to check if a block probe is installed on the pad. gst_pad_is_blocking() checks if the blocking probe is currently blocking the pad. gst_pad_remove_probe() is used to remove a previously installed probe and unblock blocking probes if any.

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

Convenience functions exist to start, pause and stop the task on a pad with gst_pad_start_task(), gst_pad_pause_task() and gst_pad_stop_task() respectively.

class Pad : ObjectGst {}

Constructors

this
this(GstPad* gstPad, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(string name, GstPadDirection direction)

Creates a new pad with the given name in the given direction. If name is %NULL, 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.

this
this(StaticPadTemplate templ, string name)

Creates a new pad with the given name from the given static template. If name is %NULL, 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.

this
this(PadTemplate templ, string name)

Creates a new pad with the given name from the given template. If name is %NULL, 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.

Members

Functions

activateMode
bool activateMode(GstPadMode mode, bool active)

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

addOnLinked
gulong addOnLinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags)

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

addOnUnlinked
gulong addOnUnlinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags)

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

addProbe
gulong addProbe(GstPadProbeType mask, GstPadProbeCallback callback, void* userData, GDestroyNotify destroyData)

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

canLink
bool canLink(Pad sinkpad)

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

chain
GstFlowReturn chain(Buffer buffer)

Chain a buffer to @pad.

chainList
GstFlowReturn chainList(BufferList list)

Chain a bufferlist to @pad.

checkReconfigure
bool checkReconfigure()

Check and clear the #GST_PAD_FLAG_NEED_RECONFIGURE flag on @pad and return %TRUE if the flag was set.

createStreamId
string createStreamId(Element parent, string streamId)

Creates a stream-id for the source #GstPad @pad by combining the upstream information with the optional @stream_id of the stream of @pad. @pad must have a parent #GstElement and which must have zero or one sinkpad. @stream_id can only be %NULL if the parent element of @pad has only a single source pad.

createStreamIdPrintfValist
string createStreamIdPrintfValist(Element parent, string streamId, void* varArgs)

Creates a stream-id for the source #GstPad @pad by combining the upstream information with the optional @stream_id of the stream of @pad. @pad must have a parent #GstElement and which must have zero or one sinkpad. @stream_id can only be %NULL if the parent element of @pad has only a single source pad.

eventDefault
bool eventDefault(ObjectGst parent, Event event)

Invokes the default event handler for the given pad.

forward
bool forward(GstPadForwardFunction forward, void* userData)

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.

getAllowedCaps
Caps getAllowedCaps()

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

getCurrentCaps
Caps getCurrentCaps()

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

getDirection
GstPadDirection getDirection()

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
void* getElementPrivate()

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

getLastFlowReturn
GstFlowReturn getLastFlowReturn()

Gets the #GstFlowReturn return from the last data passed by this pad.

getOffset
long getOffset()

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

getPadStruct
GstPad* getPadStruct(bool transferOwnership)

Get the main Gtk struct

getPadTemplate
PadTemplate getPadTemplate()

Gets the template for @pad.

getPadTemplateCaps
Caps getPadTemplateCaps()

Gets the capabilities for @pad's template.

getParentElement
Element getParentElement()

Gets the parent of @pad, cast to a #GstElement. If a @pad has no parent or its parent is not an element, return %NULL.

getPeer
Pad getPeer()

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

getRange
GstFlowReturn getRange(ulong offset, uint size, Buffer buffer)

When @pad is flushing this function returns #GST_FLOW_FLUSHING immediately and @buffer is %NULL.

getSingleInternalLink
Pad getSingleInternalLink()

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

getStickyEvent
Event getStickyEvent(GstEventType eventType, uint idx)

Returns a new reference of the sticky event of type @event_type from the event.

getStream
Stream getStream()

Returns the current #GstStream for the @pad, or %NULL if none has been set yet, i.e. the pad has not received a stream-start event yet.

getStreamId
string getStreamId()

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

getStruct
void* getStruct()

the main Gtk struct as a void*

getTaskState
GstTaskState getTaskState()

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

hasCurrentCaps
bool hasCurrentCaps()

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

isActive
bool isActive()

Query if a pad is active

isBlocked
bool isBlocked()

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 gst_pad_is_blocking()).

isBlocking
bool isBlocking()

Checks if the pad is blocking or not. This is a guaranteed state of whether the pad is actually blocking on a #GstBuffer or a #GstEvent.

isLinked
bool isLinked()

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

iterateInternalLinks
Iterator iterateInternalLinks()

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

iterateInternalLinksDefault
Iterator iterateInternalLinksDefault(ObjectGst parent)

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.

link
GstPadLinkReturn link(Pad sinkpad)

Links the source pad and the sink pad.

linkFull
GstPadLinkReturn linkFull(Pad sinkpad, GstPadLinkCheck flags)

Links the source pad and the sink pad.

linkMaybeGhosting
bool linkMaybeGhosting(Pad sink)

Links @src to @sink, creating any #GstGhostPad's in between as necessary.

linkMaybeGhostingFull
bool linkMaybeGhostingFull(Pad sink, GstPadLinkCheck flags)

Links @src to @sink, creating any #GstGhostPad's in between as necessary.

markReconfigure
void markReconfigure()

Mark a pad for needing reconfiguration. The next call to gst_pad_check_reconfigure() will return %TRUE after this call.

needsReconfigure
bool needsReconfigure()

Check the #GST_PAD_FLAG_NEED_RECONFIGURE flag on @pad and return %TRUE if the flag was set.

pauseTask
bool pauseTask()

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
bool peerQuery(Query query)

Performs gst_pad_query() on the peer of @pad.

peerQueryAcceptCaps
bool peerQueryAcceptCaps(Caps caps)

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

peerQueryCaps
Caps peerQueryCaps(Caps filter)

Gets the capabilities of the peer connected to this pad. Similar to gst_pad_query_caps().

peerQueryConvert
bool peerQueryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, long destVal)

Queries the peer pad of a given sink pad to convert @src_val in @src_format to @dest_format.

peerQueryDuration
bool peerQueryDuration(GstFormat format, long duration)

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

peerQueryPosition
bool peerQueryPosition(GstFormat format, long cur)

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

proxyQueryAcceptCaps
bool proxyQueryAcceptCaps(Query query)

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

proxyQueryCaps
bool proxyQueryCaps(Query query)

Calls gst_pad_query_caps() for all internally linked pads of @pad and returns the intersection of the results.

pullRange
GstFlowReturn pullRange(ulong offset, uint size, Buffer buffer)

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

push
GstFlowReturn push(Buffer buffer)

Pushes a buffer to the peer of @pad.

pushEvent
bool pushEvent(Event event)

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

pushList
GstFlowReturn pushList(BufferList list)

Pushes a buffer list to the peer of @pad.

query
bool query(Query query)

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.

queryAcceptCaps
bool queryAcceptCaps(Caps caps)

Check if the given pad accepts the caps.

queryCaps
Caps queryCaps(Caps filter)

Gets the capabilities this pad can produce or consume. Note that this method doesn't necessarily return the caps set by sending a gst_event_new_caps() - use gst_pad_get_current_caps() 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 %NULL, otherwise ANY.

queryConvert
bool queryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, long destVal)

Queries a pad to convert @src_val in @src_format to @dest_format.

queryDefault
bool queryDefault(ObjectGst parent, Query query)

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
long queryDuration()

Queries a pad for the stream duration. This is a convenience function for gstreamerD.

queryDuration
bool queryDuration(GstFormat format, long duration)

Queries a pad for the total stream duration.

queryPosition
long queryPosition()

Queries a pad for the stream position. This is a convenience function for gstreamerD.

queryPosition
bool queryPosition(GstFormat format, long cur)

Queries a pad for the stream position.

removeProbe
void removeProbe(gulong id)

Remove the probe with @id from @pad.

sendEvent
bool sendEvent(Event event)

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

setActivateFunctionFull
void setActivateFunctionFull(GstPadActivateFunction activate, void* userData, GDestroyNotify notify)

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

setActivatemodeFunctionFull
void setActivatemodeFunctionFull(GstPadActivateModeFunction activatemode, void* userData, GDestroyNotify notify)

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

setActive
bool setActive(bool active)

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

setChainFunctionFull
void setChainFunctionFull(GstPadChainFunction chain, void* userData, GDestroyNotify notify)

Sets the given chain function for the pad. The chain function is called to process a #GstBuffer input buffer. see #GstPadChainFunction for more details.

setChainListFunctionFull
void setChainListFunctionFull(GstPadChainListFunction chainlist, void* userData, GDestroyNotify notify)

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

setElementPrivate
void setElementPrivate(void* priv)

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
void setEventFullFunctionFull(GstPadEventFullFunction event, void* userData, GDestroyNotify notify)

Sets the given event handler for the pad.

setEventFunctionFull
void setEventFunctionFull(GstPadEventFunction event, void* userData, GDestroyNotify notify)

Sets the given event handler for the pad.

setGetrangeFunctionFull
void setGetrangeFunctionFull(GstPadGetRangeFunction get, void* userData, GDestroyNotify notify)

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

setIterateInternalLinksFunctionFull
void setIterateInternalLinksFunctionFull(GstPadIterIntLinkFunction iterintlink, void* userData, GDestroyNotify notify)

Sets the given internal link iterator function for the pad.

setLinkFunctionFull
void setLinkFunctionFull(GstPadLinkFunction link, void* userData, GDestroyNotify notify)

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

setOffset
void setOffset(long offset)

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

setQueryFunctionFull
void setQueryFunctionFull(GstPadQueryFunction query, void* userData, GDestroyNotify notify)

Set the given query function for the pad.

setUnlinkFunctionFull
void setUnlinkFunctionFull(GstPadUnlinkFunction unlink, void* userData, GDestroyNotify notify)

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

startTask
bool startTask(GstTaskFunction func, void* userData, GDestroyNotify notify)

Starts a task that repeatedly calls @func with @user_data. 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
void stickyEventsForeach(GstPadStickyEventsForeachFunction foreachFunc, void* userData)

Iterates all sticky events on @pad and calls @foreach_func for every event. If @foreach_func returns %FALSE the iteration is immediately stopped.

stopTask
bool stopTask()

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.

storeStickyEvent
GstFlowReturn storeStickyEvent(Event event)

Store the sticky @event on @pad

unlink
bool unlink(Pad sinkpad)

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

useFixedCaps
void useFixedCaps()

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.

Static functions

flowGetName
string flowGetName(GstFlowReturn ret)

Gets a string representing the given flow return.

flowToQuark
GQuark flowToQuark(GstFlowReturn ret)

Get the unique quark for the given GstFlowReturn.

getType
GType getType()
linkGetName
string linkGetName(GstPadLinkReturn ret)

Gets a string representing the given pad-link return.

modeGetName
string modeGetName(GstPadMode mode)

Return the name of a pad mode, for use in debug messages mostly.

Variables

gstPad
GstPad* gstPad;

the main Gtk struct

Inherited Members

From ObjectGst

gstObject
GstObject* gstObject;

the main Gtk struct

getObjectGstStruct
GstObject* getObjectGstStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
checkUniqueness
bool checkUniqueness(ListG list, string name)

Checks to see if there is any object named @name in @list. This function does not do any locking of any kind. You might want to protect the provided list with the lock of the owner of the list. This function will lock each #GstObject in the list to compare the name, so be careful when passing a list with a locked object.

defaultDeepNotify
void defaultDeepNotify(ObjectG object, ObjectGst orig, ParamSpec pspec, string[] excludedProps)

A default deep_notify signal callback for an object. The user data should contain a pointer to an array of strings that should be excluded from the notify. The default handler will print the new value of the property using g_print.

refSink
void* refSink(void* object)

Increase the reference count of @object, and possibly remove the floating reference, if @object has a floating reference.

replace
bool replace(ObjectGst oldobj, ObjectGst newobj)

Atomically modifies a pointer to point to a new object. The reference count of @oldobj is decreased and the reference count of @newobj is increased.

addControlBinding
bool addControlBinding(ControlBinding binding)

Attach the #GstControlBinding to the object. If there already was a #GstControlBinding for this property it will be replaced.

defaultError
void defaultError(ErrorG error, string debug_)

A default error function that uses g_printerr() to display the error message and the optional debug string..

getControlBinding
ControlBinding getControlBinding(string propertyName)

Gets the corresponding #GstControlBinding for the property. This should be unreferenced again after use.

getControlRate
GstClockTime getControlRate()

Obtain the control-rate for this @object. Audio processing #GstElement objects will use this rate to sub-divide their processing loop and call gst_object_sync_values() in between. The length of the processing segment should be up to @control-rate nanoseconds.

getGValueArray
bool getGValueArray(string propertyName, GstClockTime timestamp, GstClockTime interval, Value[] values)

Gets a number of #GValues for the given controlled property starting at the requested time. The array @values need to hold enough space for @n_values of #GValue.

getName
string getName()

Returns a copy of the name of @object. Caller should g_free() the return value after usage. For a nameless object, this returns %NULL, which you can safely g_free() as well.

getParent
ObjectGst getParent()

Returns the parent of @object. This function increases the refcount of the parent object so you should gst_object_unref() it after usage.

getPathString
string getPathString()

Generates a string describing the path of @object in the object hierarchy. Only useful (or used) for debugging.

getValue
Value getValue(string propertyName, GstClockTime timestamp)

Gets the value for the given controlled property at the requested time.

getValueArray
bool getValueArray(string propertyName, GstClockTime timestamp, GstClockTime interval, uint nValues, void* values)

Gets a number of values for the given controlled property starting at the requested time. The array @values need to hold enough space for @n_values of the same type as the objects property's type.

hasActiveControlBindings
bool hasActiveControlBindings()

Check if the @object has active controlled properties.

hasAncestor
bool hasAncestor(ObjectGst ancestor)

Check if @object has an ancestor @ancestor somewhere up in the hierarchy. One can e.g. check if a #GstElement is inside a #GstPipeline.

hasAsAncestor
bool hasAsAncestor(ObjectGst ancestor)

Check if @object has an ancestor @ancestor somewhere up in the hierarchy. One can e.g. check if a #GstElement is inside a #GstPipeline.

hasAsParent
bool hasAsParent(ObjectGst parent)

Check if @parent is the parent of @object. E.g. a #GstElement can check if it owns a given #GstPad.

doref
alias doref = ref_
Undocumented in source.
ref_
ObjectGst ref_()

Increments the reference count on @object. This function does not take the lock on @object because it relies on atomic refcounting.

removeControlBinding
bool removeControlBinding(ControlBinding binding)

Removes the corresponding #GstControlBinding. If it was the last ref of the binding, it will be disposed.

setControlBindingDisabled
void setControlBindingDisabled(string propertyName, bool disabled)

This function is used to disable the control bindings on a property for some time, i.e. gst_object_sync_values() will do nothing for the property.

setControlBindingsDisabled
void setControlBindingsDisabled(bool disabled)

This function is used to disable all controlled properties of the @object for some time, i.e. gst_object_sync_values() will do nothing.

setControlRate
void setControlRate(GstClockTime controlRate)

Change the control-rate for this @object. Audio processing #GstElement objects will use this rate to sub-divide their processing loop and call gst_object_sync_values() in between. The length of the processing segment should be up to @control-rate nanoseconds.

setName
bool setName(string name)

Sets the name of @object, or gives @object a guaranteed unique name (if @name is %NULL). This function makes a copy of the provided name, so the caller retains ownership of the name it sent.

setParent
bool setParent(ObjectGst parent)

Sets the parent of @object to @parent. The object's reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink()).

suggestNextSync
GstClockTime suggestNextSync()

Returns a suggestion for timestamps where buffers should be split to get best controller results.

syncValues
bool syncValues(GstClockTime timestamp)

Sets the properties of the object, according to the #GstControlSources that (maybe) handle them and for the given timestamp.

unparent
void unparent()

Clear the parent of @object, removing the associated reference. This function decreases the refcount of @object.

unref
void unref()

Decrements the reference count on @object. If reference count hits zero, destroy @object. This function does not take the lock on @object as it relies on atomic refcounting.

addOnDeepNotify
gulong addOnDeepNotify(void delegate(ObjectGst, ParamSpec, ObjectGst) dlg, ConnectFlags connectFlags)

The deep notify signal is used to be notified of property changes. It is typically attached to the toplevel bin to receive notifications from all the elements contained in that bin.

Meta