Trait gstreamer::prelude::PadExtManual
source · pub trait PadExtManual:
Sealed
+ IsA<Pad>
+ 'static {
Show 44 methods
// Provided methods
fn add_probe<F>(&self, mask: PadProbeType, func: F) -> Option<PadProbeId>
where F: Fn(&Self, &mut PadProbeInfo<'_>) -> PadProbeReturn + Send + Sync + 'static { ... }
fn remove_probe(&self, id: PadProbeId) { ... }
fn pull_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError> { ... }
fn pull_range_fill(
&self,
offset: u64,
buffer: &mut BufferRef,
size: u32,
) -> Result<(), FlowError> { ... }
fn range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError> { ... }
fn range_fill(
&self,
offset: u64,
buffer: &mut BufferRef,
size: u32,
) -> Result<(), FlowError> { ... }
fn peer_query(&self, query: &mut QueryRef) -> bool { ... }
fn query(&self, query: &mut QueryRef) -> bool { ... }
fn proxy_query_caps(&self, query: &mut QueryRef) -> bool { ... }
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool { ... }
fn push_event(&self, event: impl Into<Event>) -> bool { ... }
fn send_event(&self, event: impl Into<Event>) -> bool { ... }
fn iterate_internal_links(&self) -> Iterator<Pad> { ... }
fn stream_lock(&self) -> StreamLock<'_> { ... }
unsafe fn set_activate_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>) -> Result<(), LoggableError> + Send + Sync + 'static { ... }
unsafe fn set_activatemode_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>, PadMode, bool) -> Result<(), LoggableError> + Send + Sync + 'static { ... }
unsafe fn set_chain_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>, Buffer) -> Result<FlowSuccess, FlowError> + Send + Sync + 'static { ... }
unsafe fn set_chain_list_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>, BufferList) -> Result<FlowSuccess, FlowError> + Send + Sync + 'static { ... }
unsafe fn set_event_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>, Event) -> bool + Send + Sync + 'static { ... }
unsafe fn set_event_full_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>, Event) -> Result<FlowSuccess, FlowError> + Send + Sync + 'static { ... }
unsafe fn set_getrange_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>, u64, Option<&mut BufferRef>, u32) -> Result<PadGetRangeSuccess, FlowError> + Send + Sync + 'static { ... }
unsafe fn set_iterate_internal_links_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>) -> Iterator<Pad> + Send + Sync + 'static { ... }
unsafe fn set_link_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>, &Pad) -> Result<PadLinkSuccess, PadLinkError> + Send + Sync + 'static { ... }
unsafe fn set_query_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>, &mut QueryRef) -> bool + Send + Sync + 'static { ... }
unsafe fn set_unlink_function<F>(&self, func: F)
where F: Fn(&Self, Option<&Object>) + Send + Sync + 'static { ... }
fn start_task<F: FnMut() + Send + 'static>(
&self,
func: F,
) -> Result<(), BoolError> { ... }
fn peer_query_convert<U: SpecificFormattedValueFullRange>(
&self,
src_val: impl FormattedValue,
) -> Option<U> { ... }
fn peer_query_convert_generic(
&self,
src_val: impl FormattedValue,
dest_format: Format,
) -> Option<GenericFormattedValue> { ... }
fn peer_query_duration<T: SpecificFormattedValueIntrinsic>(
&self,
) -> Option<T> { ... }
fn peer_query_duration_generic(
&self,
format: Format,
) -> Option<GenericFormattedValue> { ... }
fn peer_query_position<T: SpecificFormattedValueIntrinsic>(
&self,
) -> Option<T> { ... }
fn peer_query_position_generic(
&self,
format: Format,
) -> Option<GenericFormattedValue> { ... }
fn query_convert<U: SpecificFormattedValueFullRange>(
&self,
src_val: impl FormattedValue,
) -> Option<U> { ... }
fn query_convert_generic(
&self,
src_val: impl FormattedValue,
dest_format: Format,
) -> Option<GenericFormattedValue> { ... }
fn query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> { ... }
fn query_duration_generic(
&self,
format: Format,
) -> Option<GenericFormattedValue> { ... }
fn query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> { ... }
fn query_position_generic(
&self,
format: Format,
) -> Option<GenericFormattedValue> { ... }
fn mode(&self) -> PadMode { ... }
fn sticky_events_foreach<F: FnMut(&Event) -> ControlFlow<EventForeachAction, EventForeachAction>>(
&self,
func: F,
) { ... }
fn sticky_event<T: StickyEventType>(&self, idx: u32) -> Option<T::Owned> { ... }
fn set_pad_flags(&self, flags: PadFlags) { ... }
fn unset_pad_flags(&self, flags: PadFlags) { ... }
fn pad_flags(&self) -> PadFlags { ... }
}
Provided Methods§
sourcefn add_probe<F>(&self, mask: PadProbeType, func: F) -> Option<PadProbeId>
fn add_probe<F>(&self, mask: PadProbeType, func: F) -> Option<PadProbeId>
Be notified of different states of pads. The provided callback is called for
every state that matches mask
.
Probes are called in groups: First GST_PAD_PROBE_TYPE_BLOCK probes are
called, then others, then finally GST_PAD_PROBE_TYPE_IDLE. The only
exception here are GST_PAD_PROBE_TYPE_IDLE probes that are called
immediately if the pad is already idle while calling add_probe()
.
In each of the groups, probes are called in the order in which they were
added.
§mask
the probe mask
§callback
GstPadProbeCallback
that will be called with notifications of
the pad state
§destroy_data
GDestroyNotify
for user_data
§Returns
an id or 0 if no probe is pending. The id can be used to remove the
probe with remove_probe()
. When using GST_PAD_PROBE_TYPE_IDLE it can
happen that the probe can be run immediately and if the probe returns
GST_PAD_PROBE_REMOVE this functions returns 0.
MT safe.
sourcefn remove_probe(&self, id: PadProbeId)
fn remove_probe(&self, id: PadProbeId)
sourcefn pull_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError>
fn pull_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError>
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 FlowReturn::NotLinked
is returned else this
function returns the result of range()
on the peer pad.
See 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 new Buffer
will be
placed in buffer
when this function returns 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 to None
.
When buffer
points to a variable that points to a valid Buffer
, the
buffer will be filled with the result data when this function returns
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.
§offset
The start offset of the buffer
§size
The length of the buffer
§Returns
a FlowReturn
from the peer pad.
MT safe.
§buffer
a pointer to hold the Buffer
, returns
GST_FLOW_ERROR if None
.
fn pull_range_fill( &self, offset: u64, buffer: &mut BufferRef, size: u32, ) -> Result<(), FlowError>
sourcefn range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError>
fn range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError>
When self
is flushing this function returns FlowReturn::Flushing
immediately and buffer
is None
.
Calls the getrange function of self
, see GstPadGetRangeFunction
for a
description of a getrange function. If self
has no getrange function
installed (see gst_pad_set_getrange_function()
) this function returns
FlowReturn::NotSupported
.
If buffer
points to a variable holding None
, a valid new Buffer
will be
placed in buffer
when this function returns 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 Buffer
, the
buffer will be filled with the result data when this function returns
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 FlowReturn::Ok
, buffer
will be unchanged.
This is a lowlevel function. Usually pull_range()
is used.
§offset
The start offset of the buffer
§size
The length of the buffer
§Returns
a FlowReturn
from the pad.
MT safe.
§buffer
a pointer to hold the Buffer
,
returns FlowReturn::Error
if None
.
fn range_fill( &self, offset: u64, buffer: &mut BufferRef, size: u32, ) -> Result<(), FlowError>
sourcefn peer_query(&self, query: &mut QueryRef) -> bool
fn peer_query(&self, query: &mut QueryRef) -> bool
sourcefn query(&self, query: &mut QueryRef) -> bool
fn query(&self, query: &mut QueryRef) -> 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.
§query
the Query
to perform.
§Returns
true
if the query could be performed.
sourcefn proxy_query_caps(&self, query: &mut QueryRef) -> bool
fn proxy_query_caps(&self, query: &mut QueryRef) -> bool
Calls PadExt::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.
§query
a CAPS Query
.
§Returns
true
if query
could be executed
sourcefn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool
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.
§query
an ACCEPT_CAPS Query
.
§Returns
true
if query
could be executed
sourcefn push_event(&self, event: impl Into<Event>) -> bool
fn push_event(&self, event: impl Into<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.
§event
the Event
to send to the pad.
§Returns
true
if the event was handled.
MT safe.
sourcefn send_event(&self, event: impl Into<Event>) -> bool
fn send_event(&self, event: impl Into<Event>) -> bool
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 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, like EventType::FlushStart
. If
the event needs to be serialized with data flow, this function will take the
pad’s stream lock while calling its event function.
To find out whether an event type is upstream, downstream, or downstream and
serialized, see EventTypeFlags
, EventType::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.
§event
the Event
to send to the pad.
§Returns
true
if the event was handled.
fn iterate_internal_links(&self) -> Iterator<Pad>
fn stream_lock(&self) -> StreamLock<'_>
unsafe fn set_activate_function<F>(&self, func: F)
unsafe fn set_activatemode_function<F>(&self, func: F)
unsafe fn set_chain_function<F>(&self, func: F)
unsafe fn set_chain_list_function<F>(&self, func: F)where
F: Fn(&Self, Option<&Object>, BufferList) -> Result<FlowSuccess, FlowError> + Send + Sync + 'static,
unsafe fn set_event_function<F>(&self, func: F)
unsafe fn set_event_full_function<F>(&self, func: F)
unsafe fn set_getrange_function<F>(&self, func: F)
unsafe fn set_iterate_internal_links_function<F>(&self, func: F)
unsafe fn set_link_function<F>(&self, func: F)where
F: Fn(&Self, Option<&Object>, &Pad) -> Result<PadLinkSuccess, PadLinkError> + Send + Sync + 'static,
unsafe fn set_query_function<F>(&self, func: F)
unsafe fn set_unlink_function<F>(&self, func: F)
sourcefn start_task<F: FnMut() + Send + 'static>(
&self,
func: F,
) -> Result<(), BoolError>
fn start_task<F: FnMut() + Send + 'static>( &self, func: F, ) -> Result<(), BoolError>
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.
§func
the task function to call
§notify
called when user_data
is no longer referenced
§Returns
a true
if the task could be started.