gstapp.app_sink
Module for [AppSink] class
Types 3
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 [gstapp.app_sink.AppSink.pullSample] and [gstapp.app_sink.AppSink.pullPreroll] 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, [gstapp.app_sink.AppSink.tryPullSample] and [gstapp.app_sink.AppSink.tryPullPreroll], 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", "max-time" and "max-bytes" properties 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 [gstapp.app_sink.AppSink.isEos] method.
The eos signal can also be used to be informed when the EOS state is reached to avoid polling.
AppSinkGidBuilder builder()Get builder for [gstapp.app_sink.AppSink] Returns: New builder objectbool bufferList() @propertyvoid bufferList(bool propval) @propertygst.caps.Caps caps() @propertyvoid caps(gst.caps.Caps propval) @propertybool drop() @propertyvoid drop(bool propval) @propertybool emitSignals() @propertyvoid emitSignals(bool propval) @propertybool eos() @propertyuint maxBuffers() @propertyGet `maxBuffers` property. Returns: Maximum amount of buffers in the queue (0 = unlimited).void maxBuffers(uint propval) @propertySet `maxBuffers` property. Params: propval = Maximum amount of buffers in the queue (0 = unlimited).ulong maxBytes() @propertyGet `maxBytes` property. Returns: Maximum amount of bytes in the queue (0 = unlimited)void maxBytes(ulong propval) @propertySet `maxBytes` property. Params: propval = Maximum amount of bytes in the queue (0 = unlimited)ulong maxTime() @propertyGet `maxTime` property. Returns: Maximum total duration of data in the queue (0 = unlimited)void maxTime(ulong propval) @propertySet `maxTime` property. Params: propval = Maximum total duration of data in the queue (0 = unlimited)bool waitOnEos() @propertyGet `waitOnEos` property. Returns: Wait for all buffers to be processed after receiving an EOS.void waitOnEos(bool propval) @propertySet `waitOnEos` property. Params: propval = Wait for all buffers to be processed after receiving an EOS.bool getBufferListSupport()Check if appsink supports buffer lists. Returns: true if appsink supports buffer lists.gst.caps.Caps getCaps()Get the configured caps on appsink. Returns: the #GstCaps accepted by the sink. gstcapsunref() after usage.bool getDrop()Check if appsink will drop old buffers when the maximum amount of queued data is reached (meaning max buffers, time or bytes limit, whichever is hit first). Returns: true if appsink is dropping old...bool getEmitSignals()Check if appsink will emit the "new-preroll" and "new-sample" signals. Returns: true if appsink is emitting the "new-preroll" and "new-sample" signals.uint getMaxBuffers()Get the maximum amount of buffers that can be queued in appsink. Returns: The maximum amount of buffers that can be queued.ulong getMaxBytes()Get the maximum total size, in bytes, that can be queued in appsink. Returns: The maximum amount of bytes that can be queuedgst.types.ClockTime getMaxTime()Get the maximum total duration that can be queued in appsink. Returns: The maximum total duration that can be queued.bool getWaitOnEos()Check if appsink will wait for all buffers to be consumed when an EOS is received. Returns: true if appsink will wait for all buffers to be consumed when an EOS is received.bool isEos()Check if appsink is EOS, which is when no more samples can be pulled because an EOS event was received.gst.sample.Sample pullPreroll()Get the last preroll sample in appsink. This was the sample that caused the appsink to preroll in the PAUSED state.gst.sample.Sample pullSample()This function blocks until a sample or EOS becomes available or the appsink element is set to the READY/NULL state.void setBufferListSupport(bool enableLists)Instruct appsink to enable or disable buffer list support.void setCaps(gst.caps.Caps caps = null)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 i...void setDrop(bool drop)Instruct appsink to drop old buffers when the maximum amount of queued data is reached, that is, when any configured limit is hit (max-buffers, max-time or max-bytes).void setEmitSignals(bool emit)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.void setMaxBuffers(uint max)Set the maximum amount of buffers that can be queued in appsink. After this amount of buffers are queued in appsink, any more buffers will block upstream elements until a sample is pulled from apps...void setMaxBytes(ulong max)Set the maximum total size that can be queued in appsink. After this amount of buffers are queued in appsink, any more buffers will block upstream elements until a sample is pulled from appsink, un...void setMaxTime(gst.types.ClockTime max)Set the maximum total duration that can be queued in appsink. After this amount of buffers are queued in appsink, any more buffers will block upstream elements until a sample is pulled from appsink...void setWaitOnEos(bool wait)Instruct appsink to wait for all buffers to be consumed when an EOS is received.gst.sample.Sample tryPullPreroll(gst.types.ClockTime timeout)Get the last preroll sample in appsink. This was the sample that caused the appsink to preroll in the PAUSED state.gst.sample.Sample tryPullSample(gst.types.ClockTime timeout)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.gulong connectEos(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 2)Connect to `Eos` signal.gulong connectNewPreroll(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == gst.types.FlowReturn)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 2)Connect to `NewPreroll` signal.gulong connectNewSample(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == gst.types.FlowReturn)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 2)Connect to `NewSample` signal.gulong connectNewSerializedEvent(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 2)Connect to `NewSerializedEvent` signal.gulong connectProposeAllocation(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gst.query.Query)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 3)Connect to `ProposeAllocation` signal.gulong connectPullPreroll(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == gst.sample.Sample)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 2)Connect to `PullPreroll` signal.gulong connectPullSample(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == gst.sample.Sample)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 2)Connect to `PullSample` signal.gulong connectTryPullObject(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == gst.mini_object.MiniObject)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == ulong)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 3)Connect to `TryPullObject` signal.gulong connectTryPullPreroll(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == gst.sample.Sample)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == ulong)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 3)Connect to `TryPullPreroll` signal.gulong connectTryPullSample(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == gst.sample.Sample)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == ulong)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gstapp.app_sink.AppSink)))
&& Parameters!T.length < 3)Connect to `TryPullSample` signal.T bufferList(bool propval)T caps(gst.caps.Caps propval)T drop(bool propval)T emitSignals(bool propval)T maxBuffers(uint propval)Set `maxBuffers` property. Params: propval = Maximum amount of buffers in the queue (0 = unlimited). Returns: Builder instance for fluent chainingT maxBytes(ulong propval)Set `maxBytes` property. Params: propval = Maximum amount of bytes in the queue (0 = unlimited) Returns: Builder instance for fluent chainingT maxTime(ulong propval)Set `maxTime` property. Params: propval = Maximum total duration of data in the queue (0 = unlimited) Returns: Builder instance for fluent chainingT waitOnEos(bool propval)Set `waitOnEos` property. Params: propval = Wait for all buffers to be processed after receiving an EOS.