Gst.Pad

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Pad Gst.Pad Gst.Object->Gst.Pad

Subclasses:

Gst.ProxyPad

Methods

Inherited:

Gst.Object (27), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

link_get_name (ret)

class

new (name, direction)

class

new_from_static_template (templ, name)

class

new_from_template (templ, name)

activate_mode (mode, active)

add_probe (mask, callback, *user_data)

can_link (sinkpad)

chain (buffer)

chain_list (list)

check_reconfigure ()

create_stream_id (parent, stream_id)

event_default (parent, event)

forward (forward, *user_data)

get_allowed_caps ()

get_current_caps ()

get_direction ()

get_element_private ()

get_last_flow_return ()

get_offset ()

get_pad_template ()

get_pad_template_caps ()

get_parent_element ()

get_peer ()

get_range (offset, size)

get_single_internal_link ()

get_sticky_event (event_type, idx)

get_stream ()

get_stream_id ()

get_task_state ()

has_current_caps ()

is_active ()

is_blocked ()

is_blocking ()

is_linked ()

iterate_internal_links ()

iterate_internal_links_default (parent)

link (sinkpad)

link_full (sinkpad, flags)

link_maybe_ghosting (sink)

link_maybe_ghosting_full (sink, flags)

mark_reconfigure ()

needs_reconfigure ()

pause_task ()

peer_query (query)

peer_query_accept_caps (caps)

peer_query_caps (filter)

peer_query_convert (src_format, src_val, dest_format)

peer_query_duration (format)

peer_query_position (format)

proxy_query_accept_caps (query)

proxy_query_caps (query)

pull_range (offset, size)

push (buffer)

push_event (event)

push_list (list)

query (query)

query_accept_caps (caps)

query_caps (filter)

query_convert (src_format, src_val, dest_format)

query_default (parent, query)

query_duration (format)

query_position (format)

remove_probe (id)

send_event (event)

set_activate_function_full (activate, *user_data)

set_activatemode_function_full (activatemode, *user_data)

set_active (active)

set_chain_function_full (chain, *user_data)

set_chain_list_function_full (chainlist, *user_data)

set_element_private (priv)

set_event_full_function_full (event, *user_data)

set_event_function_full (event, *user_data)

set_getrange_function_full (get, *user_data)

set_iterate_internal_links_function_full (iterintlink, *user_data)

set_link_function_full (link, *user_data)

set_offset (offset)

set_query_function_full (query, *user_data)

set_unlink_function_full (unlink, *user_data)

start_task (func, *user_data)

sticky_events_foreach (foreach_func, *user_data)

stop_task ()

store_sticky_event (event)

unlink (sinkpad)

use_fixed_caps ()

Virtual Methods

Inherited:

Gst.Object (1), GObject.Object (7)

do_linked (peer)

do_unlinked (peer)

Properties

Inherited:

Gst.Object (2)

Name

Type

Flags

Short Description

caps

Gst.Caps

r

The capabilities of the pad

direction

Gst.PadDirection

r/w/co

The direction of the pad

offset

int

r/w

The running time offset of the pad

template

Gst.PadTemplate

r/w

The Gst.PadTemplate of this pad

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Short Description

linked

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

unlinked

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

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Type

Access

Description

activatedata

object

r

activatefunc

Gst.PadActivateFunction

r

activatemodedata

object

r

activatemodefunc

Gst.PadActivateModeFunction

r

activatemodenotify

GLib.DestroyNotify

r

activatenotify

GLib.DestroyNotify

r

block_cond

GLib.Cond

r

chaindata

object

r

chainfunc

Gst.PadChainFunction

r

chainlistdata

object

r

chainlistfunc

Gst.PadChainListFunction

r

chainlistnotify

GLib.DestroyNotify

r

chainnotify

GLib.DestroyNotify

r

direction

Gst.PadDirection

r

the direction of the pad, cannot change after creating the pad.

element_private

object

r

private data owned by the parent element

eventdata

object

r

eventfunc

Gst.PadEventFunction

r

eventnotify

GLib.DestroyNotify

r

getrangedata

object

r

getrangefunc

Gst.PadGetRangeFunction

r

getrangenotify

GLib.DestroyNotify

r

iterintlinkdata

object

r

iterintlinkfunc

Gst.PadIterIntLinkFunction

r

iterintlinknotify

GLib.DestroyNotify

r

linkdata

object

r

linkfunc

Gst.PadLinkFunction

r

linknotify

GLib.DestroyNotify

r

mode

Gst.PadMode

r

num_blocked

int

r

num_probes

int

r

object

Gst.Object

r

offset

int

r

padtemplate

Gst.PadTemplate

r

padtemplate for this pad

peer

Gst.Pad

r

probes

GLib.HookList

r

querydata

object

r

queryfunc

Gst.PadQueryFunction

r

querynotify

GLib.DestroyNotify

r

stream_rec_lock

GLib.RecMutex

r

task

Gst.Task

r

unlinkdata

object

r

unlinkfunc

Gst.PadUnlinkFunction

r

unlinknotify

GLib.DestroyNotify

r

Class Details

class Gst.Pad(**kwargs)
Bases:

Gst.Object

Abstract:

No

Structure:

Gst.PadClass

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

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

Pads are typically created from a Gst.PadTemplate with Gst.Pad.new_from_template() and are then added to a Gst.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 Gst.Pad.new(), which takes a direction and a name as an argument. If the name is None, then a guaranteed unique name will be assigned to it.

A Gst.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 Gst.Element 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 Gst.Event 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.

Parameters:

ret (Gst.PadLinkReturn) – a Gst.PadLinkReturn to get the name of.

Returns:

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

Return type:

str

Gets a string representing the given pad-link return.

New in version 1.4.

classmethod new(name, direction)[source]
Parameters:
Returns:

a new Gst.Pad.

MT safe.

Return type:

Gst.Pad

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

classmethod new_from_static_template(templ, name)[source]
Parameters:
Returns:

a new Gst.Pad.

Return type:

Gst.Pad

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

classmethod new_from_template(templ, name)[source]
Parameters:
Returns:

a new Gst.Pad.

Return type:

Gst.Pad

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

activate_mode(mode, active)[source]
Parameters:
  • mode (Gst.PadMode) – the requested activation mode

  • active (bool) – whether or not the pad should be active.

Returns:

True if the operation was successful.

MT safe.

Return type:

bool

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.

add_probe(mask, callback, *user_data)[source]
Parameters:
Returns:

an id or 0 if no probe is pending. The id can be used to remove the probe with Gst.Pad.remove_probe(). When using Gst.PadProbeType.IDLE it can happen that the probe can be run immediately and if the probe returns Gst.PadProbeReturn.REMOVE this functions returns 0.

MT safe.

Return type:

int

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.PadProbeType.BLOCK probes are called, then others, then finally Gst.PadProbeType.IDLE. The only exception here are Gst.PadProbeType.IDLE probes that are called immediately if the pad is already idle while calling Gst.Pad.add_probe(). In each of the groups, probes are called in the order in which they were added.

Parameters:

sinkpad (Gst.Pad) – the sink Gst.Pad.

Returns:

True if the pads can be linked.

Return type:

bool

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

chain(buffer)[source]
Parameters:

buffer (Gst.Buffer) – the Gst.Buffer to send, return Gst.FlowReturn.ERROR if not.

Returns:

a Gst.FlowReturn from the pad.

MT safe.

Return type:

Gst.FlowReturn

Chain a buffer to self.

The function returns Gst.FlowReturn.FLUSHING if the pad was flushing.

If the buffer type is not acceptable for self (as negotiated with a preceding Gst.EventType.CAPS event), this function returns Gst.FlowReturn.NOT_NEGOTIATED.

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

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

chain_list(list)[source]
Parameters:

list (Gst.BufferList) – the Gst.BufferList to send, return Gst.FlowReturn.ERROR if not.

Returns:

a Gst.FlowReturn from the pad.

Return type:

Gst.FlowReturn

Chain a bufferlist to self.

The function returns Gst.FlowReturn.FLUSHING if the pad was flushing.

If self was not negotiated properly with a CAPS event, this function returns Gst.FlowReturn.NOT_NEGOTIATED.

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

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

MT safe.

check_reconfigure()[source]
Returns:

True is the Gst.PadFlags.NEED_RECONFIGURE flag was set on self.

Return type:

bool

Check and clear the Gst.PadFlags.NEED_RECONFIGURE flag on self and return True if the flag was set.

create_stream_id(parent, stream_id)[source]
Parameters:
Returns:

A stream-id for self. GLib.free() after usage.

Return type:

str

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

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

event_default(parent, event)[source]
Parameters:
Returns:

True if the event was sent successfully.

Return type:

bool

Invokes the default event handler for the given pad.

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

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

forward(forward, *user_data)[source]
Parameters:
Returns:

True if one of the dispatcher functions returned True.

Return type:

bool

Calls forward for all internally linked pads of self. 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.

get_allowed_caps()[source]
Returns:

the allowed Gst.Caps of the pad link. Unref the caps when you no longer need it. This function returns None when self has no peer.

MT safe.

Return type:

Gst.Caps or None

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

The allowed capabilities is calculated as the intersection of the results of calling Gst.Pad.query_caps() on self and its peer. The caller owns a reference on the resulting caps.

get_current_caps()[source]
Returns:

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

Return type:

Gst.Caps or None

Gets the capabilities currently configured on self with the last Gst.EventType.CAPS event.

get_direction()[source]
Returns:

the Gst.PadDirection of the pad.

MT safe.

Return type:

Gst.PadDirection

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

get_element_private()[source]
Returns:

a object to the private data.

Return type:

object or None

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

get_last_flow_return()[source]
Return type:

Gst.FlowReturn

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

New in version 1.4.

get_offset()[source]
Returns:

the offset.

Return type:

int

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

get_pad_template()[source]
Returns:

the Gst.PadTemplate from which this pad was instantiated, or None if this pad has no template. Unref after usage.

Return type:

Gst.PadTemplate or None

Gets the template for self.

get_pad_template_caps()[source]
Returns:

the Gst.Caps of this pad template. Unref after usage.

Return type:

Gst.Caps

Gets the capabilities for self's template.

get_parent_element()[source]
Returns:

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

MT safe.

Return type:

Gst.Element or None

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

get_peer()[source]
Returns:

the peer Gst.Pad. Unref after usage.

MT safe.

Return type:

Gst.Pad or None

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

get_range(offset, size)[source]
Parameters:
  • offset (int) – The start offset of the buffer

  • size (int) – The length of the buffer

Returns:

a Gst.FlowReturn from the pad.

MT safe.

buffer:

a pointer to hold the Gst.Buffer, returns Gst.FlowReturn.ERROR if None.

Return type:

(Gst.FlowReturn, buffer: Gst.Buffer)

When self is flushing this function returns Gst.FlowReturn.FLUSHING immediately and buffer is None.

Calls the getrange function of self, see Gst.PadGetRangeFunction for a description of a getrange function. If self has no getrange function installed (see gst_pad_set_getrange_function()) this function returns Gst.FlowReturn.NOT_SUPPORTED.

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

When buffer points to a variable that points to a valid Gst.Buffer, the buffer will be filled with the result data when this function returns Gst.FlowReturn.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.FlowReturn.OK, buffer will be unchanged.

This is a lowlevel function. Usually Gst.Pad.pull_range() is used.

Returns:

a Gst.Pad, or None if self has none or more than one internal links. Unref returned pad with Gst.Object.unref().

Return type:

Gst.Pad or None

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

New in version 1.18.

get_sticky_event(event_type, idx)[source]
Parameters:
Returns:

a Gst.Event of type event_type or None when no event of event_type was on self. Unref after usage.

Return type:

Gst.Event or None

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

get_stream()[source]
Returns:

the current Gst.Stream for self, or None. unref the returned stream when no longer needed.

Return type:

Gst.Stream or None

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

This is a convenience wrapper around Gst.Pad.get_sticky_event() and Gst.Event.parse_stream().

New in version 1.10.

get_stream_id()[source]
Returns:

a newly-allocated copy of the stream-id for self, or None. GLib.free() the returned string when no longer needed.

Return type:

str or None

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

This is a convenience wrapper around Gst.Pad.get_sticky_event() and Gst.Event.parse_stream_start().

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

New in version 1.2.

get_task_state()[source]
Returns:

The current state of self's task.

Return type:

Gst.TaskState

Get self task state. If no task is currently set, Gst.TaskState.STOPPED is returned.

New in version 1.12.

has_current_caps()[source]
Returns:

True when self has caps associated with it.

Return type:

bool

Check if self has caps set on it with a Gst.EventType.CAPS event.

is_active()[source]
Returns:

True if the pad is active.

MT safe.

Return type:

bool

Query if a pad is active

is_blocked()[source]
Returns:

True if the pad is blocked.

MT safe.

Return type:

bool

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

is_blocking()[source]
Returns:

True if the pad is blocking.

MT safe.

Return type:

bool

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

is_linked()[source]
Returns:

True if the pad is linked, False otherwise.

MT safe.

Return type:

bool

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

Returns:

a new Gst.Iterator of Gst.Pad or None when the pad does not have an iterator function configured. Use Gst.Iterator.free() after usage.

Return type:

Gst.Iterator or None

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

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

Free-function: Gst.Iterator.free

Parameters:

parent (Gst.Object or None) – the parent of self or None

Returns:

a Gst.Iterator of Gst.Pad, or None if self has no parent. Unref each returned pad with Gst.Object.unref().

Return type:

Gst.Iterator or None

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 Gst.Iterator.free().

Parameters:

sinkpad (Gst.Pad) – the sink Gst.Pad to link.

Returns:

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

MT Safe.

Return type:

Gst.PadLinkReturn

Links the source pad and the sink pad.

Parameters:
Returns:

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

Return type:

Gst.PadLinkReturn

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 Gst.PadLinkCheck for more information.

MT Safe.

Parameters:

sink (Gst.Pad) – a Gst.Pad

Returns:

whether the link succeeded.

Return type:

bool

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

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

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

New in version 1.10.

Parameters:
Returns:

whether the link succeeded.

Return type:

bool

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

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

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

Calling Gst.Pad.link_maybe_ghosting_full() with flags == Gst.PadLinkCheck.DEFAULT is the recommended way of linking pads with safety checks applied.

New in version 1.10.

mark_reconfigure()[source]

Mark a pad for needing reconfiguration. The next call to Gst.Pad.check_reconfigure() will return True after this call.

needs_reconfigure()[source]
Returns:

True is the Gst.PadFlags.NEED_RECONFIGURE flag is set on self.

Return type:

bool

Check the Gst.PadFlags.NEED_RECONFIGURE flag on self and return True if the flag was set.

pause_task()[source]
Returns:

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

Return type:

bool

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

peer_query(query)[source]
Parameters:

query (Gst.Query) – the Gst.Query to perform.

Returns:

True if the query could be performed. This function returns False if self has no peer.

Return type:

bool

Performs Gst.Pad.query() on the peer of self.

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

peer_query_accept_caps(caps)[source]
Parameters:

caps (Gst.Caps) – a Gst.Caps to check on the pad

Returns:

True if the peer of self can accept the caps or self has no peer.

Return type:

bool

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

peer_query_caps(filter)[source]
Parameters:

filter (Gst.Caps or None) – a Gst.Caps filter, or None.

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 None, ANY caps.

Return type:

Gst.Caps

Gets the capabilities of the peer connected to this pad. Similar to Gst.Pad.query_caps().

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 None but if it is not None the returned caps will be a subset of filter.

peer_query_convert(src_format, src_val, dest_format)[source]
Parameters:
Returns:

True if the query could be performed.

dest_val:

a pointer to the result.

Return type:

(bool, dest_val: int)

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

peer_query_duration(format)[source]
Parameters:

format (Gst.Format) – the Gst.Format requested

Returns:

True if the query could be performed.

duration:

a location in which to store the total duration, or None.

Return type:

(bool, duration: int)

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

peer_query_position(format)[source]
Parameters:

format (Gst.Format) – the Gst.Format requested

Returns:

True if the query could be performed.

cur:

a location in which to store the current position, or None.

Return type:

(bool, cur: int)

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

proxy_query_accept_caps(query)[source]
Parameters:

query (Gst.Query) – an ACCEPT_CAPS Gst.Query.

Returns:

True if query could be executed

Return type:

bool

Checks if all internally linked pads of self 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.

proxy_query_caps(query)[source]
Parameters:

query (Gst.Query) – a CAPS Gst.Query.

Returns:

True if query could be executed

Return type:

bool

Calls Gst.Pad.query_caps() for all internally linked pads of self 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.

pull_range(offset, size)[source]
Parameters:
  • offset (int) – The start offset of the buffer

  • size (int) – The length of the buffer

Returns:

a Gst.FlowReturn from the peer pad.

MT safe.

buffer:

a pointer to hold the Gst.Buffer, returns Gst.FlowReturn.ERROR if None.

Return type:

(Gst.FlowReturn, buffer: Gst.Buffer)

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 self is not linked Gst.FlowReturn.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.

If buffer points to a variable holding None, a valid new Gst.Buffer will be placed in buffer when this function returns Gst.FlowReturn.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 None.

When buffer points to a variable that points to a valid Gst.Buffer, the buffer will be filled with the result data when this function returns Gst.FlowReturn.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(buffer)[source]
Parameters:

buffer (Gst.Buffer) – the Gst.Buffer to push returns Gst.FlowReturn.ERROR if not.

Returns:

a Gst.FlowReturn from the peer pad.

MT safe.

Return type:

Gst.FlowReturn

Pushes a buffer to the peer of self.

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

The function proceeds calling Gst.Pad.chain() on the peer pad and returns the value from that function. If self has no peer, Gst.FlowReturn.NOT_LINKED will be returned.

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

push_event(event)[source]
Parameters:

event (Gst.Event) – the Gst.Event to send to the pad.

Returns:

True if the event was handled.

MT safe.

Return type:

bool

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.

push_list(list)[source]
Parameters:

list (Gst.BufferList) – the Gst.BufferList to push returns Gst.FlowReturn.ERROR if not.

Returns:

a Gst.FlowReturn from the peer pad.

MT safe.

Return type:

Gst.FlowReturn

Pushes a buffer list to the peer of self.

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 self has no peer, Gst.FlowReturn.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 Gst.Buffer and chained via Gst.Pad.chain().

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

query(query)[source]
Parameters:

query (Gst.Query) – the Gst.Query to perform.

Returns:

True if the query could be performed.

Return type:

bool

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.

query_accept_caps(caps)[source]
Parameters:

caps (Gst.Caps) – a Gst.Caps to check on the pad

Returns:

True if the pad can accept the caps.

Return type:

bool

Check if the given pad accepts the caps.

query_caps(filter)[source]
Parameters:

filter (Gst.Caps or None) – suggested Gst.Caps, or None

Returns:

the caps of the pad with incremented ref-count.

Return type:

Gst.Caps

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 None, 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 None but if it is not None the returned caps will be a subset of filter.

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

query_convert(src_format, src_val, dest_format)[source]
Parameters:
Returns:

True if the query could be performed.

dest_val:

a pointer to the result.

Return type:

(bool, dest_val: int)

Queries a pad to convert src_val in src_format to dest_format.

query_default(parent, query)[source]
Parameters:
Returns:

True if the query was performed successfully.

Return type:

bool

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

query_duration(format)[source]
Parameters:

format (Gst.Format) – the Gst.Format requested

Returns:

True if the query could be performed.

duration:

a location in which to store the total duration, or None.

Return type:

(bool, duration: int)

Queries a pad for the total stream duration.

query_position(format)[source]
Parameters:

format (Gst.Format) – the Gst.Format requested

Returns:

True if the query could be performed.

cur:

A location in which to store the current position, or None.

Return type:

(bool, cur: int)

Queries a pad for the stream position.

remove_probe(id)[source]
Parameters:

id (int) – the probe id to remove

Remove the probe with id from self.

MT safe.

send_event(event)[source]
Parameters:

event (Gst.Event) – the Gst.Event to send to the pad.

Returns:

True if the event was handled.

Return type:

bool

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

If self is a source pad, event should be an upstream event. If self is a sink pad, event should be a downstream event. For example, you would not send a Gst.EventType.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.EventType.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.EventTypeFlags, Gst.EventType.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 ownership of the provided event so you should gst_event_ref() it if you want to reuse the event after this call.

set_activate_function_full(activate, *user_data)[source]
Parameters:

Sets the given activate function for self. The activate function will dispatch to Gst.Pad.activate_mode() 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.

set_activatemode_function_full(activatemode, *user_data)[source]
Parameters:

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

set_active(active)[source]
Parameters:

active (bool) – whether or not the pad should be active.

Returns:

True if the operation was successful.

MT safe.

Return type:

bool

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 Gst.Pad.activate_mode() with the pad’s current mode and a False argument.

set_chain_function_full(chain, *user_data)[source]
Parameters:

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

set_chain_list_function_full(chainlist, *user_data)[source]
Parameters:

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

set_element_private(priv)[source]
Parameters:

priv (object or None) – The private data to attach to the pad.

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

set_event_full_function_full(event, *user_data)[source]
Parameters:

Sets the given event handler for the pad.

New in version 1.8.

set_event_function_full(event, *user_data)[source]
Parameters:

Sets the given event handler for the pad.

set_getrange_function_full(get, *user_data)[source]
Parameters:

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.PadGetRangeFunction for a description of the getrange function.

Parameters:

Sets the given internal link iterator function for the pad.

Parameters:

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

The return value Gst.PadLinkReturn.OK should be used when the connection can be made.

The return value Gst.PadLinkReturn.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 Gst.PadLinkFunction of the peer sink pad, if present.

set_offset(offset)[source]
Parameters:

offset (int) – the offset

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

set_query_function_full(query, *user_data)[source]
Parameters:

Set the given query function for the pad.

Parameters:

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.

start_task(func, *user_data)[source]
Parameters:
Returns:

a True if the task could be started.

Return type:

bool

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 self will automatically be acquired before func is called.

sticky_events_foreach(foreach_func, *user_data)[source]
Parameters:

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

stop_task()[source]
Returns:

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

Return type:

bool

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

This function will deadlock if called from the Gst.TaskFunction 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.

store_sticky_event(event)[source]
Parameters:

event (Gst.Event) – a Gst.Event

Returns:

Gst.FlowReturn.OK on success, Gst.FlowReturn.FLUSHING when the pad was flushing or Gst.FlowReturn.EOS when the pad was EOS.

Return type:

Gst.FlowReturn

Store the sticky event on self

New in version 1.2.

Parameters:

sinkpad (Gst.Pad) – the sink Gst.Pad to unlink.

Returns:

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

MT safe.

Return type:

bool

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

use_fixed_caps()[source]

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.

do_linked(peer) virtual
Parameters:

peer (Gst.Pad) –

do_unlinked(peer) virtual
Parameters:

peer (Gst.Pad) –

Signal Details

Gst.Pad.signals.linked(pad, peer)
Signal Name:

linked

Flags:

RUN_LAST

Parameters:
  • pad (Gst.Pad) – The object which received the signal

  • peer (Gst.Pad) – the peer pad that has been connected

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

Gst.Pad.signals.unlinked(pad, peer)
Signal Name:

unlinked

Flags:

RUN_LAST

Parameters:
  • pad (Gst.Pad) – The object which received the signal

  • peer (Gst.Pad) – the peer pad that has been disconnected

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

Property Details

Gst.Pad.props.caps
Name:

caps

Type:

Gst.Caps

Default Value:

None

Flags:

READABLE

The capabilities of the pad

Gst.Pad.props.direction
Name:

direction

Type:

Gst.PadDirection

Default Value:

Gst.PadDirection.UNKNOWN

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The direction of the pad

Gst.Pad.props.offset
Name:

offset

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

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

New in version 1.6.

Gst.Pad.props.template
Name:

template

Type:

Gst.PadTemplate

Default Value:

None

Flags:

READABLE, WRITABLE

The Gst.PadTemplate of this pad