pub trait PadExt: IsA<Pad> + Sealed + 'static {
Show 48 methods
// Provided methods
fn activate_mode(
&self,
mode: PadMode,
active: bool,
) -> Result<(), BoolError> { ... }
fn can_link(&self, sinkpad: &impl IsA<Pad>) -> bool { ... }
fn chain(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError> { ... }
fn chain_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError> { ... }
fn check_reconfigure(&self) -> bool { ... }
fn create_stream_id(
&self,
parent: &impl IsA<Element>,
stream_id: Option<&str>,
) -> GString { ... }
fn forward<P: FnMut(&Pad) -> bool>(&self, forward: P) -> bool { ... }
fn allowed_caps(&self) -> Option<Caps> { ... }
fn current_caps(&self) -> Option<Caps> { ... }
fn direction(&self) -> PadDirection { ... }
fn last_flow_result(&self) -> Result<FlowSuccess, FlowError> { ... }
fn offset(&self) -> i64 { ... }
fn pad_template(&self) -> Option<PadTemplate> { ... }
fn pad_template_caps(&self) -> Caps { ... }
fn parent_element(&self) -> Option<Element> { ... }
fn peer(&self) -> Option<Pad> { ... }
fn single_internal_link(&self) -> Option<Pad> { ... }
fn stream(&self) -> Option<Stream> { ... }
fn stream_id(&self) -> Option<GString> { ... }
fn task_state(&self) -> TaskState { ... }
fn has_current_caps(&self) -> bool { ... }
fn is_active(&self) -> bool { ... }
fn is_blocked(&self) -> bool { ... }
fn is_blocking(&self) -> bool { ... }
fn is_linked(&self) -> bool { ... }
fn link(
&self,
sinkpad: &impl IsA<Pad>,
) -> Result<PadLinkSuccess, PadLinkError> { ... }
fn link_full(
&self,
sinkpad: &impl IsA<Pad>,
flags: PadLinkCheck,
) -> Result<PadLinkSuccess, PadLinkError> { ... }
fn link_maybe_ghosting(&self, sink: &impl IsA<Pad>) -> Result<(), BoolError> { ... }
fn link_maybe_ghosting_full(
&self,
sink: &impl IsA<Pad>,
flags: PadLinkCheck,
) -> Result<(), BoolError> { ... }
fn mark_reconfigure(&self) { ... }
fn needs_reconfigure(&self) -> bool { ... }
fn pause_task(&self) -> Result<(), BoolError> { ... }
fn peer_query_accept_caps(&self, caps: &Caps) -> bool { ... }
fn peer_query_caps(&self, filter: Option<&Caps>) -> Caps { ... }
fn push(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError> { ... }
fn push_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError> { ... }
fn query_accept_caps(&self, caps: &Caps) -> bool { ... }
fn query_caps(&self, filter: Option<&Caps>) -> Caps { ... }
fn set_active(&self, active: bool) -> Result<(), BoolError> { ... }
fn set_offset(&self, offset: i64) { ... }
fn stop_task(&self) -> Result<(), BoolError> { ... }
fn store_sticky_event(
&self,
event: &Event,
) -> Result<FlowSuccess, FlowError> { ... }
fn unlink(&self, sinkpad: &impl IsA<Pad>) -> Result<(), BoolError> { ... }
fn use_fixed_caps(&self) { ... }
fn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Provided Methods§
sourcefn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), BoolError>
fn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), BoolError>
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.
§mode
the requested activation mode
§active
whether or not the pad should be active.
§Returns
true
if the operation was successful.
MT safe.
sourcefn chain(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError>
fn chain(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError>
Chain a buffer to self
.
The function returns FlowReturn::Flushing
if the pad was flushing.
If the buffer type is not acceptable for self
(as negotiated with a
preceding GST_EVENT_CAPS event), this function returns
FlowReturn::NotNegotiated
.
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. FlowReturn::NotSupported
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.
§buffer
the Buffer
to send, return GST_FLOW_ERROR
if not.
§Returns
a FlowReturn
from the pad.
MT safe.
sourcefn chain_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError>
fn chain_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError>
Chain a bufferlist to self
.
The function returns FlowReturn::Flushing
if the pad was flushing.
If self
was not negotiated properly with a CAPS event, this function
returns FlowReturn::NotNegotiated
.
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. FlowReturn::NotSupported
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.
§list
the BufferList
to send, return GST_FLOW_ERROR
if not.
§Returns
a FlowReturn
from the pad.
sourcefn check_reconfigure(&self) -> bool
fn check_reconfigure(&self) -> bool
Check and clear the PadFlags::NEED_RECONFIGURE
flag on self
and return true
if the flag was set.
§Returns
true
is the GST_PAD_FLAG_NEED_RECONFIGURE flag was set on self
.
sourcefn create_stream_id(
&self,
parent: &impl IsA<Element>,
stream_id: Option<&str>,
) -> GString
fn create_stream_id( &self, parent: &impl IsA<Element>, stream_id: Option<&str>, ) -> GString
Creates a stream-id for the source Pad
self
by combining the
upstream information with the optional stream_id
of the stream
of self
. self
must have a parent Element
and which must have zero
or one sinkpad. stream_id
can only be None
if the parent element
of self
has only a single source pad.
This function generates an unique stream-id by getting the upstream
stream-start event stream ID and appending stream_id
to it. If the
element has no sinkpad it will generate an upstream stream-id by
doing an URI query on the element and in the worst case just uses
a random number. Source elements that don’t implement the URI
handler interface should ideally generate a unique, deterministic
stream-id manually instead.
Since stream IDs are sorted alphabetically, any numbers in the
stream ID should be printed with a fixed number of characters,
preceded by 0’s, such as by using the format `03u instead of \
u`.
§parent
Parent Element
of self
§stream_id
The stream-id
§Returns
A stream-id for self
. g_free()
after usage.
sourcefn forward<P: FnMut(&Pad) -> bool>(&self, forward: P) -> bool
fn forward<P: FnMut(&Pad) -> bool>(&self, forward: P) -> bool
sourcefn allowed_caps(&self) -> Option<Caps>
fn allowed_caps(&self) -> Option<Caps>
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 query_caps()
on self
and its peer. The caller owns a reference
on the resulting caps.
§Returns
the allowed Caps
of the
pad link. Unref the caps when you no longer need it. This
function returns None
when self
has no peer.
MT safe.
sourcefn current_caps(&self) -> Option<Caps>
fn current_caps(&self) -> Option<Caps>
Gets the capabilities currently configured on self
with the last
EventType::Caps
event.
§Returns
the current caps of the pad with
incremented ref-count or None
when pad has no caps. Unref after usage.
sourcefn direction(&self) -> PadDirection
fn direction(&self) -> 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.
§Returns
the PadDirection
of the pad.
MT safe.
sourcefn last_flow_result(&self) -> Result<FlowSuccess, FlowError>
fn last_flow_result(&self) -> Result<FlowSuccess, FlowError>
Gets the FlowReturn
return from the last data passed by this pad.
sourcefn offset(&self) -> i64
fn offset(&self) -> i64
Get the offset applied to the running time of self
. self
has to be a source
pad.
§Returns
the offset.
sourcefn pad_template(&self) -> Option<PadTemplate>
fn pad_template(&self) -> Option<PadTemplate>
Gets the template for self
.
§Returns
the PadTemplate
from which
this pad was instantiated, or None
if this pad has no
template. Unref after usage.
sourcefn pad_template_caps(&self) -> Caps
fn pad_template_caps(&self) -> Caps
sourcefn parent_element(&self) -> Option<Element>
fn parent_element(&self) -> Option<Element>
sourcefn single_internal_link(&self) -> Option<Pad>
fn single_internal_link(&self) -> Option<Pad>
sourcefn stream(&self) -> Option<Stream>
fn stream(&self) -> Option<Stream>
Returns the current Stream
for the self
, or None
if none has been
set yet, i.e. the pad has not received a stream-start event yet.
This is a convenience wrapper around PadExtManual::sticky_event()
and
gst_event_parse_stream()
.
§Returns
the current Stream
for self
, or None
.
unref the returned stream when no longer needed.
sourcefn stream_id(&self) -> Option<GString>
fn stream_id(&self) -> Option<GString>
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 PadExtManual::sticky_event()
and
gst_event_parse_stream_start()
.
The returned stream-id string should be treated as an opaque string, its contents should not be interpreted.
§Returns
a newly-allocated copy of the stream-id for
self
, or None
. g_free()
the returned string when no longer
needed.
sourcefn task_state(&self) -> TaskState
fn task_state(&self) -> TaskState
Get self
task state. If no task is currently
set, TaskState::Stopped
is returned.
§Returns
The current state of self
’s task.
sourcefn has_current_caps(&self) -> bool
fn has_current_caps(&self) -> bool
Check if self
has caps set on it with a EventType::Caps
event.
§Returns
true
when self
has caps associated with it.
sourcefn is_blocked(&self) -> bool
fn is_blocked(&self) -> 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()
).
§Returns
true
if the pad is blocked.
MT safe.
sourcefn is_blocking(&self) -> bool
fn is_blocking(&self) -> bool
sourcefn link(&self, sinkpad: &impl IsA<Pad>) -> Result<PadLinkSuccess, PadLinkError>
fn link(&self, sinkpad: &impl IsA<Pad>) -> Result<PadLinkSuccess, PadLinkError>
sourcefn link_full(
&self,
sinkpad: &impl IsA<Pad>,
flags: PadLinkCheck,
) -> Result<PadLinkSuccess, PadLinkError>
fn link_full( &self, sinkpad: &impl IsA<Pad>, flags: PadLinkCheck, ) -> Result<PadLinkSuccess, PadLinkError>
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 PadLinkCheck
for more information.
MT Safe.
§sinkpad
the sink Pad
to link.
§flags
the checks to validate when linking
§Returns
A result code indicating if the connection worked or what went wrong.
sourcefn link_maybe_ghosting(&self, sink: &impl IsA<Pad>) -> Result<(), BoolError>
fn link_maybe_ghosting(&self, sink: &impl IsA<Pad>) -> Result<(), BoolError>
Links self
to sink
, creating any GhostPad
’s in between as necessary.
This is a convenience function to save having to create and add intermediate
GhostPad
’s as required for linking across Bin
boundaries.
If self
or sink
pads don’t have parent elements or do not share a common
ancestor, the link will fail.
§sink
a Pad
§Returns
whether the link succeeded.
sourcefn link_maybe_ghosting_full(
&self,
sink: &impl IsA<Pad>,
flags: PadLinkCheck,
) -> Result<(), BoolError>
fn link_maybe_ghosting_full( &self, sink: &impl IsA<Pad>, flags: PadLinkCheck, ) -> Result<(), BoolError>
Links self
to sink
, creating any GhostPad
’s in between as necessary.
This is a convenience function to save having to create and add intermediate
GhostPad
’s as required for linking across Bin
boundaries.
If self
or sink
pads don’t have parent elements or do not share a common
ancestor, the link will fail.
Calling link_maybe_ghosting_full()
with
flags
== PadLinkCheck::DEFAULT
is the recommended way of linking
pads with safety checks applied.
§sink
a Pad
§flags
some PadLinkCheck
flags
§Returns
whether the link succeeded.
sourcefn mark_reconfigure(&self)
fn mark_reconfigure(&self)
Mark a pad for needing reconfiguration. The next call to
check_reconfigure()
will return true
after this call.
sourcefn needs_reconfigure(&self) -> bool
fn needs_reconfigure(&self) -> bool
Check the PadFlags::NEED_RECONFIGURE
flag on self
and return true
if the flag was set.
§Returns
true
is the GST_PAD_FLAG_NEED_RECONFIGURE flag is set on self
.
sourcefn pause_task(&self) -> Result<(), BoolError>
fn pause_task(&self) -> Result<(), BoolError>
sourcefn peer_query_accept_caps(&self, caps: &Caps) -> bool
fn peer_query_accept_caps(&self, caps: &Caps) -> bool
sourcefn peer_query_caps(&self, filter: Option<&Caps>) -> Caps
fn peer_query_caps(&self, filter: Option<&Caps>) -> Caps
Gets the capabilities of the peer connected to this pad. Similar to
query_caps()
.
When called on srcpads filter
contains the caps that
upstream could produce in the order preferred by upstream. When
called on sinkpads filter
contains the caps accepted by
downstream in the preferred order. filter
might be None
but
if it is not None
the returned caps will be a subset of filter
.
§filter
§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.
sourcefn push(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError>
fn push(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError>
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 chain()
on the peer pad and returns
the value from that function. If self
has no peer, FlowReturn::NotLinked
will
be returned.
In all cases, success or failure, the caller loses its reference to buffer
after calling this function.
§buffer
the Buffer
to push returns GST_FLOW_ERROR
if not.
§Returns
a FlowReturn
from the peer pad.
MT safe.
sourcefn push_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError>
fn push_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError>
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, FlowReturn::NotLinked
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 Buffer
and
chained via chain()
.
In all cases, success or failure, the caller loses its reference to list
after calling this function.
§list
the BufferList
to push returns GST_FLOW_ERROR
if not.
§Returns
a FlowReturn
from the peer pad.
MT safe.
sourcefn query_accept_caps(&self, caps: &Caps) -> bool
fn query_accept_caps(&self, caps: &Caps) -> bool
sourcefn query_caps(&self, filter: Option<&Caps>) -> Caps
fn query_caps(&self, filter: Option<&Caps>) -> Caps
Gets the capabilities this pad can produce or consume.
Note that this method doesn’t necessarily return the caps set by sending a
gst_event_new_caps()
- use current_caps()
for that instead.
gst_pad_query_caps returns all possible caps a pad can operate with, using
the pad’s CAPS query function, If the query fails, this function will return
filter
, if not None
, otherwise ANY.
When called on sinkpads filter
contains the caps that
upstream could produce in the order preferred by upstream. When
called on srcpads filter
contains the caps accepted by
downstream in the preferred order. filter
might be None
but
if it is not None
the returned caps will be a subset of filter
.
Note that this function does not return writable Caps
, use
gst_caps_make_writable()
before modifying the caps.
§filter
§Returns
the caps of the pad with incremented ref-count.
sourcefn set_active(&self, active: bool) -> Result<(), BoolError>
fn set_active(&self, active: bool) -> Result<(), BoolError>
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 activate_mode()
with the pad’s current mode
and a false
argument.
§active
whether or not the pad should be active.
§Returns
true
if the operation was successful.
MT safe.
sourcefn set_offset(&self, offset: i64)
fn set_offset(&self, offset: i64)
Set the offset that will be applied to the running time of self
. Upon next
buffer, every sticky events (notably segment) will be pushed again with
their running time adjusted. For that reason this is only reliable on
source pads.
§offset
the offset
sourcefn stop_task(&self) -> Result<(), BoolError>
fn stop_task(&self) -> Result<(), BoolError>
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 GstTaskFunction.
This function will deadlock if called from the GstTaskFunction of
the task. Use TaskExt::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.
§Returns
sourcefn store_sticky_event(&self, event: &Event) -> Result<FlowSuccess, FlowError>
fn store_sticky_event(&self, event: &Event) -> Result<FlowSuccess, FlowError>
Store the sticky event
on self
§event
a Event
§Returns
FlowReturn::Ok
on success, FlowReturn::Flushing
when the pad
was flushing or FlowReturn::Eos
when the pad was EOS.
sourcefn use_fixed_caps(&self)
fn use_fixed_caps(&self)
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.
sourcefn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId
sourcefn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId
Signals that a pad has been unlinked from the peer pad.
§peer
the peer pad that has been disconnected