Helper class for using a GstAppSink. More...
|GstAppSink *||appSink ()|
|CapsPtr||caps () const|
|bool||dropEnabled () const|
|ElementPtr||element () const|
|void||enableDrop (bool enable)|
|bool||isEos () const|
|void||lazyConstruct (ApplicationSink *self)|
|uint||maxBuffers () const|
|void||setCallbacks (ApplicationSink *self)|
|void||setCaps (const CapsPtr &caps)|
|void||setElement (const ElementPtr &appsink)|
|void||setMaxBuffers (uint maxbuffers)|
|virtual void||eos ()|
|virtual FlowReturn||newBuffer ()|
|virtual FlowReturn||newBufferList ()|
|virtual FlowReturn||newPreroll ()|
|virtual void||reservedVirtual1 ()|
|virtual void||reservedVirtual2 ()|
|virtual void||reservedVirtual3 ()|
|static void||eos (GstAppSink *sink, gpointer user_data)|
|static void||eos_noop (GstAppSink *, gpointer)|
|static GstFlowReturn||new_buffer (GstAppSink *sink, gpointer user_data)|
|static GstFlowReturn||new_buffer_list (GstAppSink *sink, gpointer user_data)|
|static GstFlowReturn||new_buffer_list_noop (GstAppSink *, gpointer)|
|static GstFlowReturn||new_buffer_noop (GstAppSink *, gpointer)|
|static GstFlowReturn||new_preroll (GstAppSink *sink, gpointer user_data)|
|static GstFlowReturn||new_preroll_noop (GstAppSink *, gpointer)|
Helper class for using a GstAppSink.
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. This class exports those API functions in the bindings and makes it easy to implement a custom sink.
The normal way of retrieving buffers from appsink is by using the pullBuffer() and pullPreroll() methods. These methods block until a buffer becomes available in the sink or when the sink is shut down or reaches EOS.
Appsink will internally use a queue to collect buffers from the streaming thread. If the application is not pulling buffers fast enough, this queue will consume a lot of memory over time. setMaxBuffers() can be used to limit the queue size. enableDrop() 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, you can subclass this class and implement the newPreroll(), newBuffer() and newBufferList() which will be called to notify you when a new buffer is available.
setCaps() can be used to control the formats that appsink can receive. This property can contain non-fixed caps. The format of the pulled buffers can be obtained by getting the buffer caps.
If one of the pullPreroll() or pullBuffer() methods return NULL, the appsink is stopped or in the EOS state. You can check for the EOS state with isEos(). The eos() virtual method can also be reimplemented to be informed when the EOS state is reached to avoid polling.