Sink
Object Hierarchy:
Description:
[ GIR ( name = "AppSink" ) ]
public class Sink : Sink, URIHandler
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 null, 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.