gstapp.app_src
Module for [AppSrc] class
Types 3
The appsrc element can be used by applications to insert data into a GStreamer pipeline. Unlike most GStreamer elements, appsrc provides external API functions.
appsrc can be used by linking with the libgstapp library to access the methods directly or by using the appsrc action signals.
Before operating appsrc, the caps property must be set to fixed caps describing the format of the data that will be pushed with appsrc. An exception to this is when pushing buffers with unknown caps, in which case no caps should be set. This is typically true of file-like sources that push raw byte buffers. If you don't want to explicitly set the caps, you can use gst_app_src_push_sample. This method gets the caps associated with the sample and sets them on the appsrc replacing any previously set caps (if different from sample's caps).
The main way of handing data to the appsrc element is by calling the [gstapp.app_src.AppSrc.pushBuffer] method or by emitting the push-buffer action signal. This will put the buffer onto a queue from which appsrc will read from in its streaming thread. It is important to note that data transport will not happen from the thread that performed the push-buffer call.
The "max-bytes", "max-buffers" and "max-time" properties control how much data can be queued in appsrc before appsrc considers the queue full. A filled internal queue will always signal the "enough-data" signal, which signals the application that it should stop pushing data into appsrc. The "block" property will cause appsrc to block the push-buffer method until free data becomes available again.
When the internal queue is running out of data, the "need-data" signal is emitted, which signals the application that it should start pushing more data into appsrc.
In addition to the "need-data" and "enough-data" signals, appsrc can emit the "seek-data" signal when the "stream-mode" property is set to "seekable" or "random-access". The signal argument will contain the new desired position in the stream expressed in the unit set with the "format" property. After receiving the seek-data signal, the application should push-buffers from the new position.
These signals allow the application to operate the appsrc in two different ways:
The push mode, in which the application repeatedly calls the push-buffer/push-sample method with a new buffer/sample. Optionally, the queue size in the appsrc can be controlled with the enough-data and need-data signals by respectively stopping/starting the push-buffer/push-sample calls. This is a typical mode of operation for the stream-type "stream" and "seekable". Use this mode when implementing various network protocols or hardware devices.
The pull mode, in which the need-data signal triggers the next push-buffer call. This mode is typically used in the "random-access" stream-type. Use this mode for file access or other randomly accessible sources. In this mode, a buffer of exactly the amount of bytes given by the need-data signal should be pushed into appsrc.
In all modes, the size property on appsrc should contain the total stream size in bytes. Setting this property is mandatory in the random-access mode. For the stream and seekable modes, setting this property is optional but recommended.
When the application has finished pushing data into appsrc, it should call [gstapp.app_src.AppSrc.endOfStream] or emit the end-of-stream action signal. After this call, no more buffers can be pushed into appsrc until a flushing seek occurs or the state of the appsrc has gone through READY.
AppSrcGidBuilder builder()Get builder for [gstapp.app_src.AppSrc] Returns: New builder objectbool block() @propertyGet `block` property. Returns: When max-bytes are queued and after the enough-data signal has been emitted, block any further push-buffer calls until the amount of queued bytes drops below the max-...void block(bool propval) @propertySet `block` property. Params: propval = When max-bytes are queued and after the enough-data signal has been emitted, block any further push-buffer calls until the amount of queued bytes drops below...gst.caps.Caps caps() @propertyGet `caps` property. Returns: The GstCaps that will negotiated downstream and will be put on outgoing buffers.void caps(gst.caps.Caps propval) @propertySet `caps` property. Params: propval = The GstCaps that will negotiated downstream and will be put on outgoing buffers.ulong currentLevelBuffers() @propertyGet `currentLevelBuffers` property. Returns: The number of currently queued buffers inside appsrc.ulong currentLevelBytes() @propertyGet `currentLevelBytes` property. Returns: The number of currently queued bytes inside appsrc.ulong currentLevelTime() @propertyGet `currentLevelTime` property. Returns: The amount of currently queued time inside appsrc.ulong duration() @propertyGet `duration` property. Returns: The total duration in nanoseconds of the data stream. If the total duration is known, it is recommended to configure it with this property.void duration(ulong propval) @propertySet `duration` property. Params: propval = The total duration in nanoseconds of the data stream. If the total duration is known, it is recommended to configure it with this property.bool emitSignals() @propertyGet `emitSignals` property. Returns: Make appsrc emit the "need-data", "enough-data" and "seek-data" signals. This option is by default enabled for backwards compatibility reasons but can disabled ...void emitSignals(bool propval) @propertySet `emitSignals` property. Params: propval = Make appsrc emit the "need-data", "enough-data" and "seek-data" signals. This option is by default enabled for backwards compatibility reasons but can ...gst.types.Format format() @propertyGet `format` property. Returns: The format to use for segment events. When the source is producing timestamped buffers this property should be set to GSTFORMATTIME.void format(gst.types.Format propval) @propertySet `format` property. Params: propval = The format to use for segment events. When the source is producing timestamped buffers this property should be set to GSTFORMATTIME.bool handleSegmentChange() @propertyGet `handleSegmentChange` property. Returns: When enabled, appsrc will check GstSegment in GstSample which was pushed via [gstapp.app_src.AppSrc.pushSample] or "push-sample" signal action. If a Gst...void handleSegmentChange(bool propval) @propertySet `handleSegmentChange` property. Params: propval = When enabled, appsrc will check GstSegment in GstSample which was pushed via [gstapp.app_src.AppSrc.pushSample] or "push-sample" signal action....bool isLive() @propertyGet `isLive` property. Returns: Instruct the source to behave like a live source. This includes that it will only push out buffers in the PLAYING state.void isLive(bool propval) @propertySet `isLive` property. Params: propval = Instruct the source to behave like a live source. This includes that it will only push out buffers in the PLAYING state.gstapp.types.AppLeakyType leakyType() @propertyGet `leakyType` property. Returns: When set to any other value than GSTAPPLEAKYTYPENONE then the appsrc will drop any buffers that are pushed into it once its internal queue is full. The selected t...void leakyType(gstapp.types.AppLeakyType propval) @propertySet `leakyType` property. Params: propval = When set to any other value than GSTAPPLEAKYTYPENONE then the appsrc will drop any buffers that are pushed into it once its internal queue is full. The s...ulong maxBuffers() @propertyGet `maxBuffers` property. Returns: The maximum amount of buffers that can be queued internally. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal.void maxBuffers(ulong propval) @propertySet `maxBuffers` property. Params: propval = The maximum amount of buffers that can be queued internally. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal.ulong maxBytes() @propertyGet `maxBytes` property. Returns: The maximum amount of bytes that can be queued internally. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal.void maxBytes(ulong propval) @propertySet `maxBytes` property. Params: propval = The maximum amount of bytes that can be queued internally. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal.long maxLatency() @propertyvoid maxLatency(long propval) @propertyulong maxTime() @propertyGet `maxTime` property. Returns: The maximum amount of time that can be queued internally. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal.void maxTime(ulong propval) @propertySet `maxTime` property. Params: propval = The maximum amount of time that can be queued internally. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal.long minLatency() @propertyGet `minLatency` property. Returns: The minimum latency of the source. A value of -1 will use the default latency calculations of #GstBaseSrc.void minLatency(long propval) @propertySet `minLatency` property. Params: propval = The minimum latency of the source. A value of -1 will use the default latency calculations of #GstBaseSrc.uint minPercent() @propertyGet `minPercent` property. Returns: Make appsrc emit the "need-data" signal when the amount of bytes in the queue drops below this percentage of max-bytes.void minPercent(uint propval) @propertySet `minPercent` property. Params: propval = Make appsrc emit the "need-data" signal when the amount of bytes in the queue drops below this percentage of max-bytes.long size() @propertyGet `size` property. Returns: The total size in bytes of the data stream. If the total size is known, it is recommended to configure it with this property.void size(long propval) @propertySet `size` property. Params: propval = The total size in bytes of the data stream. If the total size is known, it is recommended to configure it with this property.gstapp.types.AppStreamType streamType() @propertyGet `streamType` property. Returns: The type of stream that this source is producing. For seekable streams the application should connect to the seek-data signal.void streamType(gstapp.types.AppStreamType propval) @propertySet `streamType` property. Params: propval = The type of stream that this source is producing. For seekable streams the application should connect to the seek-data signal.gst.types.FlowReturn endOfStream()Indicates to the appsrc element that the last buffer queued in the element is the last buffer of the stream. Returns: #GSTFLOWOK when the EOS was successfully queued. #GSTFLOWFLUSHING when appsrc i...gst.caps.Caps getCaps()Get the configured caps on appsrc. Returns: the #GstCaps produced by the source. gstcapsunref() after usage.ulong getCurrentLevelBuffers()Get the number of currently queued buffers inside appsrc. Returns: The number of currently queued buffers.ulong getCurrentLevelBytes()Get the number of currently queued bytes inside appsrc. Returns: The number of currently queued bytes.gst.types.ClockTime getCurrentLevelTime()Get the amount of currently queued time inside appsrc. Returns: The amount of currently queued time.gst.types.ClockTime getDuration()Get the duration of the stream in nanoseconds. A value of GSTCLOCKTIMENONE means that the duration is not known. Returns: the duration of the stream previously set with [gstapp.appsrc.AppSrc.setDur...bool getEmitSignals()Check if appsrc will emit the "new-preroll" and "new-buffer" signals. Returns: true if appsrc is emitting the "new-preroll" and "new-buffer" signals.void getLatency(out ulong min, out ulong max)Retrieve the min and max latencies in min and max respectively.gstapp.types.AppLeakyType getLeakyType()Returns the currently set #GstAppLeakyType. See [gstapp.app_src.AppSrc.setLeakyType] for more details. Returns: The currently set #GstAppLeakyType.ulong getMaxBuffers()Get the maximum amount of buffers that can be queued in appsrc. Returns: The maximum amount of buffers that can be queued.ulong getMaxBytes()Get the maximum amount of bytes that can be queued in appsrc. Returns: The maximum amount of bytes that can be queued.gst.types.ClockTime getMaxTime()Get the maximum amount of time that can be queued in appsrc. Returns: The maximum amount of time that can be queued.long getSize()Get the size of the stream in bytes. A value of -1 means that the size is not known. Returns: the size of the stream previously set with [gstapp.app_src.AppSrc.setSize];gstapp.types.AppStreamType getStreamType()Get the stream type. Control the stream type of appsrc with [gstapp.app_src.AppSrc.setStreamType]. Returns: the stream type.gst.types.FlowReturn pushBuffer(gst.buffer.Buffer buffer)Adds a buffer to the queue of buffers that the appsrc element will push to its source pad. This function takes ownership of the buffer.gst.types.FlowReturn pushBufferList(gst.buffer_list.BufferList bufferList)Adds a buffer list to the queue of buffers and buffer lists that the appsrc element will push to its source pad. This function takes ownership of buffer_list.gst.types.FlowReturn pushSample(gst.sample.Sample sample)Extract a buffer from the provided sample and adds it to the queue of buffers that the appsrc element will push to its source pad. Any previous caps that were set on appsrc will be replaced by the ...void setCaps(gst.caps.Caps caps = null)Set the capabilities on the appsrc element. This function takes a copy of the caps structure. After calling this method, the source will only produce caps that match caps. caps must be fixed and t...void setDuration(gst.types.ClockTime duration)Set the duration of the stream in nanoseconds. A value of GSTCLOCKTIME_NONE means that the duration is not known.void setEmitSignals(bool emit)Make appsrc emit the "new-preroll" and "new-buffer" signals. This option is by default disabled because signal emission is expensive and unneeded when the application prefers to operate in pull mode.void setLatency(ulong min, ulong max)Configure the min and max latency in src. If min is set to -1, the default latency calculations for pseudo-live sources will be used.void setLeakyType(gstapp.types.AppLeakyType leaky)When set to any other value than GSTAPPLEAKYTYPENONE then the appsrc will drop any buffers that are pushed into it once its internal queue is full. The selected type defines whether to drop the old...void setMaxBuffers(ulong max)Set the maximum amount of buffers that can be queued in appsrc. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal.void setMaxBytes(ulong max)Set the maximum amount of bytes that can be queued in appsrc. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal.void setMaxTime(gst.types.ClockTime max)Set the maximum amount of time that can be queued in appsrc. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal.void setSize(long size)Set the size of the stream in bytes. A value of -1 means that the size is not known.void setStreamType(gstapp.types.AppStreamType type)Set the stream type on appsrc. For seekable streams, the "seek" signal must be connected to.gulong connectEndOfStream(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_src.AppSrc)))
&& Parameters!T.length < 2)Connect to `EndOfStream` signal.gulong connectEnoughData(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_src.AppSrc)))
&& Parameters!T.length < 2)Connect to `EnoughData` signal.gulong connectNeedData(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] == uint)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gstapp.app_src.AppSrc)))
&& Parameters!T.length < 3)Connect to `NeedData` signal.gulong connectPushBuffer(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] == gst.buffer.Buffer)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gstapp.app_src.AppSrc)))
&& Parameters!T.length < 3)Connect to `PushBuffer` signal.gulong connectPushBufferList(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] == gst.buffer_list.BufferList)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gstapp.app_src.AppSrc)))
&& Parameters!T.length < 3)Connect to `PushBufferList` signal.gulong connectPushSample(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] == gst.sample.Sample)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gstapp.app_src.AppSrc)))
&& Parameters!T.length < 3)Connect to `PushSample` signal.gulong connectSeekData(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] == ulong)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gstapp.app_src.AppSrc)))
&& Parameters!T.length < 3)Connect to `SeekData` signal.T block(bool propval)Set `block` property. Params: propval = When max-bytes are queued and after the enough-data signal has been emitted, block any further push-buffer calls until the amount of queued bytes drops below...T caps(gst.caps.Caps propval)Set `caps` property. Params: propval = The GstCaps that will negotiated downstream and will be put on outgoing buffers. Returns: Builder instance for fluent chainingT duration(ulong propval)Set `duration` property. Params: propval = The total duration in nanoseconds of the data stream. If the total duration is known, it is recommended to configure it with this property. Returns: Build...T emitSignals(bool propval)Set `emitSignals` property. Params: propval = Make appsrc emit the "need-data", "enough-data" and "seek-data" signals. This option is by default enabled for backwards compatibility reasons but can ...T format(gst.types.Format propval)Set `format` property. Params: propval = The format to use for segment events. When the source is producing timestamped buffers this property should be set to GSTFORMATTIME. Returns: Builder instan...T handleSegmentChange(bool propval)Set `handleSegmentChange` property. Params: propval = When enabled, appsrc will check GstSegment in GstSample which was pushed via [gstapp.app_src.AppSrc.pushSample] or "push-sample" signal action....T isLive(bool propval)Set `isLive` property. Params: propval = Instruct the source to behave like a live source. This includes that it will only push out buffers in the PLAYING state. Returns: Builder instance for fluen...T leakyType(gstapp.types.AppLeakyType propval)Set `leakyType` property. Params: propval = When set to any other value than GSTAPPLEAKYTYPENONE then the appsrc will drop any buffers that are pushed into it once its internal queue is full. The s...T maxBuffers(ulong propval)Set `maxBuffers` property. Params: propval = The maximum amount of buffers that can be queued internally. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal. ...T maxBytes(ulong propval)Set `maxBytes` property. Params: propval = The maximum amount of bytes that can be queued internally. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal. Return...T maxLatency(long propval)T maxTime(ulong propval)Set `maxTime` property. Params: propval = The maximum amount of time that can be queued internally. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal. Returns: ...T minLatency(long propval)Set `minLatency` property. Params: propval = The minimum latency of the source. A value of -1 will use the default latency calculations of #GstBaseSrc. Returns: Builder instance for fluent chainingT minPercent(uint propval)Set `minPercent` property. Params: propval = Make appsrc emit the "need-data" signal when the amount of bytes in the queue drops below this percentage of max-bytes. Returns: Builder instance for fl...T size(long propval)Set `size` property. Params: propval = The total size in bytes of the data stream. If the total size is known, it is recommended to configure it with this property. Returns: Builder instance for fl...T streamType(gstapp.types.AppStreamType propval)Set `streamType` property. Params: propval = The type of stream that this source is producing. For seekable streams the application should connect to the seek-data signal. Returns: Builder instanc...