Next: , Previous: GstPadTemplate, Up: Top


25 GstPad

Object contained by elements that allows links to other elements

25.1 Overview

A <gst-element> is linked to other elements via "pads", which are extremely light-weight generic link points. After two pads are retrieved from an element with gst-element-get-pad, the pads can be link 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 are typically created from a <gst-pad-template> with gst-pad-new-from-template.

Pads have <gst-caps> attached to it to describe the media type they are capable of dealing with. gst-pad-get-caps and gst-pad-set-caps are used to manipulate the caps of the pads. Pads created from a pad template cannot set capabilities that are incompatible with the pad template capabilities.

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.

gst-pad-get-parent will retrieve the <gst-element> that owns the pad.

A <gst-element> creating a pad will typically use the various gst_pad_set_*-function calls to register callbacks for various events on the pads.

GstElements will use gst-pad-push and gst-pad-pull-range to push out or pull in a buffer.

To send a <gst-event> on a pad, use gst-pad-send-event and gst-pad-push-event.

Last reviewed on 2006-07-06 (0.10.9)

25.2 Usage

— Class: <gst-pad>

This <gobject> class defines the following properties:

caps
The capabilities of the pad
direction
The direction of the pad
template
The GstPadTemplate of this pad
— Signal on <gst-pad>: linked (arg0 <gst-pad>)

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

— Signal on <gst-pad>: unlinked (arg0 <gst-pad>)

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

— Signal on <gst-pad>: request-link

Signals that a pad connection has been requested.

— Signal on <gst-pad>: have-data (arg0 <gst-mini-object>)  <gboolean>

Signals that new data is available on the pad. This signal is used internally for implementing pad probes. See gst_pad_add_*_probe functions.

— Function: gst-pad-get-direction (self <gst-pad>)   (ret <gst-pad-direction>)
— Method: get-direction

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

pad
a <gst-pad> to get the direction of.
ret
the <gst-pad-direction> of the pad. MT safe.
— Function: gst-pad-get-parent-element (self <gst-pad>)   (ret <gst-element>)
— Method: get-parent-element

Gets the parent of pad, cast to a <gst-element>. If a pad has no parent or its parent is not an element, return NULL.

pad
a pad
ret
The parent of the pad. The caller has a reference on the parent, so unref when you're finished with it. MT safe.
— Function: gst-pad-get-pad-template (self <gst-pad>)   (ret <gst-pad-template>)
— Method: get-pad-template

Gets the template for pad.

pad
a <gst-pad>.
ret
the <gst-pad-template> from which this pad was instantiated, or ‘#f’ if this pad has no template. FIXME: currently returns an unrefcounted padtemplate.
— Function: gst-pad-link (self <gst-pad>) (sinkpad <gst-pad>)   (ret <gst-pad-link-return>)
— Method: link

Links the source pad and the sink pad.

srcpad
the source <gst-pad> to link.
sinkpad
the sink <gst-pad> to link.
ret
A result code indicating if the connection worked or what went wrong. MT Safe.
— Function: gst-pad-unlink (self <gst-pad>) (sinkpad <gst-pad>)   (ret bool)
— Method: unlink

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

srcpad
the source <gst-pad> to unlink.
sinkpad
the sink <gst-pad> to unlink.
ret
TRUE if the pads were unlinked. This function returns FALSE if the pads were not linked together. MT safe.
— Function: gst-pad-is-linked (self <gst-pad>)   (ret bool)
— Method: is-linked

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

pad
pad to check
ret
TRUE if the pad is linked, FALSE otherwise. MT safe.
— Function: gst-pad-can-link (self <gst-pad>) (sinkpad <gst-pad>)   (ret bool)
— Method: can-link

Checks if the source pad and the sink pad can be linked. Both srcpad and sinkpad must be unlinked.

srcpad
the source <gst-pad> to link.
sinkpad
the sink <gst-pad> to link.
ret
TRUE if the pads can be linked, FALSE otherwise.
— Function: gst-pad-get-caps (self <gst-pad>)   (ret <gst-caps>)
— Method: get-caps

Gets the capabilities this pad can produce or consume. Note that this method doesn't necessarily return the caps set by gst-pad-set-caps - use <gst-pad-caps> for that instead. gst_pad_get_caps returns all possible caps a pad can operate with, using the pad's get_caps function; this returns the pad template caps if not explicitly set.

pad
a <gst-pad> to get the capabilities of.
ret
a newly allocated copy of the <gst-caps> of this pad. MT safe.
— Function: gst-pad-get-allowed-caps (self <gst-pad>)   (ret <gst-caps>)
— Method: get-allowed-caps

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 gst-pad-get-caps on pad and its peer. The caller owns a reference on the resulting caps.

pad
a <gst-pad>.
ret
the allowed <gst-caps> of the pad link. Unref the caps when you no longer need it. This function returns NULL when pad has no peer. MT safe.
— Function: gst-pad-get-negotiated-caps (self <gst-pad>)   (ret <gst-caps>)
— Method: get-negotiated-caps

Gets the capabilities of the media type that currently flows through pad and its peer.

This function can be used on both src and sinkpads. Note that srcpads are always negotiated before sinkpads so it is possible that the negotiated caps on the srcpad do not match the negotiated caps of the peer.

pad
a <gst-pad>.
ret
the negotiated <gst-caps> of the pad link. Unref the caps when you no longer need it. This function returns NULL when the pad has no peer or is not negotiated yet. MT safe.
— Function: gst-pad-get-pad-template-caps (self <gst-pad>)   (ret <gst-caps>)
— Method: get-pad-template-caps

Gets the capabilities for pad's template.

pad
a <gst-pad> to get the template capabilities from.
ret
the <gst-caps> of this pad template. If you intend to keep a reference on the caps, make a copy (see gst-caps-copy).
— Function: gst-pad-set-caps (self <gst-pad>) (caps <gst-caps>)   (ret bool)
— Method: set-caps

Sets the capabilities of this pad. The caps must be fixed. Any previous caps on the pad will be unreffed. This function refs the caps so you should unref if as soon as you don't need it anymore. It is possible to set NULL caps, which will make the pad unnegotiated again.

pad
a <gst-pad> to set the capabilities of.
caps
a <gst-caps> to set.
ret
TRUE if the caps could be set. FALSE if the caps were not fixed or bad parameters were provided to this function. MT safe.
— Function: gst-pad-get-peer (self <gst-pad>)   (ret <gst-pad>)
— Method: get-peer

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

pad
a <gst-pad> to get the peer of.
ret
the peer <gst-pad>. Unref after usage. MT safe.
— Function: gst-pad-peer-get-caps (self <gst-pad>)   (ret <gst-caps>)
— Method: peer-get-caps

Gets the capabilities of the peer connected to this pad.

pad
a <gst-pad> to get the peer capabilities of.
ret
the <gst-caps> of the peer pad. This function returns a new caps, so use gst_caps_unref to get rid of it. this function returns NULL if there is no peer pad.
— Function: gst-pad-use-fixed-caps (self <gst-pad>)
— Method: use-fixed-caps

A helper function you can use that sets the gst-pad-get-fixed-caps-func as the getcaps function for the pad. This way the function will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps.

Use this function on a pad that, once -set-caps has been called on it, cannot be renegotiated to something else.

pad
the pad to use
— Function: gst-pad-is-active (self <gst-pad>)   (ret bool)
— Method: is-active

Query if a pad is active

pad
the <gst-pad> to query
ret
TRUE if the pad is active. MT safe.
— Function: gst-pad-set-blocked (self <gst-pad>) (blocked bool)   (ret bool)
— Method: set-blocked

Blocks or unblocks the dataflow on a pad. This function is a shortcut for gst-pad-set-blocked-async with a NULL callback.

pad
the <gst-pad> to block or unblock
blocked
boolean indicating we should block or unblock
ret
TRUE if the pad could be blocked. This function can fail if the wrong parameters were passed or the pad was already in the requested state. MT safe.
— Function: gst-pad-set-blocked-async (self <gst-pad>) (blocked bool) (callback <gst-pad-block-callback>) (user_data <gpointer>)   (ret bool)
— Method: set-blocked-async

Blocks or unblocks the dataflow on a pad. The provided callback is called when the operation succeeds; this happens right before the next attempt at pushing a buffer on the pad.

This can take a while as the pad can only become blocked when real dataflow is happening. When the pipeline is stalled, for example in PAUSED, this can take an indeterminate amount of time. You can pass NULL as the callback to make this call block. Be careful with this blocking call as it might not return for reasons stated above.

pad
the <gst-pad> to block or unblock
blocked
boolean indicating whether the pad should be blocked or unblocked
callback
<gst-pad-block-callback> that will be called when the operation succeeds
user-data
user data passed to the callback
ret
TRUE if the pad could be blocked. This function can fail if the wrong parameters were passed or the pad was already in the requested state. MT safe.
— Function: gst-pad-is-blocked (self <gst-pad>)   (ret bool)
— Method: is-blocked

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

pad
the <gst-pad> to query
ret
TRUE if the pad is blocked. MT safe.
— Function: gst-pad-add-data-probe (self <gst-pad>) (handler <g-callback>) (data <gpointer>)   (ret unsigned-long)
— Method: add-data-probe

Adds a "data probe" to a pad. This function will be called whenever data passes through a pad. In this case data means both events and buffers. The probe will be called with the data as an argument, meaning handler should have the same callback signature as the 'have-data' signal of <gst-pad>. Note that the data will have a reference count greater than 1, so it will be immutable – you must not change it.

For source pads, the probe will be called after the blocking function, if any (see gst-pad-set-blocked-async), but before looking up the peer to chain to. For sink pads, the probe function will be called before configuring the sink with new caps, if any, and before calling the pad's chain function.

Your data probe should return TRUE to let the data continue to flow, or FALSE to drop it. Dropping data is rarely useful, but occasionally comes in handy with events.

Although probes are implemented internally by connecting handler to the have-data signal on the pad, if you want to remove a probe it is insufficient to only call g_signal_handler_disconnect on the returned handler id. To remove a probe, use the appropriate function, such as gst-pad-remove-data-probe.

pad
pad to add the data probe handler to
handler
function to call when data is passed over pad
data
data to pass along with the handler
ret
The handler id.
— Function: gst-pad-add-buffer-probe (self <gst-pad>) (handler <g-callback>) (data <gpointer>)   (ret unsigned-long)
— Method: add-buffer-probe

Adds a probe that will be called for all buffers passing through a pad. See gst-pad-add-data-probe for more information.

pad
pad to add the buffer probe handler to
handler
function to call when data is passed over pad
data
data to pass along with the handler
ret
The handler id
— Function: gst-pad-add-event-probe (self <gst-pad>) (handler <g-callback>) (data <gpointer>)   (ret unsigned-long)
— Method: add-event-probe

Adds a probe that will be called for all events passing through a pad. See gst-pad-add-data-probe for more information.

pad
pad to add the event probe handler to
handler
function to call when data is passed over pad
data
data to pass along with the handler
ret
The handler id
— Function: gst-pad-remove-data-probe (self <gst-pad>) (handler_id unsigned-int)
— Method: remove-data-probe

Removes a data probe from pad.

pad
pad to remove the data probe handler from
handler-id
handler id returned from gst_pad_add_data_probe
— Function: gst-pad-remove-buffer-probe (self <gst-pad>) (handler_id unsigned-int)
— Method: remove-buffer-probe

Removes a buffer probe from pad.

pad
pad to remove the buffer probe handler from
handler-id
handler id returned from gst_pad_add_buffer_probe
— Function: gst-pad-remove-event-probe (self <gst-pad>) (handler_id unsigned-int)
— Method: remove-event-probe

Removes an event probe from pad.

pad
pad to remove the event probe handler from
handler-id
handler id returned from gst_pad_add_event_probe
— Function: gst-pad-new (name mchars) (direction <gst-pad-direction>)   (ret <gst-pad>)

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.

name
the name of the new pad.
direction
the <gst-pad-direction> of the pad.
ret
a new <gst-pad>, or NULL in case of an error. MT safe.
— Function: gst-pad-new-from-template (templ <gst-pad-template>) (name mchars)   (ret <gst-pad>)

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.

templ
the pad template to use
name
the name of the element
ret
a new <gst-pad>, or NULL in case of an error.
— Function: gst-pad-new-from-static-template (templ <gst-static-pad-template*>) (name mchars)   (ret <gst-pad>)

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.

templ
the <gst-static-pad-template> to use
name
the name of the element
ret
a new <gst-pad>, or NULL in case of an error.
— Function: gst-pad-alloc-buffer (self <gst-pad>) (offset unsigned-int64) (size int) (caps <gst-caps>) (buf <gst-buffer**>)   (ret <gst-flow-return>)
— Method: alloc-buffer

Allocates a new, empty buffer optimized to push to pad pad. This function only works if pad is a source pad and has a peer.

A new, empty <gst-buffer> will be put in the buf argument. You need to check the caps of the buffer after performing this function and renegotiate to the format if needed.

pad
a source <gst-pad>
offset
the offset of the new buffer in the stream
size
the size of the new buffer
caps
the caps of the new buffer
buf
a newly allocated buffer
ret
a result code indicating success of the operation. Any result code other than <gst-flow-ok> is an error and buf should not be used. An error can occur if the pad is not connected or when the downstream peer elements cannot provide an acceptable buffer. MT safe.
— Function: gst-pad-alloc-buffer-and-set-caps (self <gst-pad>) (offset unsigned-int64) (size int) (caps <gst-caps>) (buf <gst-buffer**>)   (ret <gst-flow-return>)
— Method: alloc-buffer-and-set-caps

In addition to the function gst-pad-alloc-buffer, this function automatically calls gst-pad-set-caps when the caps of the newly allocated buffer are different from the pad caps.

pad
a source <gst-pad>
offset
the offset of the new buffer in the stream
size
the size of the new buffer
caps
the caps of the new buffer
buf
a newly allocated buffer
ret
a result code indicating success of the operation. Any result code other than <gst-flow-ok> is an error and buf should not be used. An error can occur if the pad is not connected or when the downstream peer elements cannot provide an acceptable buffer. MT safe.
— Function: gst-pad-set-chain-function (self <gst-pad>) (chain-function scm)
— Method: set-chain-function

Sets the given chain function for the pad. The chain function is called to process a <gst-buffer> input buffer. see <gst-pad-chain-function> for more details.

pad
a sink <gst-pad>.
chain
the <gst-pad-chain-function> to set.
— Function: gst-pad-get-range (self <gst-pad>) (offset unsigned-int64) (size unsigned-int) (buffer <gst-buffer**>)   (ret <gst-flow-return>)
— Method: get-range

When pad is flushing this function returns <gst-flow-wrong-state> immediatly.

Calls the getrange function of pad, see <gst-pad-get-range-function> 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>.

buffer's caps must either be unset or the same as what is already configured on pad. Renegotiation within a running pull-mode pipeline is not supported.

This is a lowlevel function. Usualy gst-pad-pull-range is used.

pad
a src <gst-pad>, returns <gst-flow-error> if not.
offset
The start offset of the buffer
size
The length of the buffer
buffer
a pointer to hold the <gst-buffer>, returns <gst-flow-error> if ‘#f’.
ret
a <gst-flow-return> from the pad. MT safe.
— Function: gst-pad-set-getrange-function (self <gst-pad>) (get-function scm)
— Method: set-getrange-function

Sets the given getrange function for the pad. The getrange function is called to produce a new <gst-buffer> to start the processing pipeline. see <gst-pad-get-range-function> for a description of the getrange function.

pad
a source <gst-pad>.
get
the <gst-pad-get-range-function> to set.
— Function: gst-pad-accept-caps (self <gst-pad>) (caps <gst-caps>)   (ret bool)
— Method: accept-caps

Check if the given pad accepts the caps.

pad
a <gst-pad> to check
caps
a <gst-caps> to check on the pad
ret
TRUE if the pad can accept the caps.
— Function: gst-pad-proxy-getcaps (self <gst-pad>)   (ret <gst-caps>)
— Method: proxy-getcaps

Calls gst-pad-get-allowed-caps for every other pad belonging to the same element as pad, and returns the intersection of the results.

This function is useful as a default getcaps 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 aggregator.

pad
a <gst-pad> to proxy.
ret
the intersection of the other pads' allowed caps.
— Function: gst-pad-set-setcaps-function (self <gst-pad>) (setcaps-function scm)
— Method: set-setcaps-function

Sets the given setcaps function for the pad. The setcaps function will be called whenever a buffer with a new media type is pushed or pulled from the pad. The pad/element needs to update its internal structures to process the new media type. If this new type is not acceptable, the setcaps function should return FALSE.

pad
a <gst-pad>.
setcaps
the <gst-pad-set-caps-function> to set.
— Function: gst-pad-proxy-setcaps (self <gst-pad>) (caps <gst-caps>)   (ret bool)
— Method: proxy-setcaps

Calls gst-pad-set-caps for every other pad belonging to the same element as pad. If gst-pad-set-caps fails on any pad, the proxy setcaps fails. May be used only during negotiation.

pad
a <gst-pad> to proxy from
caps
the <gst-caps> to link with
ret
TRUE if sucessful
— Function: gst-pad-fixate-caps (self <gst-pad>) (caps <gst-caps>)
— Method: fixate-caps

Fixate a caps on the given pad. Modifies the caps in place, so you should make sure that the caps are actually writable (see gst-caps-make-writable).

pad
a <gst-pad> to fixate
caps
the <gst-caps> to fixate
— Function: gst-pad-get-fixed-caps-func (self <gst-pad>)   (ret <gst-caps>)
— Method: get-fixed-caps-func

A helper function you can use as a GetCaps function that will return the currently negotiated caps or the padtemplate when NULL.

pad
the pad to use
ret
The currently negotiated caps or the padtemplate.
— Function: gst-pad-peer-accept-caps (self <gst-pad>) (caps <gst-caps>)   (ret bool)
— Method: peer-accept-caps

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

pad
a <gst-pad> to check the peer of
caps
a <gst-caps> to check on the pad
ret
TRUE if the peer of pad can accept the caps or pad has no peer.
— Function: gst-pad-push (self <gst-pad>) (buffer <gst-buffer>)   (ret <gst-flow-return>)
— Method: push

Pushes a buffer to the peer of pad.

This function will call an installed pad block before triggering any installed pad probes.

If the caps on buffer are different from the currently configured caps on pad, this function will call any installed setcaps function on pad (see gst-pad-set-setcaps-function). In case of failure to renegotiate the new format, this function returns <gst-flow-not-negotiated>.

The function proceeds calling gst-pad-chain 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.

pad
a source <gst-pad>, returns <gst-flow-error> if not.
buffer
the <gst-buffer> to push returns GST_FLOW_ERROR if not.
ret
a <gst-flow-return> from the peer pad. MT safe.
— Function: gst-pad-push-event (self <gst-pad>) (event <gst-event>)   (ret bool)
— Method: push-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.

This function takes owership of the provided event so you should gst-event-ref it if you want to reuse the event after this call.

pad
a <gst-pad> to push the event to.
event
the <gst-event> to send to the pad.
ret
TRUE if the event was handled. MT safe.
— Function: gst-pad-check-pull-range (self <gst-pad>)   (ret bool)
— Method: check-pull-range

Checks if a gst-pad-pull-range can be performed on the peer source pad. This function is used by plugins that want to check if they can use random access on the peer source pad.

The peer sourcepad can implement a custom <gst-pad-check-get-range-function> if it needs to perform some logic to determine if pull_range is possible.

pad
a sink <gst-pad>.
ret
a gboolean with the result. MT safe.
— Function: gst-pad-pull-range (self <gst-pad>) (offset unsigned-int64) (size unsigned-int) (buffer <gst-buffer**>)   (ret <gst-flow-return>)
— Method: pull-range

Pulls a buffer from the peer pad.

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 gst-pad-get-range on the peer pad. See gst-pad-get-range for a list of return values and for the semantics of the arguments of this function.

buffer's caps must either be unset or the same as what is already configured on pad. Renegotiation within a running pull-mode pipeline is not supported.

pad
a sink <gst-pad>, returns GST_FLOW_ERROR if not.
offset
The start offset of the buffer
size
The length of the buffer
buffer
a pointer to hold the <gst-buffer>, returns GST_FLOW_ERROR if ‘#f’.
ret
a <gst-flow-return> from the peer pad. When this function returns <gst-flow-ok>, buffer will contain a valid <gst-buffer> that should be freed with gst-buffer-unref after usage. buffer may not be used or freed when any other return value than <gst-flow-ok> is returned. MT safe.
— Function: gst-pad-activate-pull (self <gst-pad>) (active bool)   (ret bool)
— Method: activate-pull

Activates or deactivates the given pad in pull mode via dispatching to the pad's activatepullfunc. For use from within pad activation functions only. When called on sink pads, will first proxy the call to the peer pad, which is expected to activate its internally linked pads from within its activate_pull function.

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

pad
the <gst-pad> to activate or deactivate.
active
whether or not the pad should be active.
ret
TRUE if the operation was successful. MT safe.
— Function: gst-pad-activate-push (self <gst-pad>) (active bool)   (ret bool)
— Method: activate-push

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

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

pad
the <gst-pad> to activate or deactivate.
active
whether the pad should be active or not.
ret
#t’ if the operation was successful. MT safe.
— Function: gst-pad-send-event (self <gst-pad>) (event <gst-event>)   (ret bool)
— Method: send-event

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 <gst-event-type-flags>, gst-event-type-get-flags, <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 owership of the provided event so you should gst-event-ref it if you want to reuse the event after this call.

pad
a <gst-pad> to send the event to.
event
the <gst-event> to send to the pad.
ret
TRUE if the event was handled.
— Function: gst-pad-event-default (self <gst-pad>) (event <gst-event>)   (ret bool)
— Method: event-default

Invokes the default event handler for the given pad. End-of-stream and discontinuity events are handled specially, and then the event 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 an event. Multi-sinkpad elements should implement custom event handlers.

pad
a <gst-pad> to call the default event handler on.
event
the <gst-event> to handle.
ret
TRUE if the event was sent succesfully.
— Function: gst-pad-query (self <gst-pad>) (query <gst-query>)   (ret bool)
— Method: query

Dispatches a query to a pad. The query should have been allocated by the caller via one of the type-specific allocation functions in gstquery.h. The element 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.

pad
a <gst-pad> to invoke the default query on.
query
the <gst-query> to perform.
ret
TRUE if the query could be performed.
— Function: gst-pad-query-default (self <gst-pad>) (query <gst-query>)   (ret bool)
— Method: query-default

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.

pad
a <gst-pad> to call the default query handler on.
query
the <gst-query> to handle.
ret
TRUE if the query was performed succesfully.
— Function: gst-pad-query-position (self <gst-pad>) (format <gst-format*>)   (ret bool) (cur int64)
— Method: query-position

Queries a pad for the stream position.

pad
a <gst-pad> to invoke the position query on.
format
a pointer to the <gst-format> asked for. On return contains the <gst-format> used.
cur
A location in which to store the current position, or NULL.
ret
TRUE if the query could be performed.
— Function: gst-pad-query-duration (self <gst-pad>) (format <gst-format*>)   (ret bool) (duration int64)
— Method: query-duration

Queries a pad for the total stream duration.

pad
a <gst-pad> to invoke the duration query on.
format
a pointer to the <gst-format> asked for. On return contains the <gst-format> used.
duration
A location in which to store the total duration, or NULL.
ret
TRUE if the query could be performed.
— Function: gst-pad-query-convert (self <gst-pad>) (src_format <gst-format>) (src_val int64) (dest_format <gst-format*>)   (ret bool) (dest_val int64)
— Method: query-convert

Queries a pad to convert src-val in src-format to dest-format.

pad
a <gst-pad> to invoke the convert query on.
src-format
a <gst-format> to convert from.
src-val
a value to convert.
dest-format
a pointer to the <gst-format> to convert to.
dest-val
a pointer to the result.
ret
TRUE if the query could be performed.
— Function: gst-pad-query-peer-position (self <gst-pad>) (format <gst-format*>)   (ret bool) (cur int64)
— Method: query-peer-position

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

pad
a <gst-pad> on whose peer to invoke the position query on. Must be a sink pad.
format
a pointer to the <gst-format> asked for. On return contains the <gst-format> used.
cur
A location in which to store the current position, or NULL.
ret
TRUE if the query could be performed.
— Function: gst-pad-query-peer-duration (self <gst-pad>) (format <gst-format*>)   (ret bool) (duration int64)
— Method: query-peer-duration

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

pad
a <gst-pad> on whose peer pad to invoke the duration query on. Must be a sink pad.
format
a pointer to the <gst-format> asked for. On return contains the <gst-format> used.
duration
A location in which to store the total duration, or NULL.
ret
TRUE if the query could be performed.
— Function: gst-pad-query-peer-convert (self <gst-pad>) (src_format <gst-format>) (src_val int64) (dest_format <gst-format*>)   (ret bool) (dest_val int64)
— Method: query-peer-convert

Queries the peer pad of a given sink pad to convert src-val in src-format to dest-format.

pad
a <gst-pad>, on whose peer pad to invoke the convert query on. Must be a sink pad.
src-format
a <gst-format> to convert from.
src-val
a value to convert.
dest-format
a pointer to the <gst-format> to convert to.
dest-val
a pointer to the result.
ret
TRUE if the query could be performed.
— Function: gst-pad-get-query-types (self <gst-pad>)   (ret <gst-query-type*>)
— Method: get-query-types

Get an array of supported queries that can be performed on this pad.

pad
a <gst-pad>.
ret
a zero-terminated array of <gst-query-type>.
— Function: gst-pad-get-query-types-default (self <gst-pad>)   (ret <gst-query-type*>)
— Method: get-query-types-default

Invoke the default dispatcher for the query types on the pad.

pad
a <gst-pad>.
ret
an zero-terminated array of <gst-query-type>, or NULL if none of the internally-linked pads has a query types function.
— Function: gst-pad-get-internal-links (self <gst-pad>)   (ret glist-of)
— Method: get-internal-links

Gets a list of pads to which the given pad is linked to inside of the parent element. The caller must free this list after use.

pad
the <gst-pad> to get the internal links of.
ret
a newly allocated <g-list> of pads. Not MT safe.
— Function: gst-pad-get-internal-links-default (self <gst-pad>)   (ret glist-of)
— Method: get-internal-links-default

Gets a list of pads to which the given pad is linked to inside of the parent element. This is the default handler, and thus returns a list of all of the pads inside the parent element with opposite direction. The caller must free this list after use.

pad
the <gst-pad> to get the internal links of.
ret
a newly allocated <g-list> of pads, or NULL if the pad has no parent. Not MT safe.
— Function: gst-pad-load-and-link (self <xml-node-ptr>) (parent <gst-object>)

Reads the pad definition from the XML node and links the given pad in the element to a pad of an element up in the hierarchy.

self
an <xml-node-ptr> to read the description from.
parent
the <gst-object> element that owns the pad.
— Function: gst-pad-dispatcher (self <gst-pad>) (dispatch <gst-pad-dispatcher-function>) (data <gpointer>)   (ret bool)
— Method: dispatcher

Invokes the given dispatcher function on each respective peer of all pads that are internally linked to the given pad. The GstPadDispatcherFunction should return TRUE when no further pads need to be processed.

pad
a <gst-pad> to dispatch.
dispatch
the <gst-dispatcher-function> to call.
data
gpointer user data passed to the dispatcher function.
ret
TRUE if one of the dispatcher functions returned TRUE.
— Function: gst-pad-chain (self <gst-pad>) (buffer <gst-buffer>)   (ret <gst-flow-return>)
— Method: chain

Chain a buffer to pad.

The function returns <gst-flow-wrong-state> if the pad was flushing.

If the caps on buffer are different from the current caps on pad, this function will call any setcaps function (see gst-pad-set-setcaps-function) installed on pad. If the new caps are not acceptable for pad, 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.

pad
a sink <gst-pad>, returns GST_FLOW_ERROR if not.
buffer
the <gst-buffer> to send, return GST_FLOW_ERROR if not.
ret
a <gst-flow-return> from the pad. MT safe.
— Function: gst-pad-start-task (self <gst-pad>) (func <gst-task-function>) (data <gpointer>)   (ret bool)
— Method: start-task

Starts a task that repeatedly calls func with 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.

pad
the <gst-pad> to start the task of
func
the task function to call
data
data passed to the task function
ret
a ‘#t’ if the task could be started.
— Function: gst-pad-pause-task (self <gst-pad>)   (ret bool)
— Method: pause-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.

pad
the <gst-pad> to pause the task of
ret
a TRUE if the task could be paused or FALSE when the pad has no task.
— Function: gst-pad-stop-task (self <gst-pad>)   (ret bool)
— Method: stop-task

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 gst-task-pause 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.

pad
the <gst-pad> to stop the task of
ret
a TRUE if the task could be stopped or FALSE on error.
— Function: gst-pad-set-active (self <gst-pad>) (active bool)   (ret bool)
— Method: set-active

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, checks the pad's current mode and calls gst-pad-activate-push or gst-pad-activate-pull, as appropriate, with a FALSE argument.

pad
the <gst-pad> to activate or deactivate.
active
whether or not the pad should be active.
ret
#t if the operation was successful. MT safe.