Gst.Pad¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
Virtual Methods¶
- Inherited:
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
The capabilities of the pad |
||
r/w/co |
The direction of the pad |
||
r/w |
The running time offset of the pad |
||
r/w |
The |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Signals that a pad has been linked to the peer pad. |
|
Signals that a pad has been unlinked from the peer pad. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
activatedata |
r |
||
activatefunc |
r |
||
activatemodedata |
r |
||
activatemodefunc |
r |
||
activatemodenotify |
r |
||
activatenotify |
r |
||
block_cond |
r |
||
chaindata |
r |
||
chainfunc |
r |
||
chainlistdata |
r |
||
chainlistfunc |
r |
||
chainlistnotify |
r |
||
chainnotify |
r |
||
direction |
r |
the direction of the pad, cannot change after creating the pad. |
|
element_private |
r |
private data owned by the parent element |
|
eventdata |
r |
||
eventfunc |
r |
||
eventnotify |
r |
||
getrangedata |
r |
||
getrangefunc |
r |
||
getrangenotify |
r |
||
iterintlinkdata |
r |
||
iterintlinkfunc |
r |
||
iterintlinknotify |
r |
||
linkdata |
r |
||
linkfunc |
r |
||
linknotify |
r |
||
mode |
r |
||
num_blocked |
r |
||
num_probes |
r |
||
object |
r |
||
offset |
r |
||
padtemplate |
r |
padtemplate for this pad |
|
peer |
r |
||
probes |
r |
||
querydata |
r |
||
queryfunc |
r |
||
querynotify |
r |
||
stream_rec_lock |
r |
||
task |
r |
||
unlinkdata |
r |
||
unlinkfunc |
r |
||
unlinknotify |
r |
Class Details¶
- class Gst.Pad(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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
withGst.Pad.new_from_template
() and are then added to aGst.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 isNone
, 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 withGst.Pad.link
(). (For quick links, you can also useGst.Element.link
(), which will make the obvious link for you if it’s straightforward.). Pads can be unlinked again withGst.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
() andGst.Pad.peer_query
() can be used to query various properties of the pad and the stream.To send a
Gst.Event
on a pad, useGst.Pad.send_event
() andGst.Pad.push_event
(). Some events will be sticky on the pad, meaning that after they pass on the pad they can be queried later withGst.Pad.get_sticky_event
() andGst.Pad.sticky_events_foreach
().Gst.Pad.get_current_caps
() andGst.Pad.has_current_caps
() are convenience functions to query the current sticky CAPS event on a pad.GstElements will use
Gst.Pad.push
() andGst.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
() andGst.Pad.stop_task
() respectively.- classmethod link_get_name(ret)[source]¶
- Parameters:
ret (
Gst.PadLinkReturn
) – aGst.PadLinkReturn
to get the name of.- Returns:
a static string with the name of the pad-link return.
- Return type:
Gets a string representing the given pad-link return.
New in version 1.4.
- classmethod new(name, direction)[source]¶
- Parameters:
direction (
Gst.PadDirection
) – theGst.PadDirection
of the pad.
- Returns:
a new
Gst.Pad
.MT safe.
- Return type:
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:
templ (
Gst.StaticPadTemplate
) – theGst.StaticPadTemplate
to usename (
str
) – the name of the pad
- Returns:
a new
Gst.Pad
.- Return type:
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:
templ (
Gst.PadTemplate
) – the pad template to use
- Returns:
a new
Gst.Pad
.- Return type:
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 modeactive (
bool
) – whether or not the pad should be active.
- Returns:
True
if the operation was successful.MT safe.
- Return type:
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:
mask (
Gst.PadProbeType
) – the probe maskcallback (
Gst.PadProbeCallback
) –Gst.PadProbeCallback
that will be called with notifications of the pad stateuser_data (
object
orNone
) – user data passed to the callback
- 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 usingGst.PadProbeType.IDLE
it can happen that the probe can be run immediately and if the probe returnsGst.PadProbeReturn.REMOVE
this functions returns 0.MT safe.
- Return type:
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 finallyGst.PadProbeType.IDLE
. The only exception here areGst.PadProbeType.IDLE
probes that are called immediately if the pad is already idle while callingGst.Pad.add_probe
(). In each of the groups, probes are called in the order in which they were added.
- can_link(sinkpad)[source]¶
- Parameters:
- Returns:
True
if the pads can be linked.- Return type:
Checks if the source pad and the sink pad are compatible so they can be linked.
- chain(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – theGst.Buffer
to send, returnGst.FlowReturn.ERROR
if not.- Returns:
a
Gst.FlowReturn
from the pad.MT safe.
- Return type:
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 returnsGst.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
) – theGst.BufferList
to send, returnGst.FlowReturn.ERROR
if not.- Returns:
a
Gst.FlowReturn
from the pad.- Return type:
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 theGst.PadFlags.NEED_RECONFIGURE
flag was set on self.- Return type:
Check and clear the
Gst.PadFlags.NEED_RECONFIGURE
flag on self and returnTrue
if the flag was set.
- create_stream_id(parent, stream_id)[source]¶
- Parameters:
parent (
Gst.Element
) – ParentGst.Element
of self
- Returns:
A stream-id for self.
GLib.free
() after usage.- Return type:
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 parentGst.Element
and which must have zero or one sinkpad. stream_id can only beNone
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:
parent (
Gst.Object
orNone
) – the parent of self orNone
- Returns:
True
if the event was sent successfully.- Return type:
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:
forward (
Gst.PadForwardFunction
) – aGst.PadForwardFunction
- Returns:
- Return type:
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 returnsNone
when self has no peer.MT safe.
- Return type:
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:
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:
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]¶
-
Gets the private data of a pad. No locking is performed in this function.
- get_last_flow_return()[source]¶
- Return type:
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:
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, orNone
if this pad has no template. Unref after usage.- Return type:
Gets the template for self.
- 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
orNone
Gets the parent of self, cast to a
Gst.Element
. If a self has no parent or its parent is not an element, returnNone
.
- get_peer()[source]¶
-
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:
- Returns:
a
Gst.FlowReturn
from the pad.MT safe.
- buffer:
a pointer to hold the
Gst.Buffer
, returnsGst.FlowReturn.ERROR
ifNone
.
- Return type:
(
Gst.FlowReturn
, buffer:Gst.Buffer
)
When self is flushing this function returns
Gst.FlowReturn.FLUSHING
immediately and buffer isNone
.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 returnsGst.FlowReturn.NOT_SUPPORTED
.If buffer points to a variable holding
None
, a valid newGst.Buffer
will be placed in buffer when this function returnsGst.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 returnsGst.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.
- get_single_internal_link()[source]¶
- Returns:
a
Gst.Pad
, orNone
if self has none or more than one internal links. Unref returned pad withGst.Object.unref
().- Return type:
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:
event_type (
Gst.EventType
) – theGst.EventType
that should be retrieved.idx (
int
) – the index of the event
- Returns:
a
Gst.Event
of type event_type orNone
when no event of event_type was on self. Unref after usage.- Return type:
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, orNone
. unref the returned stream when no longer needed.- Return type:
Gst.Stream
orNone
Returns the current
Gst.Stream
for the self, 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
Gst.Pad.get_sticky_event
() andGst.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:
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
() andGst.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:
Get self task state. If no task is currently set,
Gst.TaskState.STOPPED
is returned.New in version 1.12.
- has_current_caps()[source]¶
-
Check if self has caps set on it with a
Gst.EventType.CAPS
event.
- is_blocked()[source]¶
-
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]¶
-
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 aGst.Event
.
- iterate_internal_links()[source]¶
- Returns:
a new
Gst.Iterator
ofGst.Pad
orNone
when the pad does not have an iterator function configured. UseGst.Iterator.free
() after usage.- Return type:
Gst.Iterator
orNone
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
- iterate_internal_links_default(parent)[source]¶
- Parameters:
parent (
Gst.Object
orNone
) – the parent of self orNone
- Returns:
a
Gst.Iterator
ofGst.Pad
, orNone
if self has no parent. Unref each returned pad withGst.Object.unref
().- Return type:
Gst.Iterator
orNone
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
().
- link(sinkpad)[source]¶
- Parameters:
- Returns:
A result code indicating if the connection worked or what went wrong.
MT Safe.
- Return type:
Links the source pad and the sink pad.
- link_full(sinkpad, flags)[source]¶
- Parameters:
flags (
Gst.PadLinkCheck
) – the checks to validate when linking
- Returns:
A result code indicating if the connection worked or what went wrong.
- Return type:
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 ofGst.PadLinkCheck
for more information.MT Safe.
- link_maybe_ghosting(sink)[source]¶
-
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 acrossGst.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.
- link_maybe_ghosting_full(sink, flags)[source]¶
- Parameters:
flags (
Gst.PadLinkCheck
) – someGst.PadLinkCheck
flags
- Returns:
whether the link succeeded.
- Return type:
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 acrossGst.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 returnTrue
after this call.
- needs_reconfigure()[source]¶
- Returns:
True
is theGst.PadFlags.NEED_RECONFIGURE
flag is set on self.- Return type:
Check the
Gst.PadFlags.NEED_RECONFIGURE
flag on self and returnTrue
if the flag was set.
- pause_task()[source]¶
-
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:
- Returns:
True
if the query could be performed. This function returnsFalse
if self has no peer.- Return type:
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:
- Returns:
True
if the peer of self can accept the caps or self has no peer.- Return type:
Check if the peer of self accepts caps. If self has no peer, this function returns
True
.
- peer_query_caps(filter)[source]¶
- Parameters:
- 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:
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 notNone
the returned caps will be a subset of filter.
- peer_query_convert(src_format, src_val, dest_format)[source]¶
- Parameters:
src_format (
Gst.Format
) – aGst.Format
to convert from.src_val (
int
) – a value to convert.dest_format (
Gst.Format
) – theGst.Format
to convert to.
- Returns:
True
if the query could be performed.- dest_val:
a pointer to the result.
- Return type:
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
) – theGst.Format
requested- Returns:
True
if the query could be performed.- duration:
a location in which to store the total duration, or
None
.
- Return type:
Queries the peer pad of a given sink pad for the total stream duration.
- peer_query_position(format)[source]¶
- Parameters:
format (
Gst.Format
) – theGst.Format
requested- Returns:
True
if the query could be performed.- cur:
a location in which to store the current position, or
None
.
- Return type:
Queries the peer of a given sink pad for the stream position.
- proxy_query_accept_caps(query)[source]¶
- Parameters:
- Returns:
True
if query could be executed- Return type:
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:
- Returns:
True
if query could be executed- Return type:
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:
- Returns:
a
Gst.FlowReturn
from the peer pad.MT safe.
- buffer:
a pointer to hold the
Gst.Buffer
, returnsGst.FlowReturn.ERROR
ifNone
.
- 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 ofGst.Pad.get_range
() on the peer pad. SeeGst.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 newGst.Buffer
will be placed in buffer when this function returnsGst.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 toNone
.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 returnsGst.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
) – theGst.Buffer
to push returnsGst.FlowReturn.ERROR
if not.- Returns:
a
Gst.FlowReturn
from the peer pad.MT safe.
- Return type:
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:
- Returns:
True
if the event was handled.MT safe.
- Return type:
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
) – theGst.BufferList
to push returnsGst.FlowReturn.ERROR
if not.- Returns:
a
Gst.FlowReturn
from the peer pad.MT safe.
- Return type:
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 normalGst.Buffer
and chained viaGst.Pad.chain
().In all cases, success or failure, the caller loses its reference to list after calling this function.
- query(query)[source]¶
- Parameters:
- Returns:
True
if the query could be performed.- Return type:
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:
- Returns:
True
if the pad can accept the caps.- Return type:
Check if the given pad accepts the caps.
- query_caps(filter)[source]¶
- Parameters:
- Returns:
the caps of the pad with incremented ref-count.
- Return type:
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
() - useGst.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 notNone
, 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 notNone
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:
src_format (
Gst.Format
) – aGst.Format
to convert from.src_val (
int
) – a value to convert.dest_format (
Gst.Format
) – theGst.Format
to convert to.
- Returns:
True
if the query could be performed.- dest_val:
a pointer to the result.
- Return type:
Queries a pad to convert src_val in src_format to dest_format.
- query_default(parent, query)[source]¶
- Parameters:
parent (
Gst.Object
orNone
) – the parent of self orNone
- Returns:
True
if the query was performed successfully.- Return type:
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
) – theGst.Format
requested- Returns:
True
if the query could be performed.- duration:
a location in which to store the total duration, or
None
.
- Return type:
Queries a pad for the total stream duration.
- query_position(format)[source]¶
- Parameters:
format (
Gst.Format
) – theGst.Format
requested- Returns:
True
if the query could be performed.- cur:
A location in which to store the current position, or
None
.
- Return type:
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:
- Returns:
True
if the event was handled.- Return type:
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, likeGst.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:
activate (
Gst.PadActivateFunction
) – theGst.PadActivateFunction
to set.
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:
activatemode (
Gst.PadActivateModeFunction
) – theGst.PadActivateModeFunction
to set.
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:
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 aFalse
argument.
- set_chain_function_full(chain, *user_data)[source]¶
- Parameters:
chain (
Gst.PadChainFunction
) – theGst.PadChainFunction
to set.
Sets the given chain function for the pad. The chain function is called to process a
Gst.Buffer
input buffer. seeGst.PadChainFunction
for more details.
- set_chain_list_function_full(chainlist, *user_data)[source]¶
- Parameters:
chainlist (
Gst.PadChainListFunction
) – theGst.PadChainListFunction
to set.
Sets the given chain list function for the pad. The chainlist function is called to process a
Gst.BufferList
input buffer list. SeeGst.PadChainListFunction
for more details.
- set_element_private(priv)[source]¶
-
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:
event (
Gst.PadEventFullFunction
) – theGst.PadEventFullFunction
to set.
Sets the given event handler for the pad.
New in version 1.8.
- set_event_function_full(event, *user_data)[source]¶
- Parameters:
event (
Gst.PadEventFunction
) – theGst.PadEventFunction
to set.
Sets the given event handler for the pad.
- set_getrange_function_full(get, *user_data)[source]¶
- Parameters:
get (
Gst.PadGetRangeFunction
) – theGst.PadGetRangeFunction
to set.
Sets the given getrange function for the pad. The getrange function is called to produce a new
Gst.Buffer
to start the processing pipeline. seeGst.PadGetRangeFunction
for a description of the getrange function.
- set_iterate_internal_links_function_full(iterintlink, *user_data)[source]¶
- Parameters:
iterintlink (
Gst.PadIterIntLinkFunction
) – theGst.PadIterIntLinkFunction
to set.
Sets the given internal link iterator function for the pad.
- set_link_function_full(link, *user_data)[source]¶
- Parameters:
link (
Gst.PadLinkFunction
) – theGst.PadLinkFunction
to set.
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:
query (
Gst.PadQueryFunction
) – theGst.PadQueryFunction
to set.
Set the given query function for the pad.
- set_unlink_function_full(unlink, *user_data)[source]¶
- Parameters:
unlink (
Gst.PadUnlinkFunction
) – theGst.PadUnlinkFunction
to set.
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:
func (
Gst.TaskFunction
) – the task function to calluser_data (
object
orNone
) – user data passed to the task function
- Returns:
a
True
if the task could be started.- Return type:
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:
foreach_func (
Gst.PadStickyEventsForeachFunction
) – theGst.PadStickyEventsForeachFunction
that should be called for every event.
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]¶
-
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. UseGst.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:
- Returns:
Gst.FlowReturn.OK
on success,Gst.FlowReturn.FLUSHING
when the pad was flushing orGst.FlowReturn.EOS
when the pad was EOS.- Return type:
Store the sticky event on self
New in version 1.2.
- unlink(sinkpad)[source]¶
- Parameters:
- Returns:
True
if the pads were unlinked. This function returnsFalse
if the pads were not linked together.MT safe.
- Return type:
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.
Signal Details¶
- Gst.Pad.signals.linked(pad, peer)¶
- Signal Name:
linked
- Flags:
- Parameters:
Signals that a pad has been linked to the peer pad.
Property Details¶
- Gst.Pad.props.caps¶
-
The capabilities of the pad
- Gst.Pad.props.direction¶
- Name:
direction
- Type:
- Default Value:
- Flags:
The direction of the pad
- Gst.Pad.props.offset¶
-
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:
- Default Value:
- Flags:
The
Gst.PadTemplate
of this pad