:right-sidebar: True Pad =================================================================== .. currentmodule:: gi.repository.Gst .. class:: Pad(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gst.Object`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.Gst.ProxyPad` :Constructors: :: Pad(**properties) new(name:str=None, direction:Gst.PadDirection) -> Gst.Pad new_from_static_template(templ:Gst.StaticPadTemplate, name:str) -> Gst.Pad new_from_template(templ:Gst.PadTemplate, name:str=None) -> Gst.Pad Constructors ------------ .. rst-class:: interim-class .. class:: Pad :no-index: .. classmethod:: new(name: str | None, direction: ~gi.repository.Gst.PadDirection) -> ~gi.repository.Gst.Pad Creates a new pad with the given name in the given direction. If name is :const:`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. :param name: the name of the new pad. :param direction: the :obj:`~gi.repository.Gst.PadDirection` of the pad. .. classmethod:: new_from_static_template(templ: ~gi.repository.Gst.StaticPadTemplate, name: str) -> ~gi.repository.Gst.Pad Creates a new pad with the given name from the given static template. If name is :const:`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. :param templ: the :obj:`~gi.repository.Gst.StaticPadTemplate` to use :param name: the name of the pad .. classmethod:: new_from_template(templ: ~gi.repository.Gst.PadTemplate, name: str | None = None) -> ~gi.repository.Gst.Pad Creates a new pad with the given name from the given template. If name is :const:`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. :param templ: the pad template to use :param name: the name of the pad Methods ------- .. rst-class:: interim-class .. class:: Pad :no-index: .. method:: activate_mode(mode: ~gi.repository.Gst.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. :param mode: the requested activation mode :param active: whether or not the pad should be active. .. method:: add_probe(mask: ~gi.repository.Gst.PadProbeType, callback: ~typing.Callable[[...], ~gi.repository.Gst.PadProbeReturn], *user_data: ~typing.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 :func:`~gi.repository.Gst.Pad.add_probe`. In each of the groups, probes are called in the order in which they were added. :param mask: the probe mask :param callback: :obj:`~gi.repository.Gst.PadProbeCallback` that will be called with notifications of the pad state :param user_data: user data passed to the callback .. method:: can_link(sinkpad: ~gi.repository.Gst.Pad) -> bool Checks if the source pad and the sink pad are compatible so they can be linked. :param sinkpad: the sink :obj:`~gi.repository.Gst.Pad`. .. method:: chain(buffer: ~gi.repository.Gst.Buffer) -> ~gi.repository.Gst.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 returns ``GST_FLOW_NOT_NEGOTIATED``. The function proceeds calling the chain function installed on ``pad`` (see :func:`~gi.repository.Gst.pad_set_chain_function`) and the return value of that function is returned to the caller. ``GST_FLOW_NOT_SUPPORTED`` is returned if ``pad`` has no chain function. In all cases, success or failure, the caller loses its reference to ``buffer`` after calling this function. :param buffer: the :obj:`~gi.repository.Gst.Buffer` to send, return GST_FLOW_ERROR if not. .. method:: chain_list(list: ~gi.repository.Gst.BufferList) -> ~gi.repository.Gst.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 returns ``GST_FLOW_NOT_NEGOTIATED``. The function proceeds calling the chainlist function installed on ``pad`` (see :func:`~gi.repository.Gst.pad_set_chain_list_function`) and the return value of that function is returned to the caller. ``GST_FLOW_NOT_SUPPORTED`` is returned if ``pad`` has no chainlist function. In all cases, success or failure, the caller loses its reference to ``list`` after calling this function. MT safe. :param list: the :obj:`~gi.repository.Gst.BufferList` to send, return GST_FLOW_ERROR if not. .. method:: check_reconfigure() -> bool Check and clear the ``GST_PAD_FLAG_NEED_RECONFIGURE`` flag on ``pad`` and return :const:`True` if the flag was set. .. method:: create_stream_id(parent: ~gi.repository.Gst.Element, stream_id: str | None = None) -> str Creates a stream-id for the source :obj:`~gi.repository.Gst.Pad` ``pad`` by combining the upstream information with the optional ``stream_id`` of the stream of ``pad``. ``pad`` must have a parent :obj:`~gi.repository.Gst.Element` and which must have zero or one sinkpad. ``stream_id`` can only be :const:`None` if the parent element of ``pad`` 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``. :param parent: Parent :obj:`~gi.repository.Gst.Element` of ``pad`` :param stream_id: The stream-id .. method:: event_default(parent: ~gi.repository.Gst.Object | None, event: ~gi.repository.Gst.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 of ``event``. :param parent: the parent of ``pad`` or :const:`None` :param event: the :obj:`~gi.repository.Gst.Event` to handle. .. method:: forward(forward: ~typing.Callable[[...], bool], *user_data: ~typing.Any) -> bool Calls ``forward`` for all internally linked pads of ``pad``. 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 :const:`True`, no further pads will be processed. :param forward: a :obj:`~gi.repository.Gst.PadForwardFunction` :param user_data: user data passed to ``forward`` .. method:: get_allowed_caps() -> ~gi.repository.Gst.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 :func:`~gi.repository.Gst.Pad.query_caps` on ``pad`` and its peer. The caller owns a reference on the resulting caps. .. method:: get_current_caps() -> ~gi.repository.Gst.Caps | None Gets the capabilities currently configured on ``pad`` with the last ``GST_EVENT_CAPS`` event. .. method:: get_direction() -> ~gi.repository.Gst.PadDirection Gets the direction of the pad. The direction of the pad is decided at construction time so this function does not take the LOCK. .. method:: get_element_private() -> None Gets the private data of a pad. No locking is performed in this function. .. method:: get_last_flow_return() -> ~gi.repository.Gst.FlowReturn Gets the :obj:`~gi.repository.Gst.FlowReturn` return from the last data passed by this pad. .. versionadded:: 1.4 .. method:: get_offset() -> int Get the offset applied to the running time of ``pad``. ``pad`` has to be a source pad. .. method:: get_pad_template() -> ~gi.repository.Gst.PadTemplate | None Gets the template for ``pad``. .. method:: get_pad_template_caps() -> ~gi.repository.Gst.Caps Gets the capabilities for ``pad``'s template. .. method:: get_parent_element() -> ~gi.repository.Gst.Element | None Gets the parent of ``pad``, cast to a :obj:`~gi.repository.Gst.Element`. If a ``pad`` has no parent or its parent is not an element, return :const:`None`. .. method:: get_peer() -> ~gi.repository.Gst.Pad | None Gets the peer of ``pad``. This function refs the peer pad so you need to unref it after use. .. method:: get_range(offset: int, size: int) -> tuple[~gi.repository.Gst.FlowReturn, ~gi.repository.Gst.Buffer] When ``pad`` is flushing this function returns ``GST_FLOW_FLUSHING`` immediately and ``buffer`` is :const:`None`. Calls the getrange function of ``pad``, see :obj:`~gi.repository.Gst.PadGetRangeFunction` for a description of a getrange function. If ``pad`` has no getrange function installed (see :func:`~gi.repository.Gst.pad_set_getrange_function`) this function returns ``GST_FLOW_NOT_SUPPORTED``. If ``buffer`` points to a variable holding :const:`None`, a valid new :obj:`~gi.repository.Gst.Buffer` will be placed in ``buffer`` when this function returns ``GST_FLOW_OK``. The new buffer must be freed with gst_buffer_unref() after usage. When ``buffer`` points to a variable that points to a valid :obj:`~gi.repository.Gst.Buffer`, the buffer will be filled with the result data when this function returns ``GST_FLOW_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_FLOW_OK``, ``buffer`` will be unchanged. This is a lowlevel function. Usually :func:`~gi.repository.Gst.Pad.pull_range` is used. :param offset: The start offset of the buffer :param size: The length of the buffer .. method:: get_single_internal_link() -> ~gi.repository.Gst.Pad | None If there is a single internal link of the given pad, this function will return it. Otherwise, it will return NULL. .. versionadded:: 1.18 .. method:: get_sticky_event(event_type: ~gi.repository.Gst.EventType, idx: int) -> ~gi.repository.Gst.Event | None Returns a new reference of the sticky event of type ``event_type`` from the event. :param event_type: the :obj:`~gi.repository.Gst.EventType` that should be retrieved. :param idx: the index of the event .. method:: get_stream() -> ~gi.repository.Gst.Stream | None Returns the current :obj:`~gi.repository.Gst.Stream` for the ``pad``, or :const:`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 :func:`~gi.repository.Gst.Pad.get_sticky_event` and :func:`~gi.repository.Gst.Event.parse_stream`. .. versionadded:: 1.10 .. method:: get_stream_id() -> str | None Returns the current stream-id for the ``pad``, or :const:`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 :func:`~gi.repository.Gst.Pad.get_sticky_event` and :func:`~gi.repository.Gst.Event.parse_stream_start`. The returned stream-id string should be treated as an opaque string, its contents should not be interpreted. .. versionadded:: 1.2 .. method:: get_task_state() -> ~gi.repository.Gst.TaskState Get ``pad`` task state. If no task is currently set, ``GST_TASK_STOPPED`` is returned. .. versionadded:: 1.12 .. method:: has_current_caps() -> bool Check if ``pad`` has caps set on it with a ``GST_EVENT_CAPS`` event. .. method:: is_active() -> bool Query if a pad is active .. method:: 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 :func:`~gi.repository.Gst.Pad.is_blocking`). .. method:: 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 :obj:`~gi.repository.Gst.Buffer` or a :obj:`~gi.repository.Gst.Event`. .. method:: is_linked() -> bool Checks if a ``pad`` is linked to another pad or not. .. method:: iterate_internal_links() -> ~gi.repository.Gst.Iterator | None Gets an iterator for the pads to which the given pad is linked to inside of the parent element. Each :obj:`~gi.repository.Gst.Pad` element yielded by the iterator will have its refcount increased, so unref after use. Free-function: gst_iterator_free .. method:: iterate_internal_links_default(parent: ~gi.repository.Gst.Object | None = None) -> ~gi.repository.Gst.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 :func:`~gi.repository.Gst.Iterator.free`. :param parent: the parent of ``pad`` or :const:`None` .. method:: link(sinkpad: ~gi.repository.Gst.Pad) -> ~gi.repository.Gst.PadLinkReturn Links the source pad and the sink pad. :param sinkpad: the sink :obj:`~gi.repository.Gst.Pad` to link. .. method:: link_full(sinkpad: ~gi.repository.Gst.Pad, flags: ~gi.repository.Gst.PadLinkCheck) -> ~gi.repository.Gst.PadLinkReturn Links the source pad and the sink pad. This variant of ``gst_pad_link`` provides a more granular control on the checks being done when linking. While providing some considerable speedups the caller of this method must be aware that wrong usage of those flags can cause severe issues. Refer to the documentation of :obj:`~gi.repository.Gst.PadLinkCheck` for more information. MT Safe. :param sinkpad: the sink :obj:`~gi.repository.Gst.Pad` to link. :param flags: the checks to validate when linking .. method:: link_get_name(ret: ~gi.repository.Gst.PadLinkReturn) -> str Gets a string representing the given pad-link return. .. versionadded:: 1.4 :param ret: a :obj:`~gi.repository.Gst.PadLinkReturn` to get the name of. .. method:: link_maybe_ghosting(sink: ~gi.repository.Gst.Pad) -> bool Links ``src`` to ``sink``, creating any :obj:`~gi.repository.Gst.GhostPad`'s in between as necessary. This is a convenience function to save having to create and add intermediate :obj:`~gi.repository.Gst.GhostPad`'s as required for linking across :obj:`~gi.repository.Gst.Bin` boundaries. If ``src`` or ``sink`` pads don't have parent elements or do not share a common ancestor, the link will fail. .. versionadded:: 1.10 :param sink: a :obj:`~gi.repository.Gst.Pad` .. method:: link_maybe_ghosting_full(sink: ~gi.repository.Gst.Pad, flags: ~gi.repository.Gst.PadLinkCheck) -> bool Links ``src`` to ``sink``, creating any :obj:`~gi.repository.Gst.GhostPad`'s in between as necessary. This is a convenience function to save having to create and add intermediate :obj:`~gi.repository.Gst.GhostPad`'s as required for linking across :obj:`~gi.repository.Gst.Bin` boundaries. If ``src`` or ``sink`` pads don't have parent elements or do not share a common ancestor, the link will fail. Calling :func:`~gi.repository.Gst.Pad.link_maybe_ghosting_full` with ``flags`` == :const:`~gi.repository.Gst.PadLinkCheck.DEFAULT` is the recommended way of linking pads with safety checks applied. .. versionadded:: 1.10 :param sink: a :obj:`~gi.repository.Gst.Pad` :param flags: some :obj:`~gi.repository.Gst.PadLinkCheck` flags .. method:: mark_reconfigure() -> None Mark a pad for needing reconfiguration. The next call to :func:`~gi.repository.Gst.Pad.check_reconfigure` will return :const:`True` after this call. .. method:: needs_reconfigure() -> bool Check the ``GST_PAD_FLAG_NEED_RECONFIGURE`` flag on ``pad`` and return :const:`True` if the flag was set. .. method:: 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. .. method:: peer_query(query: ~gi.repository.Gst.Query) -> bool Performs :func:`~gi.repository.Gst.Pad.query` on the peer of ``pad``. The caller is responsible for both the allocation and deallocation of the query structure. :param query: the :obj:`~gi.repository.Gst.Query` to perform. .. method:: peer_query_accept_caps(caps: ~gi.repository.Gst.Caps) -> bool Check if the peer of ``pad`` accepts ``caps``. If ``pad`` has no peer, this function returns :const:`True`. :param caps: a :obj:`~gi.repository.Gst.Caps` to check on the pad .. method:: peer_query_caps(filter: ~gi.repository.Gst.Caps | None = None) -> ~gi.repository.Gst.Caps Gets the capabilities of the peer connected to this pad. Similar to :func:`~gi.repository.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 :const:`None` but if it is not :const:`None` the returned caps will be a subset of ``filter``. :param filter: a :obj:`~gi.repository.Gst.Caps` filter, or :const:`None`. .. method:: peer_query_convert(src_format: ~gi.repository.Gst.Format, src_val: int, dest_format: ~gi.repository.Gst.Format) -> tuple[bool, int] Queries the peer pad of a given sink pad to convert ``src_val`` in ``src_format`` to ``dest_format``. :param src_format: a :obj:`~gi.repository.Gst.Format` to convert from. :param src_val: a value to convert. :param dest_format: the :obj:`~gi.repository.Gst.Format` to convert to. .. method:: peer_query_duration(format: ~gi.repository.Gst.Format) -> tuple[bool, int] Queries the peer pad of a given sink pad for the total stream duration. :param format: the :obj:`~gi.repository.Gst.Format` requested .. method:: peer_query_position(format: ~gi.repository.Gst.Format) -> tuple[bool, int] Queries the peer of a given sink pad for the stream position. :param format: the :obj:`~gi.repository.Gst.Format` requested .. method:: proxy_query_accept_caps(query: ~gi.repository.Gst.Query) -> bool Checks if all internally linked pads of ``pad`` 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. :param query: an ACCEPT_CAPS :obj:`~gi.repository.Gst.Query`. .. method:: proxy_query_caps(query: ~gi.repository.Gst.Query) -> bool Calls :func:`~gi.repository.Gst.Pad.query_caps` for all internally linked pads of ``pad`` 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. :param query: a CAPS :obj:`~gi.repository.Gst.Query`. .. method:: pull_range(offset: int, size: int) -> tuple[~gi.repository.Gst.FlowReturn, ~gi.repository.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 ``pad`` is not linked ``GST_FLOW_NOT_LINKED`` is returned else this function returns the result of :func:`~gi.repository.Gst.Pad.get_range` on the peer pad. See :func:`~gi.repository.Gst.Pad.get_range` for a list of return values and for the semantics of the arguments of this function. If ``buffer`` points to a variable holding :const:`None`, a valid new :obj:`~gi.repository.Gst.Buffer` will be placed in ``buffer`` when this function returns ``GST_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 to :const:`None`. When ``buffer`` points to a variable that points to a valid :obj:`~gi.repository.Gst.Buffer`, the buffer will be filled with the result data when this function returns ``GST_FLOW_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. :param offset: The start offset of the buffer :param size: The length of the buffer .. method:: push(buffer: ~gi.repository.Gst.Buffer) -> ~gi.repository.Gst.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 :func:`~gi.repository.Gst.Pad.chain` on the peer pad and returns the value from that function. If ``pad`` has no peer, ``GST_FLOW_NOT_LINKED`` will be returned. In all cases, success or failure, the caller loses its reference to ``buffer`` after calling this function. :param buffer: the :obj:`~gi.repository.Gst.Buffer` to push returns GST_FLOW_ERROR if not. .. method:: push_event(event: ~gi.repository.Gst.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. :param event: the :obj:`~gi.repository.Gst.Event` to send to the pad. .. method:: push_list(list: ~gi.repository.Gst.BufferList) -> ~gi.repository.Gst.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 normal :obj:`~gi.repository.Gst.Buffer` and chained via :func:`~gi.repository.Gst.Pad.chain`. In all cases, success or failure, the caller loses its reference to ``list`` after calling this function. :param list: the :obj:`~gi.repository.Gst.BufferList` to push returns GST_FLOW_ERROR if not. .. method:: query(query: ~gi.repository.Gst.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. :param query: the :obj:`~gi.repository.Gst.Query` to perform. .. method:: query_accept_caps(caps: ~gi.repository.Gst.Caps) -> bool Check if the given pad accepts the caps. :param caps: a :obj:`~gi.repository.Gst.Caps` to check on the pad .. method:: query_caps(filter: ~gi.repository.Gst.Caps | None = None) -> ~gi.repository.Gst.Caps Gets the capabilities this pad can produce or consume. Note that this method doesn't necessarily return the caps set by sending a :func:`~gi.repository.Gst.Event.new_caps` - use :func:`~gi.repository.Gst.Pad.get_current_caps` for that instead. gst_pad_query_caps returns all possible caps a pad can operate with, using the pad's CAPS query function, If the query fails, this function will return ``filter``, if not :const:`None`, otherwise ANY. When called on sinkpads ``filter`` contains the caps that upstream could produce in the order preferred by upstream. When called on srcpads ``filter`` contains the caps accepted by downstream in the preferred order. ``filter`` might be :const:`None` but if it is not :const:`None` the returned caps will be a subset of ``filter``. Note that this function does not return writable :obj:`~gi.repository.Gst.Caps`, use :func:`~gi.repository.Gst.caps_make_writable` before modifying the caps. :param filter: suggested :obj:`~gi.repository.Gst.Caps`, or :const:`None` .. method:: query_convert(src_format: ~gi.repository.Gst.Format, src_val: int, dest_format: ~gi.repository.Gst.Format) -> tuple[bool, int] Queries a pad to convert ``src_val`` in ``src_format`` to ``dest_format``. :param src_format: a :obj:`~gi.repository.Gst.Format` to convert from. :param src_val: a value to convert. :param dest_format: the :obj:`~gi.repository.Gst.Format` to convert to. .. method:: query_default(parent: ~gi.repository.Gst.Object | None, query: ~gi.repository.Gst.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 to ``pad``, only one will be sent the query. Multi-sinkpad elements should implement custom query handlers. :param parent: the parent of ``pad`` or :const:`None` :param query: the :obj:`~gi.repository.Gst.Query` to handle. .. method:: query_duration(format: ~gi.repository.Gst.Format) -> tuple[bool, int] Queries a pad for the total stream duration. :param format: the :obj:`~gi.repository.Gst.Format` requested .. method:: query_position(format: ~gi.repository.Gst.Format) -> tuple[bool, int] Queries a pad for the stream position. :param format: the :obj:`~gi.repository.Gst.Format` requested .. method:: remove_probe(id: int) -> None Remove the probe with ``id`` from ``pad``. MT safe. :param id: the probe id to remove .. method:: send_event(event: ~gi.repository.Gst.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. If ``pad`` is a sink pad, ``event`` should be a downstream event. For example, you would not send a ``GST_EVENT_EOS`` on a src pad; EOS events only propagate downstream. Furthermore, some downstream events have to be serialized with data flow, like EOS, while some can travel out-of-band, like ``GST_EVENT_FLUSH_START``. If the event needs to be serialized with data flow, this function will take the pad's stream lock while calling its event function. To find out whether an event type is upstream, downstream, or downstream and serialized, see :obj:`~gi.repository.Gst.EventTypeFlags`, gst_event_type_get_flags(), ``GST_EVENT_IS_UPSTREAM``, ``GST_EVENT_IS_DOWNSTREAM``, and ``GST_EVENT_IS_SERIALIZED``. Note that in practice that an application or plugin doesn't need to bother itself with this information; the core handles all necessary locks and checks. This function takes ownership of the provided event so you should gst_event_ref() it if you want to reuse the event after this call. :param event: the :obj:`~gi.repository.Gst.Event` to send to the pad. .. method:: set_activate_function_full(activate: ~typing.Callable[[...], bool], *user_data: ~typing.Any) -> None Sets the given activate function for ``pad``. The activate function will dispatch to :func:`~gi.repository.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. :param activate: the :obj:`~gi.repository.Gst.PadActivateFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: set_activatemode_function_full(activatemode: ~typing.Callable[[...], bool], *user_data: ~typing.Any) -> None Sets the given activate_mode function for the pad. An activate_mode function prepares the element for data passing. :param activatemode: the :obj:`~gi.repository.Gst.PadActivateModeFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: 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``, calls :func:`~gi.repository.Gst.Pad.activate_mode` with the pad's current mode and a :const:`False` argument. :param active: whether or not the pad should be active. .. method:: set_chain_function_full(chain: ~typing.Callable[[...], ~gi.repository.Gst.FlowReturn], *user_data: ~typing.Any) -> None Sets the given chain function for the pad. The chain function is called to process a :obj:`~gi.repository.Gst.Buffer` input buffer. see :obj:`~gi.repository.Gst.PadChainFunction` for more details. :param chain: the :obj:`~gi.repository.Gst.PadChainFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: set_chain_list_function_full(chainlist: ~typing.Callable[[...], ~gi.repository.Gst.FlowReturn], *user_data: ~typing.Any) -> None Sets the given chain list function for the pad. The chainlist function is called to process a :obj:`~gi.repository.Gst.BufferList` input buffer list. See :obj:`~gi.repository.Gst.PadChainListFunction` for more details. :param chainlist: the :obj:`~gi.repository.Gst.PadChainListFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: 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. :param priv: The private data to attach to the pad. .. method:: set_event_full_function_full(event: ~typing.Callable[[...], ~gi.repository.Gst.FlowReturn], *user_data: ~typing.Any) -> None Sets the given event handler for the pad. .. versionadded:: 1.8 :param event: the :obj:`~gi.repository.Gst.PadEventFullFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: set_event_function_full(event: ~typing.Callable[[...], bool], *user_data: ~typing.Any) -> None Sets the given event handler for the pad. :param event: the :obj:`~gi.repository.Gst.PadEventFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: set_getrange_function_full(get: ~typing.Callable[[...], ~gi.repository.Gst.FlowReturn], *user_data: ~typing.Any) -> None Sets the given getrange function for the pad. The getrange function is called to produce a new :obj:`~gi.repository.Gst.Buffer` to start the processing pipeline. see :obj:`~gi.repository.Gst.PadGetRangeFunction` for a description of the getrange function. :param get: the :obj:`~gi.repository.Gst.PadGetRangeFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: set_iterate_internal_links_function_full(iterintlink: ~typing.Callable[[...], ~gi.repository.Gst.Iterator], *user_data: ~typing.Any) -> None Sets the given internal link iterator function for the pad. :param iterintlink: the :obj:`~gi.repository.Gst.PadIterIntLinkFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: set_link_function_full(link: ~typing.Callable[[...], ~gi.repository.Gst.PadLinkReturn], *user_data: ~typing.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 the :obj:`~gi.repository.Gst.PadLinkFunction` of the peer sink pad, if present. :param link: the :obj:`~gi.repository.Gst.PadLinkFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: set_offset(offset: int) -> None Set the offset that will be applied to the running time of ``pad``. :param offset: the offset .. method:: set_query_function_full(query: ~typing.Callable[[...], bool], *user_data: ~typing.Any) -> None Set the given query function for the pad. :param query: the :obj:`~gi.repository.Gst.PadQueryFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: set_unlink_function_full(unlink: ~typing.Callable[[...], None], *user_data: ~typing.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. :param unlink: the :obj:`~gi.repository.Gst.PadUnlinkFunction` to set. :param user_data: user_data passed to ``notify`` .. method:: start_task(func: ~typing.Callable[[...], None], *user_data: ~typing.Any) -> bool Starts a task that repeatedly calls ``func`` with ``user_data``. This function is mostly used in pad activation functions to start the dataflow. The ``GST_PAD_STREAM_LOCK`` of ``pad`` will automatically be acquired before ``func`` is called. :param func: the task function to call :param user_data: user data passed to the task function .. method:: sticky_events_foreach(foreach_func: ~typing.Callable[[...], bool], *user_data: ~typing.Any) -> None Iterates all sticky events on ``pad`` and calls ``foreach_func`` for every event. If ``foreach_func`` returns :const:`False` the iteration is immediately stopped. :param foreach_func: the :obj:`~gi.repository.Gst.PadStickyEventsForeachFunction` that should be called for every event. :param user_data: the optional user data. .. method:: 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 :func:`~gi.repository.Gst.Task.pause` instead. Regardless of whether the pad has a task, the stream lock is acquired and released so as to ensure that streaming through this pad has finished. .. method:: store_sticky_event(event: ~gi.repository.Gst.Event) -> ~gi.repository.Gst.FlowReturn Store the sticky ``event`` on ``pad`` .. versionadded:: 1.2 :param event: a :obj:`~gi.repository.Gst.Event` .. method:: unlink(sinkpad: ~gi.repository.Gst.Pad) -> bool Unlinks the source pad from the sink pad. Will emit the :obj:`~gi.repository.Gst.Pad`::unlinked signal on both pads. :param sinkpad: the sink :obj:`~gi.repository.Gst.Pad` to unlink. .. method:: 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 ---------- .. rst-class:: interim-class .. class:: Pad :no-index: .. attribute:: props.caps :type: ~gi.repository.Gst.Caps .. attribute:: props.direction :type: ~gi.repository.Gst.PadDirection .. attribute:: props.offset :type: int The offset that will be applied to the running time of the pad. .. versionadded:: 1.6 .. attribute:: props.template :type: ~gi.repository.Gst.PadTemplate Signals ------- .. rst-class:: interim-class .. class:: Pad.signals :no-index: .. method:: linked(peer: ~gi.repository.Gst.Pad) -> None Signals that a pad has been linked to the peer pad. :param peer: the peer pad that has been connected .. method:: unlinked(peer: ~gi.repository.Gst.Pad) -> None Signals that a pad has been unlinked from the peer pad. :param peer: the peer pad that has been disconnected Virtual Methods --------------- .. rst-class:: interim-class .. class:: Pad :no-index: .. method:: do_linked(peer: ~gi.repository.Gst.Pad) -> None :param peer: .. method:: do_unlinked(peer: ~gi.repository.Gst.Pad) -> None :param peer: Fields ------ .. rst-class:: interim-class .. class:: Pad :no-index: .. attribute:: activatedata .. attribute:: activatefunc .. attribute:: activatemodedata .. attribute:: activatemodefunc .. attribute:: activatemodenotify .. attribute:: activatenotify .. attribute:: block_cond .. attribute:: chaindata .. attribute:: chainfunc .. attribute:: chainlistdata .. attribute:: chainlistfunc .. attribute:: chainlistnotify .. attribute:: chainnotify .. attribute:: direction The direction of the pad, cannot change after creating the pad. .. attribute:: element_private Private data owned by the parent element .. attribute:: eventdata .. attribute:: eventfunc .. attribute:: eventnotify .. attribute:: getrangedata .. attribute:: getrangefunc .. attribute:: getrangenotify .. attribute:: iterintlinkdata .. attribute:: iterintlinkfunc .. attribute:: iterintlinknotify .. attribute:: linkdata .. attribute:: linkfunc .. attribute:: linknotify .. attribute:: mode .. attribute:: num_blocked .. attribute:: num_probes .. attribute:: object .. attribute:: offset .. attribute:: padtemplate Padtemplate for this pad .. attribute:: peer .. attribute:: priv .. attribute:: probes .. attribute:: querydata .. attribute:: queryfunc .. attribute:: querynotify .. attribute:: stream_rec_lock .. attribute:: task .. attribute:: unlinkdata .. attribute:: unlinkfunc .. attribute:: unlinknotify