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
PadDirectionof 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
StaticPadTemplateto 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
modevia 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[[Pad, PadProbeInfo, Any], PadProbeReturn], user_data: Any = None) 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 –
PadProbeCallbackthat 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_FLUSHINGif 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_SUPPORTEDis returned ifpadhas no chain function.In all cases, success or failure, the caller loses its reference to
bufferafter calling this function.- Parameters:
buffer – the
Bufferto send, return GST_FLOW_ERROR if not.
- chain_list(list: BufferList) FlowReturn#
Chain a bufferlist to
pad.The function returns
GST_FLOW_FLUSHINGif the pad was flushing.If
padwas 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_SUPPORTEDis returned ifpadhas no chainlist function.In all cases, success or failure, the caller loses its reference to
listafter calling this function.MT safe.
- Parameters:
list – the
BufferListto send, return GST_FLOW_ERROR if not.
- check_reconfigure() bool#
Check and clear the
GST_PAD_FLAG_NEED_RECONFIGUREflag onpadand returnTrueif the flag was set.
- create_stream_id(parent: Element, stream_id: str | None = None) str#
Creates a stream-id for the source
Padpadby combining the upstream information with the optionalstream_idof the stream ofpad.padmust have a parentElementand which must have zero or one sinkpad.stream_idcan only beNoneif the parent element ofpadhas only a single source pad.This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending
stream_idto 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
Elementofpadstream_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
padbefore 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
padorNoneevent – the
Eventto handle.
- forward(forward: Callable[[Pad, Any], bool], user_data: Any = None) bool#
Calls
forwardfor all internally linked pads ofpad. This function deals with dynamically changing internal pads and will make sure that theforwardfunction is only called once for each pad.When
forwardreturnsTrue, no further pads will be processed.- Parameters:
forward – a
PadForwardFunctionuser_data – user data passed to
forward
- get_allowed_caps() Caps | None#
Gets the capabilities of the allowed media types that can flow through
padand its peer.The allowed capabilities is calculated as the intersection of the results of calling
query_caps()onpadand its peer. The caller owns a reference on the resulting caps.
- get_current_caps() Caps | None#
Gets the capabilities currently configured on
padwith the lastGST_EVENT_CAPSevent.
- 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() Any | None#
Gets the private data of a pad. No locking is performed in this function.
- get_last_flow_return() FlowReturn#
Gets the
FlowReturnreturn 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 apadhas 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
padis flushing this function returnsGST_FLOW_FLUSHINGimmediately andbufferisNone.Calls the getrange function of
pad, seePadGetRangeFunctionfor a description of a getrange function. Ifpadhas no getrange function installed (seepad_set_getrange_function()) this function returnsGST_FLOW_NOT_SUPPORTED.If
bufferpoints to a variable holdingNone, a valid newBufferwill be placed inbufferwhen this function returnsGST_FLOW_OK. The new buffer must be freed with gst_buffer_unref() after usage.When
bufferpoints 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, onlysizebytes will be filled in the result buffer and its size will be updated accordingly.Note that less than
sizebytes can be returned inbufferwhen, for example, an EOS condition is near or whenbufferis not large enough to holdsizebytes. 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,bufferwill 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_typefrom the event.- Parameters:
event_type – the
EventTypethat should be retrieved.idx – the index of the event
- get_stream() Stream | None#
Returns the current
Streamfor thepad, orNoneif 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, orNoneif 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
padtask state. If no task is currently set,GST_TASK_STOPPEDis 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
Bufferor 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
Padelement 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
padorNone
- link(sinkpad: Pad) PadLinkReturn#
Links the source pad and the sink pad.
- Parameters:
sinkpad – the sink
Padto link.
- link_full(sinkpad: Pad, flags: PadLinkCheck) PadLinkReturn#
Links the source pad and the sink pad.
This variant of
gst_pad_linkprovides 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 ofPadLinkCheckfor more information.MT Safe.
- Parameters:
sinkpad – the sink
Padto link.flags – the checks to validate when linking
- classmethod link_get_name() str#
Gets a string representing the given pad-link return.
Added in version 1.4.
- link_maybe_ghosting(sink: Pad) bool#
Links
srctosink, 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 acrossBinboundaries.If
srcorsinkpads 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
srctosink, 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 acrossBinboundaries.If
srcorsinkpads don’t have parent elements or do not share a common ancestor, the link will fail.Calling
link_maybe_ghosting_full()withflags==DEFAULTis the recommended way of linking pads with safety checks applied.Added in version 1.10.
- Parameters:
sink – a
Padflags – some
PadLinkCheckflags
- mark_reconfigure() None#
Mark a pad for needing reconfiguration. The next call to
check_reconfigure()will returnTrueafter this call.
- needs_reconfigure() bool#
Check the
GST_PAD_FLAG_NEED_RECONFIGUREflag onpadand returnTrueif 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
Queryto perform.
- peer_query_accept_caps(caps: Caps) bool#
Check if the peer of
padacceptscaps. Ifpadhas no peer, this function returnsTrue.- Parameters:
caps – a
Capsto 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
filtercontains the caps that upstream could produce in the order preferred by upstream. When called on sinkpadsfiltercontains the caps accepted by downstream in the preferred order.filtermight beNonebut if it is notNonethe returned caps will be a subset offilter.- Parameters:
filter – a
Capsfilter, 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_valinsrc_formattodest_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
Formatrequested
- peer_query_position(format: Format) tuple[bool, int]#
Queries the peer of a given sink pad for the stream position.
- Parameters:
format – the
Formatrequested
- proxy_query_accept_caps(query: Query) bool#
Checks if all internally linked pads of
padaccepts the caps inqueryand 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 ofpadand 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
bufferfrom the peer pad or fills up a provided buffer.This function will first trigger the pad block signal if it was installed.
When
padis not linkedGST_FLOW_NOT_LINKEDis 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
bufferpoints to a variable holdingNone, a valid newBufferwill be placed inbufferwhen 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,bufferwill still point toNone.When
bufferpoints 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,bufferwill be unchanged. If the provided buffer is larger thansize, onlysizebytes will be filled in the result buffer and its size will be updated accordingly.Note that less than
sizebytes can be returned inbufferwhen, for example, an EOS condition is near or whenbufferis not large enough to holdsizebytes. 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. Ifpadhas no peer,GST_FLOW_NOT_LINKEDwill be returned.In all cases, success or failure, the caller loses its reference to
bufferafter calling this function.- Parameters:
buffer – the
Bufferto 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
Eventto 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
padhas no peer,GST_FLOW_NOT_LINKEDwill be returned. If the peer pad does not have any installed chainlist function every group buffer of the list will be merged into a normalBufferand chained viachain().In all cases, success or failure, the caller loses its reference to
listafter calling this function.- Parameters:
list – the
BufferListto 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
Queryto perform.
- query_accept_caps(caps: Caps) bool#
Check if the given pad accepts the caps.
- Parameters:
caps – a
Capsto 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
filtercontains the caps that upstream could produce in the order preferred by upstream. When called on srcpadsfiltercontains the caps accepted by downstream in the preferred order.filtermight beNonebut if it is notNonethe 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_valinsrc_formattodest_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
padorNonequery – the
Queryto handle.
- query_duration(format: Format) tuple[bool, int]#
Queries a pad for the total stream duration.
- Parameters:
format – the
Formatrequested
- query_position(format: Format) tuple[bool, int]#
Queries a pad for the stream position.
- Parameters:
format – the
Formatrequested
- remove_probe(id: int) None#
Remove the probe with
idfrompad.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
padis a source pad,eventshould be an upstream event. Ifpadis a sink pad,eventshould be a downstream event. For example, you would not send aGST_EVENT_EOSon 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
Eventto send to the pad.
- set_activate_function_full(activate: Callable[[Pad, Object], bool], user_data: Any = None) 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
PadActivateFunctionto set.user_data – user_data passed to
notify
- set_activatemode_function_full(activatemode: Callable[[Pad, Object, PadMode, bool], bool], user_data: Any = None) None#
Sets the given activate_mode function for the pad. An activate_mode function prepares the element for data passing.
- Parameters:
activatemode – the
PadActivateModeFunctionto 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 aFalseargument.- Parameters:
active – whether or not the pad should be active.
- set_chain_function_full(chain: Callable[[Pad, Object | None, Buffer], FlowReturn], user_data: Any = None) None#
Sets the given chain function for the pad. The chain function is called to process a
Bufferinput buffer. seePadChainFunctionfor more details.- Parameters:
chain – the
PadChainFunctionto set.user_data – user_data passed to
notify
- set_chain_list_function_full(chainlist: Callable[[Pad, Object | None, BufferList], FlowReturn], user_data: Any = None) None#
Sets the given chain list function for the pad. The chainlist function is called to process a
BufferListinput buffer list. SeePadChainListFunctionfor more details.- Parameters:
chainlist – the
PadChainListFunctionto set.user_data – user_data passed to
notify
- set_element_private(priv: Any = 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[[Pad, Object | None, Event], FlowReturn], user_data: Any = None) None#
Sets the given event handler for the pad.
Added in version 1.8.
- Parameters:
event – the
PadEventFullFunctionto set.user_data – user_data passed to
notify
- set_event_function_full(event: Callable[[Pad, Object | None, Event], bool], user_data: Any = None) None#
Sets the given event handler for the pad.
- Parameters:
event – the
PadEventFunctionto set.user_data – user_data passed to
notify
- set_getrange_function_full(get: Callable[[Pad, Object | None, int, int, Buffer], FlowReturn], user_data: Any = None) None#
Sets the given getrange function for the pad. The getrange function is called to produce a new
Bufferto start the processing pipeline. seePadGetRangeFunctionfor a description of the getrange function.- Parameters:
get – the
PadGetRangeFunctionto set.user_data – user_data passed to
notify
- set_iterate_internal_links_function_full(iterintlink: Callable[[Pad, Object | None], Iterator], user_data: Any = None) None#
Sets the given internal link iterator function for the pad.
- Parameters:
iterintlink – the
PadIterIntLinkFunctionto set.user_data – user_data passed to
notify
- set_link_function_full(link: Callable[[Pad, Object | None, Pad], PadLinkReturn], user_data: Any = None) 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_OKshould be used when the connection can be made.The return value
GST_PAD_LINK_REFUSEDshould be used when the connection cannot be made for some reason.If
linkis installed on a source pad, it should call thePadLinkFunctionof the peer sink pad, if present.- Parameters:
link – the
PadLinkFunctionto 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[[Pad, Object | None, Query], bool], user_data: Any = None) None#
Set the given query function for the pad.
- Parameters:
query – the
PadQueryFunctionto set.user_data – user_data passed to
notify
- set_unlink_function_full(unlink: Callable[[Pad, Object | None], None], user_data: Any = None) 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
PadUnlinkFunctionto set.user_data – user_data passed to
notify
- start_task(func: Callable[[Any], None], user_data: Any = None) bool#
Starts a task that repeatedly calls
funcwithuser_data. This function is mostly used in pad activation functions to start the dataflow. TheGST_PAD_STREAM_LOCKofpadwill automatically be acquired beforefuncis called.- Parameters:
func – the task function to call
user_data – user data passed to the task function
- sticky_events_foreach(foreach_func: Callable[[Pad, Event | None, Any], bool], user_data: Any = None) None#
Iterates all sticky events on
padand callsforeach_funcfor every event. Ifforeach_funcreturnsFalsethe iteration is immediately stopped.- Parameters:
foreach_func – the
PadStickyEventsForeachFunctionthat 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
eventonpadAdded 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
Padto 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#
The type of the None singleton.
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#