#[repr(transparent)]
pub struct AppSink { /* private fields */ }
Expand description

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 pull_sample() and 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, try_pull_sample() and 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 is_eos() method.

The eos signal can also be used to be informed when the EOS state is reached to avoid polling.

Implements

gst::prelude::ElementExt, gst::prelude::ObjectExt, trait@glib::ObjectExt, gst::prelude::URIHandlerExt

Implementations

This is supported on crate feature v1_12 only.

Check if self supports buffer lists.

Returns

true if self supports buffer lists.

Get the configured caps on self.

Returns

the gst::Caps accepted by the sink. gst_caps_unref() after usage.

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.

Get the maximum amount of buffers that can be queued in self.

Returns

The maximum amount of buffers that can be queued.

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.

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.

This is supported on crate feature v1_20 only.

This function blocks until a sample or an event 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 and events will be put in a queue so that the application can pull them 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. Events can be pulled when the appsink is in the READY, PAUSED or PLAYING state.

This function will only pull serialized events, excluding the EOS event for which this functions returns None. Use is_eos() to check for the EOS condition.

This method is a variant of pull_sample() that can be used to handle incoming events events as well as samples.

Note that future releases may extend this API to return other object types so make sure that your code is checking for the actual type it is handling.

Returns

a gst::Sample, or a GstEvent or NULL when the appsink is stopped or EOS. Call gst_mini_object_unref() after usage.

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 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.

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.

This is supported on crate feature v1_12 only.

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.

enable_lists

enable or disable buffer list support

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

Instruct self to drop old buffers when the maximum amount of queued buffers is reached.

drop

the new state

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

Instruct self to wait for all buffers to be consumed when an EOS is received.

wait

the new state

This is supported on crate feature v1_20 only.

This function blocks until a sample or an event 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 and events will be put in a queue so that the application can pull them 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. Events can be pulled when the appsink is in the READY, PAUSED or PLAYING state.

This function will only pull serialized events, excluding the EOS event for which this functions returns None. Use is_eos() to check for the EOS condition.

This method is a variant of try_pull_sample() that can be used to handle incoming events events as well as samples.

Note that future releases may extend this API to return other object types so make sure that your code is checking for the actual type it is handling.

timeout

the maximum amount of time to wait for a sample

Returns

a gst::Sample, or GstEvent or NULL when the appsink is stopped or EOS or the timeout expires. Call gst_mini_object_unref() after usage.

This is supported on crate feature v1_10 only.

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 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.

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.

This is supported on crate feature v1_10 only.

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.

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.

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.

Before 1.16.3 it was not possible to change the callbacks in a thread-safe way.

callbacks

the callbacks

notify

a destroy notify function

This is supported on crate feature v1_12 only.
This is supported on crate feature v1_16 only.
This is supported on crate feature v1_18 only.
This is supported on crate feature v1_12 only.
This is supported on crate feature v1_16 only.
This is supported on crate feature v1_16 only.
This is supported on crate feature v1_18 only.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Abort the state change of the element. This function is used by elements that do asynchronous state changes and find out something is wrong. Read more

Adds a pad (link point) to self. pad’s parent will be set to self; see GstObjectExt::set_parent() for refcounting information. Read more

Perform transition on self. Read more

Commit the state change of the element and proceed to the next pending state if any. This function is used by elements that do asynchronous state changes. The core will normally call this method automatically when an element returned StateChangeReturn::Success from the state change function. Read more

This is supported on crate feature v1_14 only.
This is supported on crate feature v1_14 only.
This is supported on crate feature v1_14 only.

Performs a query on the given element. Read more

Sends an event to an element. If the element doesn’t implement an event handler, the event will be pushed on a random linked sink pad for downstream events or a random linked source pad for upstream events. Read more

This is supported on crate feature v1_10 only.
This is supported on crate feature v1_10 only.
This is supported on crate feature v1_10 only.
This is supported on crate feature v1_10 only.
This is supported on crate feature v1_10 only.
This is supported on crate feature v1_10 only.

Performs the conversion.

Attach the ControlBinding to the object. If there already was a ControlBinding for this property it will be replaced. Read more

A default error function that uses g_printerr() to display the error message and the optional debug string.. Read more

Gets the corresponding ControlBinding for the property. This should be unreferenced again after use. Read more

Obtain the control-rate for this self. Audio processing Element objects will use this rate to sub-divide their processing loop and call sync_values() in between. The length of the processing segment should be up to control-rate nanoseconds. Read more

Returns a copy of the name of self. Caller should g_free() the return value after usage. For a nameless object, this returns None, which you can safely g_free() as well. Read more

Returns the parent of self. This function increases the refcount of the parent object so you should gst_object_unref() it after usage. Read more

Generates a string describing the path of self in the object hierarchy. Only useful (or used) for debugging. Read more

Gets the value for the given controlled property at the requested time. Read more

Performs the conversion.

Returns true if the object is an instance of (can be cast to) T.

Returns the type of the object.

Returns the ObjectClass of the object. Read more

Returns the class of the object.

Returns the class of the object in the given type T. Read more

Returns the interface T of the object. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_properties but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::set_properties_from_value but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::property but fails instead of panicking.

Gets the property property_name of the object and cast it to the type V. Read more

Similar to Self::property_value but fails instead of panicking.

Gets the property property_name of the object. Read more

Check if the object has a property property_name of the given type_. Read more

Get the type of the property property_name of this object. Read more

Get the ParamSpec of the property property_name of this object.

Return all ParamSpec of the properties of this object.

Freeze all property notifications until the return guard object is dropped. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Block a given signal handler. Read more

Unblock a given signal handler.

Stop emission of the currently emitted signal.

Stop emission of the currently emitted signal by the (possibly detailed) signal name.

Similar to Self::connect but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_local but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_local_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_unsafe but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_unsafe_id but fails instead of panicking.

Similar to Self::connect_closure but fails instead of panicking.

Connect a closure to the signal signal_name on this object. Read more

Similar to Self::connect_closure_id but fails instead of panicking.

Connect a closure to the signal signal_id on this object. Read more

Limits the lifetime of closure to the lifetime of the object. When the object’s reference count drops to zero, the closure will be invalidated. An invalidated closure will ignore any calls to Closure::invoke. Read more

Connect to the signal signal_id on this object. Read more

Similar to Self::emit but fails instead of panicking.

Emit signal by signal id. Read more

Similar to Self::emit_with_values but fails instead of panicking.

Same as Self::emit but takes Value for the arguments.

Similar to Self::emit_by_name but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_by_name_with_values but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_by_name_with_details but fails instead of panicking.

Emit signal by its name with details. Read more

Similar to Self::emit_by_name_with_details_and_values but fails instead of panicking.

Emit signal by its name with details. Read more

Similar to Self::emit_with_details but fails instead of panicking.

Emit signal by signal id with details. Read more

Similar to Self::emit_with_details_and_values but fails instead of panicking.

Emit signal by signal id with details. Read more

Disconnect a previously connected signal handler.

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Notify that the given property has changed its value. Read more

Notify that the given property has changed its value. Read more

Downgrade this object to a weak reference.

Bind property source_property on this object to the target_property on the target object. Read more

Returns the strong reference count of this object.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Gets the list of protocols supported by self. This list may not be modified. Read more

Gets the currently handled URI. Read more

Gets the type of the given URI handler Read more

Tries to set the URI of the given handler. Read more