Pad
Superclasses: Object
, InitiallyUnowned
, Object
Subclasses: ProxyPad
A Element
is linked to other elements via “pads”, which are extremely
light-weight generic link points.
Pads have a PadDirection
, source pads produce data, sink pads consume
data.
Pads are typically created from a PadTemplate
with
new_from_template()
and are then added to a Element
. This usually
happens when the element is created but it can also happen dynamically based
on the data that the element is processing or based on the pads that the
application requests.
Pads without pad templates can be created with 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 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.
pad_get_parent()
will retrieve the Element
that owns the pad.
After two pads are retrieved from an element by get_static_pad()
,
the pads can be linked with link()
. (For quick links,
you can also use link()
, which will make the obvious
link for you if it’s straightforward.). Pads can be unlinked again with
unlink()
. 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
set_active()
.
query()
and peer_query()
can be used to query various
properties of the pad and the stream.
To send a Event
on a pad, use send_event()
and
push_event()
. Some events will be sticky on the pad, meaning that
after they pass on the pad they can be queried later with
get_sticky_event()
and sticky_events_foreach()
.
get_current_caps()
and has_current_caps()
are convenience
functions to query the current sticky CAPS event on a pad.
GstElements will use push()
and 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 add_probe()
. is_blocked()
can be used to check if a block probe is installed on the pad.
is_blocking()
checks if the blocking probe is currently blocking the
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 get_offset()
. This
offset will be applied to the running_time of all data passing over the pad.
set_offset()
can be used to change the offset.
Convenience functions exist to start, pause and stop the task on a pad with
start_task()
, pause_task()
and stop_task()
respectively.
Constructors
- class Pad
- classmethod new(name: str | None, direction: PadDirection) 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.- Parameters:
name – the name of the new pad.
direction – the
PadDirection
of the pad.
- classmethod new_from_static_template(templ: StaticPadTemplate, name: str) 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.- Parameters:
templ – the
StaticPadTemplate
to usename – the name of the pad
- classmethod new_from_template(templ: PadTemplate, name: str | None = None) 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.- Parameters:
templ – the pad template to use
name – the name of the pad
Methods
- class Pad
- activate_mode(mode: PadMode, active: bool) 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.
- Parameters:
mode – the requested activation mode
active – whether or not the pad should be active.
- add_probe(mask: PadProbeType, callback: Callable[[...], PadProbeReturn], *user_data: Any) 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_PAD_PROBE_TYPE_BLOCK probes are called, then others, then finally GST_PAD_PROBE_TYPE_IDLE. The only exception here are GST_PAD_PROBE_TYPE_IDLE probes that are called immediately if the pad is already idle while calling
add_probe()
. In each of the groups, probes are called in the order in which they were added.- Parameters:
mask – the probe mask
callback –
PadProbeCallback
that will be called with notifications of the pad stateuser_data – user data passed to the callback
- can_link(sinkpad: Pad) bool
Checks if the source pad and the sink pad are compatible so they can be linked.
- Parameters:
sinkpad – the sink
Pad
.
- chain(buffer: Buffer) FlowReturn
Chain a buffer to
pad
.The function returns
GST_FLOW_FLUSHING
if the pad was flushing.If the buffer type is not acceptable for
pad
(as negotiated with a preceding GST_EVENT_CAPS event), this function returnsGST_FLOW_NOT_NEGOTIATED
.The function proceeds calling the chain function installed on
pad
(seepad_set_chain_function()
) and the return value of that function is returned to the caller.GST_FLOW_NOT_SUPPORTED
is returned ifpad
has no chain function.In all cases, success or failure, the caller loses its reference to
buffer
after calling this function.- Parameters:
buffer – the
Buffer
to send, return GST_FLOW_ERROR if not.
- chain_list(list: BufferList) FlowReturn
Chain a bufferlist to
pad
.The function returns
GST_FLOW_FLUSHING
if the pad was flushing.If
pad
was not negotiated properly with a CAPS event, this function returnsGST_FLOW_NOT_NEGOTIATED
.The function proceeds calling the chainlist function installed on
pad
(seepad_set_chain_list_function()
) and the return value of that function is returned to the caller.GST_FLOW_NOT_SUPPORTED
is returned ifpad
has no chainlist function.In all cases, success or failure, the caller loses its reference to
list
after calling this function.MT safe.
- Parameters:
list – the
BufferList
to send, return GST_FLOW_ERROR if not.
- check_reconfigure() bool
Check and clear the
GST_PAD_FLAG_NEED_RECONFIGURE
flag onpad
and returnTrue
if the flag was set.
- create_stream_id(parent: Element, stream_id: str | None = None) str
Creates a stream-id for the source
Pad
pad
by combining the upstream information with the optionalstream_id
of the stream ofpad
.pad
must have a parentElement
and which must have zero or one sinkpad.stream_id
can only beNone
if the parent element ofpad
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``.
- Parameters:
parent – Parent
Element
ofpad
stream_id – The stream-id
- event_default(parent: Object | None, event: Event) bool
Invokes the default event handler for the given pad.
The EOS event will pause the task associated with
pad
before it is forwarded to all internally linked pads,The event is sent to all pads internally linked to
pad
. This function takes ownership ofevent
.- Parameters:
parent – the parent of
pad
orNone
event – the
Event
to handle.
- forward(forward: Callable[[...], bool], *user_data: Any) bool
Calls
forward
for all internally linked pads ofpad
. This function deals with dynamically changing internal pads and will make sure that theforward
function is only called once for each pad.When
forward
returnsTrue
, no further pads will be processed.- Parameters:
forward – a
PadForwardFunction
user_data – user data passed to
forward
- get_allowed_caps() Caps | None
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
query_caps()
onpad
and its peer. The caller owns a reference on the resulting caps.
- get_current_caps() Caps | None
Gets the capabilities currently configured on
pad
with the lastGST_EVENT_CAPS
event.
- get_direction() 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() None
Gets the private data of a pad. No locking is performed in this function.
- get_last_flow_return() FlowReturn
Gets the
FlowReturn
return from the last data passed by this pad.Added in version 1.4.
- get_pad_template() PadTemplate | None
Gets the template for
pad
.
- get_parent_element() Element | None
Gets the parent of
pad
, cast to aElement
. If apad
has no parent or its parent is not an element, returnNone
.
- get_peer() Pad | None
Gets the peer of
pad
. This function refs the peer pad so you need to unref it after use.
- get_range(offset: int, size: int) tuple[FlowReturn, Buffer]
When
pad
is flushing this function returnsGST_FLOW_FLUSHING
immediately andbuffer
isNone
.Calls the getrange function of
pad
, seePadGetRangeFunction
for a description of a getrange function. Ifpad
has no getrange function installed (seepad_set_getrange_function()
) this function returnsGST_FLOW_NOT_SUPPORTED
.If
buffer
points to a variable holdingNone
, a valid newBuffer
will be placed inbuffer
when this function returnsGST_FLOW_OK
. The new buffer must be freed with gst_buffer_unref() after usage.When
buffer
points to a variable that points to a validBuffer
, the buffer will be filled with the result data when this function returnsGST_FLOW_OK
. If the provided buffer is larger thansize
, onlysize
bytes will be filled in the result buffer and its size will be updated accordingly.Note that less than
size
bytes can be returned inbuffer
when, for example, an EOS condition is near or whenbuffer
is not large enough to holdsize
bytes. The caller should check the result buffer size to get the result size.When this function returns any other result value than
GST_FLOW_OK
,buffer
will be unchanged.This is a lowlevel function. Usually
pull_range()
is used.- Parameters:
offset – The start offset of the buffer
size – The length of the buffer
- get_single_internal_link() Pad | None
If there is a single internal link of the given pad, this function will return it. Otherwise, it will return NULL.
Added in version 1.18.
- get_sticky_event(event_type: EventType, idx: int) Event | None
Returns a new reference of the sticky event of type
event_type
from the event.- Parameters:
event_type – the
EventType
that should be retrieved.idx – the index of the event
- get_stream() Stream | None
Returns the current
Stream
for thepad
, orNone
if none has been set yet, i.e. the pad has not received a stream-start event yet.This is a convenience wrapper around
get_sticky_event()
andparse_stream()
.Added in version 1.10.
- get_stream_id() str | None
Returns the current stream-id for the
pad
, orNone
if none has been set yet, i.e. the pad has not received a stream-start event yet.This is a convenience wrapper around
get_sticky_event()
andparse_stream_start()
.The returned stream-id string should be treated as an opaque string, its contents should not be interpreted.
Added in version 1.2.
- get_task_state() TaskState
Get
pad
task state. If no task is currently set,GST_TASK_STOPPED
is returned.Added in version 1.12.
- is_blocked() 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
is_blocking()
).
- is_blocking() bool
Checks if the pad is blocking or not. This is a guaranteed state of whether the pad is actually blocking on a
Buffer
or aEvent
.
- iterate_internal_links() Iterator | None
Gets an iterator for the pads to which the given pad is linked to inside of the parent element.
Each
Pad
element yielded by the iterator will have its refcount increased, so unref after use.Free-function: gst_iterator_free
- iterate_internal_links_default(parent: Object | None = None) Iterator | 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
free()
.- Parameters:
parent – the parent of
pad
orNone
- link(sinkpad: Pad) PadLinkReturn
Links the source pad and the sink pad.
- Parameters:
sinkpad – the sink
Pad
to link.
- link_full(sinkpad: Pad, flags: PadLinkCheck) 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 ofPadLinkCheck
for more information.MT Safe.
- Parameters:
sinkpad – the sink
Pad
to link.flags – the checks to validate when linking
- link_get_name(ret: PadLinkReturn) str
Gets a string representing the given pad-link return.
Added in version 1.4.
- Parameters:
ret – a
PadLinkReturn
to get the name of.
- link_maybe_ghosting(sink: Pad) bool
Links
src
tosink
, creating anyGhostPad
’s in between as necessary.This is a convenience function to save having to create and add intermediate
GhostPad
’s as required for linking acrossBin
boundaries.If
src
orsink
pads don’t have parent elements or do not share a common ancestor, the link will fail.Added in version 1.10.
- Parameters:
sink – a
Pad
- link_maybe_ghosting_full(sink: Pad, flags: PadLinkCheck) bool
Links
src
tosink
, creating anyGhostPad
’s in between as necessary.This is a convenience function to save having to create and add intermediate
GhostPad
’s as required for linking acrossBin
boundaries.If
src
orsink
pads don’t have parent elements or do not share a common ancestor, the link will fail.Calling
link_maybe_ghosting_full()
withflags
==DEFAULT
is the recommended way of linking pads with safety checks applied.Added in version 1.10.
- Parameters:
sink – a
Pad
flags – some
PadLinkCheck
flags
- mark_reconfigure() None
Mark a pad for needing reconfiguration. The next call to
check_reconfigure()
will returnTrue
after this call.
- needs_reconfigure() bool
Check the
GST_PAD_FLAG_NEED_RECONFIGURE
flag onpad
and returnTrue
if the flag was set.
- pause_task() bool
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.
- peer_query(query: Query) bool
Performs
query()
on the peer ofpad
.The caller is responsible for both the allocation and deallocation of the query structure.
- Parameters:
query – the
Query
to perform.
- peer_query_accept_caps(caps: Caps) bool
Check if the peer of
pad
acceptscaps
. Ifpad
has no peer, this function returnsTrue
.- Parameters:
caps – a
Caps
to check on the pad
- peer_query_caps(filter: Caps | None = None) Caps
Gets the capabilities of the peer connected to this pad. Similar to
query_caps()
.When called on srcpads
filter
contains the caps that upstream could produce in the order preferred by upstream. When called on sinkpadsfilter
contains the caps accepted by downstream in the preferred order.filter
might beNone
but if it is notNone
the returned caps will be a subset offilter
.- Parameters:
filter – a
Caps
filter, orNone
.
- peer_query_convert(src_format: Format, src_val: int, dest_format: Format) tuple[bool, int]
Queries the peer pad of a given sink pad to convert
src_val
insrc_format
todest_format
.
- peer_query_duration(format: Format) tuple[bool, int]
Queries the peer pad of a given sink pad for the total stream duration.
- Parameters:
format – the
Format
requested
- peer_query_position(format: Format) tuple[bool, int]
Queries the peer of a given sink pad for the stream position.
- Parameters:
format – the
Format
requested
- proxy_query_accept_caps(query: Query) bool
Checks if all internally linked pads of
pad
accepts the caps inquery
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.
- Parameters:
query – an ACCEPT_CAPS
Query
.
- proxy_query_caps(query: Query) bool
Calls
query_caps()
for all internally linked pads ofpad
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.
- Parameters:
query – a CAPS
Query
.
- pull_range(offset: int, size: int) tuple[FlowReturn, 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
pad
is not linkedGST_FLOW_NOT_LINKED
is returned else this function returns the result ofget_range()
on the peer pad. Seeget_range()
for a list of return values and for the semantics of the arguments of this function.If
buffer
points to a variable holdingNone
, a valid newBuffer
will be placed inbuffer
when this function returnsGST_FLOW_OK
. The new buffer must be freed with gst_buffer_unref() after usage. When this function returns any other result value,buffer
will still point toNone
.When
buffer
points to a variable that points to a validBuffer
, the buffer will be filled with the result data when this function returnsGST_FLOW_OK
. When this function returns any other result value,buffer
will be unchanged. If the provided buffer is larger thansize
, onlysize
bytes will be filled in the result buffer and its size will be updated accordingly.Note that less than
size
bytes can be returned inbuffer
when, for example, an EOS condition is near or whenbuffer
is not large enough to holdsize
bytes. The caller should check the result buffer size to get the result size.- Parameters:
offset – The start offset of the buffer
size – The length of the buffer
- push(buffer: Buffer) FlowReturn
Pushes a buffer to the peer of
pad
.This function will call installed block probes before triggering any installed data probes.
The function proceeds calling
chain()
on the peer pad and returns the value from that function. Ifpad
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.- Parameters:
buffer – the
Buffer
to push returns GST_FLOW_ERROR if not.
- push_event(event: Event) 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.
- Parameters:
event – the
Event
to send to the pad.
- push_list(list: BufferList) FlowReturn
Pushes a buffer list to the peer of
pad
.This function will call installed block probes before triggering any installed data probes.
The function proceeds calling the chain function on the peer pad and returns the value from that function. If
pad
has no peer,GST_FLOW_NOT_LINKED
will be returned. If the peer pad does not have any installed chainlist function every group buffer of the list will be merged into a normalBuffer
and chained viachain()
.In all cases, success or failure, the caller loses its reference to
list
after calling this function.- Parameters:
list – the
BufferList
to push returns GST_FLOW_ERROR if not.
- query(query: Query) 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.
- Parameters:
query – the
Query
to perform.
- query_accept_caps(caps: Caps) bool
Check if the given pad accepts the caps.
- Parameters:
caps – a
Caps
to check on the pad
- query_caps(filter: Caps | None = None) Caps
Gets the capabilities this pad can produce or consume. Note that this method doesn’t necessarily return the caps set by sending a
new_caps()
- useget_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 returnfilter
, if notNone
, otherwise ANY.When called on sinkpads
filter
contains the caps that upstream could produce in the order preferred by upstream. When called on srcpadsfilter
contains the caps accepted by downstream in the preferred order.filter
might beNone
but if it is notNone
the returned caps will be a subset offilter
.Note that this function does not return writable
Caps
, usecaps_make_writable()
before modifying the caps.- Parameters:
filter – suggested
Caps
, orNone
- query_convert(src_format: Format, src_val: int, dest_format: Format) tuple[bool, int]
Queries a pad to convert
src_val
insrc_format
todest_format
.
- query_default(parent: Object | None, query: Query) bool
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 topad
, only one will be sent the query. Multi-sinkpad elements should implement custom query handlers.- Parameters:
parent – the parent of
pad
orNone
query – the
Query
to handle.
- query_duration(format: Format) tuple[bool, int]
Queries a pad for the total stream duration.
- Parameters:
format – the
Format
requested
- query_position(format: Format) tuple[bool, int]
Queries a pad for the stream position.
- Parameters:
format – the
Format
requested
- remove_probe(id: int) None
Remove the probe with
id
frompad
.MT safe.
- Parameters:
id – the probe id to remove
- send_event(event: Event) bool
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. Ifpad
is a sink pad,event
should be a downstream event. For example, you would not send aGST_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, likeGST_EVENT_FLUSH_START
. If the event needs to be serialized with data flow, this function will take the pad’s stream lock while calling its event function.To find out whether an event type is upstream, downstream, or downstream and serialized, see
EventTypeFlags
, gst_event_type_get_flags(),GST_EVENT_IS_UPSTREAM
,GST_EVENT_IS_DOWNSTREAM
, andGST_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.
- Parameters:
event – the
Event
to send to the pad.
- set_activate_function_full(activate: Callable[[...], bool], *user_data: Any) None
Sets the given activate function for
pad
. The activate function will dispatch toactivate_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.
- Parameters:
activate – the
PadActivateFunction
to set.user_data – user_data passed to
notify
- set_activatemode_function_full(activatemode: Callable[[...], bool], *user_data: Any) None
Sets the given activate_mode function for the pad. An activate_mode function prepares the element for data passing.
- Parameters:
activatemode – the
PadActivateModeFunction
to set.user_data – user_data passed to
notify
- set_active(active: bool) 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
, callsactivate_mode()
with the pad’s current mode and aFalse
argument.- Parameters:
active – whether or not the pad should be active.
- set_chain_function_full(chain: Callable[[...], FlowReturn], *user_data: Any) None
Sets the given chain function for the pad. The chain function is called to process a
Buffer
input buffer. seePadChainFunction
for more details.- Parameters:
chain – the
PadChainFunction
to set.user_data – user_data passed to
notify
- set_chain_list_function_full(chainlist: Callable[[...], FlowReturn], *user_data: Any) None
Sets the given chain list function for the pad. The chainlist function is called to process a
BufferList
input buffer list. SeePadChainListFunction
for more details.- Parameters:
chainlist – the
PadChainListFunction
to set.user_data – user_data passed to
notify
- set_element_private(priv: None) None
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.
- Parameters:
priv – The private data to attach to the pad.
- set_event_full_function_full(event: Callable[[...], FlowReturn], *user_data: Any) None
Sets the given event handler for the pad.
Added in version 1.8.
- Parameters:
event – the
PadEventFullFunction
to set.user_data – user_data passed to
notify
- set_event_function_full(event: Callable[[...], bool], *user_data: Any) None
Sets the given event handler for the pad.
- Parameters:
event – the
PadEventFunction
to set.user_data – user_data passed to
notify
- set_getrange_function_full(get: Callable[[...], FlowReturn], *user_data: Any) None
Sets the given getrange function for the pad. The getrange function is called to produce a new
Buffer
to start the processing pipeline. seePadGetRangeFunction
for a description of the getrange function.- Parameters:
get – the
PadGetRangeFunction
to set.user_data – user_data passed to
notify
- set_iterate_internal_links_function_full(iterintlink: Callable[[...], Iterator], *user_data: Any) None
Sets the given internal link iterator function for the pad.
- Parameters:
iterintlink – the
PadIterIntLinkFunction
to set.user_data – user_data passed to
notify
- set_link_function_full(link: Callable[[...], PadLinkReturn], *user_data: Any) None
Sets the given link function for the pad. It will be called when the pad is linked with another pad.
The return value
GST_PAD_LINK_OK
should be used when the connection can be made.The return value
GST_PAD_LINK_REFUSED
should be used when the connection cannot be made for some reason.If
link
is installed on a source pad, it should call thePadLinkFunction
of the peer sink pad, if present.- Parameters:
link – the
PadLinkFunction
to set.user_data – user_data passed to
notify
- set_offset(offset: int) None
Set the offset that will be applied to the running time of
pad
.- Parameters:
offset – the offset
- set_query_function_full(query: Callable[[...], bool], *user_data: Any) None
Set the given query function for the pad.
- Parameters:
query – the
PadQueryFunction
to set.user_data – user_data passed to
notify
- set_unlink_function_full(unlink: Callable[[...], None], *user_data: Any) None
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.
- Parameters:
unlink – the
PadUnlinkFunction
to set.user_data – user_data passed to
notify
- start_task(func: Callable[[...], None], *user_data: Any) bool
Starts a task that repeatedly calls
func
withuser_data
. This function is mostly used in pad activation functions to start the dataflow. TheGST_PAD_STREAM_LOCK
ofpad
will automatically be acquired beforefunc
is called.- Parameters:
func – the task function to call
user_data – user data passed to the task function
- sticky_events_foreach(foreach_func: Callable[[...], bool], *user_data: Any) None
Iterates all sticky events on
pad
and callsforeach_func
for every event. Ifforeach_func
returnsFalse
the iteration is immediately stopped.- Parameters:
foreach_func – the
PadStickyEventsForeachFunction
that should be called for every event.user_data – the optional user data.
- stop_task() bool
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
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: Event) FlowReturn
Store the sticky
event
onpad
Added in version 1.2.
- Parameters:
event – a
Event
- unlink(sinkpad: Pad) bool
Unlinks the source pad from the sink pad. Will emit the
Pad
::unlinked signal on both pads.- Parameters:
sinkpad – the sink
Pad
to unlink.
- use_fixed_caps() None
A helper function you can use that sets the FIXED_CAPS flag This way the default CAPS query will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps.
The negotiated caps are the caps of the last CAPS event that passed on the pad. Use this function on a pad that, once it negotiated to a CAPS, cannot be renegotiated to something else.
Properties
- class Pad
-
- props.direction: PadDirection
- props.offset: int
The offset that will be applied to the running time of the pad.
Added in version 1.6.
- props.template: PadTemplate
Signals
Virtual Methods
Fields
- class Pad
- activatedata
- activatefunc
- activatemodedata
- activatemodefunc
- activatemodenotify
- activatenotify
- block_cond
- chaindata
- chainfunc
- chainlistdata
- chainlistfunc
- chainlistnotify
- chainnotify
- direction
The direction of the pad, cannot change after creating the pad.
- element_private
Private data owned by the parent element
- eventdata
- eventfunc
- eventnotify
- getrangedata
- getrangefunc
- getrangenotify
- iterintlinkdata
- iterintlinkfunc
- iterintlinknotify
- linkdata
- linkfunc
- linknotify
- mode
- num_blocked
- num_probes
- object
- offset
- padtemplate
Padtemplate for this pad
- peer
- priv
- probes
- querydata
- queryfunc
- querynotify
- stream_rec_lock
- task
- unlinkdata
- unlinkfunc
- unlinknotify