Struct gstreamer_app::AppSink [−]
pub struct AppSink(_, _);
Appsink is a sink plugin that supports many different methods for making the application get a handle on the GStreamer data in a pipeline. Unlike most GStreamer elements, Appsink provides external API functions.
appsink can be used by linking to the gstappsink.h header file to access the methods or by using the appsink action signals and properties.
The normal way of retrieving samples from appsink is by using the
AppSink::pull_sample
and AppSink::pull_preroll
methods.
These methods block until a sample becomes available in the sink or when the
sink is shut down or reaches EOS. There are also timed variants of these
methods, AppSink::try_pull_sample
and AppSink::try_pull_preroll
,
which accept a timeout parameter to limit the amount of time to wait.
Appsink will internally use a queue to collect buffers from the streaming thread. If the application is not pulling samples fast enough, this queue will consume a lot of memory over time. The "max-buffers" property can be used to limit the queue size. The "drop" property controls whether the streaming thread blocks or if older buffers are dropped when the maximum queue size is reached. Note that blocking the streaming thread can negatively affect real-time performance and should be avoided.
If a blocking behaviour is not desirable, setting the "emit-signals" property
to true
will make appsink emit the "new-sample" and "new-preroll" signals
when a sample can be pulled without blocking.
The "caps" property on appsink can be used to control the formats that appsink can receive. This property can contain non-fixed caps, the format of the pulled samples can be obtained by getting the sample caps.
If one of the pull-preroll or pull-sample methods return None
, the appsink
is stopped or in the EOS state. You can check for the EOS state with the
"eos" property or with the AppSink::is_eos
method.
The eos signal can also be used to be informed when the EOS state is reached to avoid polling.
Implements
gst_base::BaseSinkExt
, gst::ElementExt
, gst::ObjectExt
, glib::object::ObjectExt
, gst::URIHandlerExt
Methods
impl AppSink
[src]
impl AppSink
pub fn get_buffer_list_support(&self) -> bool
[src]
pub fn get_buffer_list_support(&self) -> bool
pub fn get_caps(&self) -> Option<Caps>
[src]
pub fn get_caps(&self) -> Option<Caps>
Get the configured caps on self
.
Returns
the gst::Caps
accepted by the sink. gst_caps_unref
after usage.
pub fn get_drop(&self) -> bool
[src]
pub fn get_drop(&self) -> bool
Check if self
will drop old buffers when the maximum amount of queued
buffers is reached.
Returns
true
if self
is dropping old buffers when the queue is
filled.
pub fn get_emit_signals(&self) -> bool
[src]
pub fn get_emit_signals(&self) -> bool
Check if appsink will emit the "new-preroll" and "new-sample" signals.
Returns
true
if self
is emiting the "new-preroll" and "new-sample"
signals.
pub fn get_max_buffers(&self) -> u32
[src]
pub fn get_max_buffers(&self) -> u32
Get the maximum amount of buffers that can be queued in self
.
Returns
The maximum amount of buffers that can be queued.
pub fn get_wait_on_eos(&self) -> bool
[src]
pub fn get_wait_on_eos(&self) -> bool
Check if self
will wait for all buffers to be consumed when an EOS is
received.
Returns
true
if self
will wait for all buffers to be consumed when an
EOS is received.
pub fn is_eos(&self) -> bool
[src]
pub fn is_eos(&self) -> bool
Check if self
is EOS, which is when no more samples can be pulled because
an EOS event was received.
This function also returns true
when the appsink is not in the PAUSED or
PLAYING state.
Returns
true
if no more samples can be pulled and the appsink is EOS.
pub fn pull_preroll(&self) -> Option<Sample>
[src]
pub fn pull_preroll(&self) -> Option<Sample>
Get the last preroll sample in self
. This was the sample that caused the
appsink to preroll in the PAUSED state.
This function is typically used when dealing with a pipeline in the PAUSED state. Calling this function after doing a seek will give the sample right after the seek position.
Calling this function will clear the internal reference to the preroll buffer.
Note that the preroll sample will also be returned as the first sample
when calling AppSink::pull_sample
.
If an EOS event was received before any buffers, this function returns
None
. Use gst_app_sink_is_eos () to check for the EOS condition.
This function blocks until a preroll sample or EOS is received or the appsink element is set to the READY/NULL state.
Returns
a gst::Sample
or NULL when the appsink is stopped or EOS.
Call gst_sample_unref
after usage.
pub fn pull_sample(&self) -> Option<Sample>
[src]
pub fn pull_sample(&self) -> Option<Sample>
This function blocks until a sample or EOS becomes available or the appsink element is set to the READY/NULL state.
This function will only return samples when the appsink is in the PLAYING state. All rendered buffers will be put in a queue so that the application can pull samples at its own rate. Note that when the application does not pull samples fast enough, the queued buffers could consume a lot of memory, especially when dealing with raw video frames.
If an EOS event was received before any buffers, this function returns
None
. Use gst_app_sink_is_eos () to check for the EOS condition.
Returns
a gst::Sample
or NULL when the appsink is stopped or EOS.
Call gst_sample_unref
after usage.
pub fn set_buffer_list_support(&self, enable_lists: bool)
[src]
pub fn set_buffer_list_support(&self, enable_lists: bool)
Instruct self
to enable or disable buffer list support.
For backwards-compatibility reasons applications need to opt in to indicate that they will be able to handle buffer lists.
Feature: v1_12
enable_lists
enable or disable buffer list support
pub fn set_caps<'a, P: Into<Option<&'a Caps>>>(&self, caps: P)
[src]
pub fn set_caps<'a, P: Into<Option<&'a Caps>>>(&self, caps: P)
Set the capabilities on the appsink element. This function takes
a copy of the caps structure. After calling this method, the sink will only
accept caps that match caps
. If caps
is non-fixed, or incomplete,
you must check the caps on the samples to get the actual used caps.
caps
caps to set
pub fn set_drop(&self, drop: bool)
[src]
pub fn set_drop(&self, drop: bool)
Instruct self
to drop old buffers when the maximum amount of queued
buffers is reached.
drop
the new state
pub fn set_emit_signals(&self, emit: bool)
[src]
pub fn set_emit_signals(&self, emit: bool)
Make appsink emit the "new-preroll" and "new-sample" signals. This option is by default disabled because signal emission is expensive and unneeded when the application prefers to operate in pull mode.
emit
the new state
pub fn set_max_buffers(&self, max: u32)
[src]
pub fn set_max_buffers(&self, max: u32)
Set the maximum amount of buffers that can be queued in self
. After this
amount of buffers are queued in appsink, any more buffers will block upstream
elements until a sample is pulled from self
.
max
the maximum number of buffers to queue
pub fn set_wait_on_eos(&self, wait: bool)
[src]
pub fn set_wait_on_eos(&self, wait: bool)
pub fn try_pull_preroll(&self, timeout: ClockTime) -> Option<Sample>
[src]
pub fn try_pull_preroll(&self, timeout: ClockTime) -> Option<Sample>
Get the last preroll sample in self
. This was the sample that caused the
appsink to preroll in the PAUSED state.
This function is typically used when dealing with a pipeline in the PAUSED state. Calling this function after doing a seek will give the sample right after the seek position.
Calling this function will clear the internal reference to the preroll buffer.
Note that the preroll sample will also be returned as the first sample
when calling AppSink::pull_sample
.
If an EOS event was received before any buffers or the timeout expires,
this function returns None
. Use gst_app_sink_is_eos () to check for the EOS
condition.
This function blocks until a preroll sample or EOS is received, the appsink element is set to the READY/NULL state, or the timeout expires.
Feature: v1_10
timeout
the maximum amount of time to wait for the preroll sample
Returns
a gst::Sample
or NULL when the appsink is stopped or EOS or the timeout expires.
Call gst_sample_unref
after usage.
pub fn try_pull_sample(&self, timeout: ClockTime) -> Option<Sample>
[src]
pub fn try_pull_sample(&self, timeout: ClockTime) -> Option<Sample>
This function blocks until a sample or EOS becomes available or the appsink element is set to the READY/NULL state or the timeout expires.
This function will only return samples when the appsink is in the PLAYING state. All rendered buffers will be put in a queue so that the application can pull samples at its own rate. Note that when the application does not pull samples fast enough, the queued buffers could consume a lot of memory, especially when dealing with raw video frames.
If an EOS event was received before any buffers or the timeout expires,
this function returns None
. Use gst_app_sink_is_eos () to check for the EOS
condition.
Feature: v1_10
timeout
the maximum amount of time to wait for a sample
Returns
a gst::Sample
or NULL when the appsink is stopped or EOS or the timeout expires.
Call gst_sample_unref
after usage.
pub fn get_property_buffer_list(&self) -> bool
[src]
pub fn get_property_buffer_list(&self) -> bool
pub fn set_property_buffer_list(&self, buffer_list: bool)
[src]
pub fn set_property_buffer_list(&self, buffer_list: bool)
pub fn get_property_eos(&self) -> bool
[src]
pub fn get_property_eos(&self) -> bool
pub fn connect_eos<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_eos<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_new_preroll<F: Fn(&AppSink) -> FlowReturn + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_new_preroll<F: Fn(&AppSink) -> FlowReturn + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_new_sample<F: Fn(&AppSink) -> FlowReturn + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_new_sample<F: Fn(&AppSink) -> FlowReturn + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_buffer_list_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_property_buffer_list_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_caps_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_property_caps_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_drop_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_property_drop_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_emit_signals_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_property_emit_signals_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_eos_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_property_eos_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_max_buffers_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_property_max_buffers_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_property_wait_on_eos_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
pub fn connect_property_wait_on_eos_notify<F: Fn(&AppSink) + Send + Sync + 'static>(
&self,
f: F
) -> SignalHandlerId
impl AppSink
[src]
impl AppSink
pub fn set_callbacks(&self, callbacks: AppSinkCallbacks)
[src]
pub fn set_callbacks(&self, callbacks: AppSinkCallbacks)
Set callbacks which will be executed for each new preroll, new sample and eos. This is an alternative to using the signals, it has lower overhead and is thus less expensive, but also less flexible.
If callbacks are installed, no signals will be emitted for performance reasons.
callbacks
the callbacks
user_data
a user_data argument for the callbacks
notify
a destroy notify function
Trait Implementations
impl Clone for AppSink
impl Clone for AppSink
fn clone(&self) -> AppSink
fn clone(&self) -> AppSink
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Hash for AppSink
impl Hash for AppSink
fn hash<__H: Hasher>(&self, state: &mut __H)
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for AppSink
impl Ord for AppSink
fn cmp(&self, other: &AppSink) -> Ordering
fn cmp(&self, other: &AppSink) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl StaticType for AppSink
impl StaticType for AppSink
fn static_type() -> Type
fn static_type() -> Type
Returns the type identifier of Self
.
impl<T: IsA<Object>> PartialEq<T> for AppSink
impl<T: IsA<Object>> PartialEq<T> for AppSink
fn eq(&self, other: &T) -> bool
fn eq(&self, other: &T) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for AppSink
impl Eq for AppSink
impl<T: IsA<Object>> PartialOrd<T> for AppSink
impl<T: IsA<Object>> PartialOrd<T> for AppSink
fn partial_cmp(&self, other: &T) -> Option<Ordering>
fn partial_cmp(&self, other: &T) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for AppSink
impl Debug for AppSink
impl IsA<BaseSink> for AppSink
impl IsA<BaseSink> for AppSink
impl IsA<Element> for AppSink
impl IsA<Element> for AppSink
impl IsA<Object> for AppSink
impl IsA<Object> for AppSink
impl IsA<URIHandler> for AppSink
impl IsA<URIHandler> for AppSink
impl IsA<Object> for AppSink
impl IsA<Object> for AppSink
impl Send for AppSink
[src]
impl Send for AppSink
impl Sync for AppSink
[src]
impl Sync for AppSink