appsrc
The appsrc element can be used by applications to insert data into a GStreamer pipeline. Unlike most GStreamer elements, Appsrc provides external API functions.
For the documentation of the API, please see the
libgstapp section in the GStreamer Plugins Base Libraries documentation.Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBaseSrc ╰──appsrc
Implemented interfaces
Factory details
Authors: – David Schleef
Classification: – Generic/Source
Rank – none
Plugin – app
Package – GStreamer Base Plug-ins
Pad Templates
Signals
enough-data
enough_data_callback (GstElement * appsrc, gpointer udata)
def enough_data_callback (appsrc, udata):
#python callback for the 'enough-data' signal
function enough_data_callback(appsrc: GstElement * appsrc, udata: gpointer udata): {
// javascript callback for the 'enough-data' signal
}
Signal that the source has enough data. It is recommended that the application stops calling push-buffer until the need-data signal is emitted again to avoid excessive buffer queueing.
Parameters:
appsrc
–
the appsrc element that emitted the signal
udata
–
Flags: Run Last
need-data
need_data_callback (GstElement * appsrc, guint length, gpointer udata)
def need_data_callback (appsrc, length, udata):
#python callback for the 'need-data' signal
function need_data_callback(appsrc: GstElement * appsrc, length: guint length, udata: gpointer udata): {
// javascript callback for the 'need-data' signal
}
Signal that the source needs more data. In the callback or from another thread you should call push-buffer or end-of-stream.
length is just a hint and when it is set to -1, any number of bytes can be pushed into appsrc.
You can call push-buffer multiple times until the enough-data signal is fired.
Parameters:
appsrc
–
the appsrc element that emitted the signal
length
–
the amount of bytes needed.
udata
–
Flags: Run Last
seek-data
gboolean seek_data_callback (GstElement * appsrc, guint64 offset, gpointer udata)
def seek_data_callback (appsrc, offset, udata):
#python callback for the 'seek-data' signal
function seek_data_callback(appsrc: GstElement * appsrc, offset: guint64 offset, udata: gpointer udata): {
// javascript callback for the 'seek-data' signal
}
Seek to the given offset. The next push-buffer should produce buffers from the new offset. This callback is only called for seekable stream types.
Parameters:
appsrc
–
the appsrc element that emitted the signal
offset
–
the offset to seek to
udata
–
Flags: Run Last
Action Signals
end-of-stream
g_signal_emit_by_name (appsrc, "end-of-stream", &ret);
ret = appsrc.emit ("end-of-stream")
let ret = appsrc.emit ("end-of-stream");
Notify appsrc that no more buffer are available.
Parameters:
the appsrc
push-buffer
g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret);
ret = appsrc.emit ("push-buffer", buffer)
let ret = appsrc.emit ("push-buffer", buffer);
Adds a buffer to the queue of buffers that the appsrc element will push to its source pad.
This function does not take ownership of the buffer, but it takes a reference so the buffer can be unreffed at any time after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
push-buffer-list
g_signal_emit_by_name (appsrc, "push-buffer-list", buffer_list, &ret);
ret = appsrc.emit ("push-buffer-list", buffer_list)
let ret = appsrc.emit ("push-buffer-list", buffer_list);
Adds a buffer list to the queue of buffers and buffer lists that the appsrc element will push to its source pad.
This function does not take ownership of the buffer list, but it takes a reference so the buffer list can be unreffed at any time after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
Parameters:
the appsrc
a buffer list to push
Since : 1.14
push-sample
g_signal_emit_by_name (appsrc, "push-sample", sample, &ret);
ret = appsrc.emit ("push-sample", sample)
let ret = appsrc.emit ("push-sample", sample);
Extract a buffer from the provided sample and adds the extracted buffer to the queue of buffers that the appsrc element will push to its source pad. This function set the appsrc caps based on the caps in the sample and reset the caps if they change. Only the caps and the buffer of the provided sample are used and not for example the segment in the sample.
This function does not take ownership of the sample, but it takes a reference so the sample can be unreffed at any time after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
Parameters:
the appsrc
a sample from which extract buffer to push
Since : 1.6
Properties
block
“block” gboolean
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-bytes limit.
Flags : Read / Write
Default value : false
caps
“caps” GstCaps *
The GstCaps that will negotiated downstream and will be put on outgoing buffers.
Flags : Read / Write
current-level-buffers
“current-level-buffers” guint64
The number of currently queued buffers inside appsrc.
Flags : Read
Default value : 0
Since : 1.20
current-level-bytes
“current-level-bytes” guint64
The number of currently queued bytes inside appsrc.
Flags : Read
Default value : 0
Since : 1.2
current-level-time
“current-level-time” guint64
The amount of currently queued time inside appsrc.
Flags : Read
Default value : 0
Since : 1.20
duration
“duration” guint64
The total duration in nanoseconds of the data stream. If the total duration is known, it is recommended to configure it with this property.
Flags : Read / Write
Default value : 18446744073709551615
Since : 1.10
emit-signals
“emit-signals” gboolean
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 when needed because signal emission is expensive.
Flags : Read / Write
Default value : true
format
“format” GstFormat *
The format to use for segment events. When the source is producing timestamped buffers this property should be set to GST_FORMAT_TIME.
Flags : Read / Write
Default value : bytes (2)
handle-segment-change
“handle-segment-change” gboolean
When enabled, appsrc will check GstSegment in GstSample which was pushed via gst_app_src_push_sample or "push-sample" signal action. If a GstSegment is changed, corresponding segment event will be followed by next data flow.
FIXME: currently only GST_FORMAT_TIME format is supported and therefore GstAppSrc::format should be time. However, possibly GstAppSrc can support other formats.
Flags : Read / Write
Default value : false
Since : 1.18
is-live
“is-live” gboolean
Instruct the source to behave like a live source. This includes that it will only push out buffers in the PLAYING state.
Flags : Read / Write
Default value : false
leaky-type
“leaky-type” GstAppLeakyType *
When set to any other value than GST_APP_LEAKY_TYPE_NONE 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 oldest or new buffers.
Flags : Read / Write
Default value : none (0)
Since : 1.20
max-buffers
“max-buffers” guint64
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.
Flags : Read / Write
Default value : 0
Since : 1.20
max-bytes
“max-bytes” guint64
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.
Flags : Read / Write
Default value : 200000
max-latency
“max-latency” gint64
The maximum latency (-1 = unlimited)
Flags : Read / Write
Default value : 18446744073709551615
max-time
“max-time” guint64
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.
Flags : Read / Write
Default value : 0
Since : 1.20
min-latency
“min-latency” gint64
The minimum latency of the source. A value of -1 will use the default latency calculations of GstBaseSrc.
Flags : Read / Write
Default value : 18446744073709551615
min-percent
“min-percent” guint
Make appsrc emit the "need-data" signal when the amount of bytes in the queue drops below this percentage of max-bytes.
Flags : Read / Write
Default value : 0
size
“size” gint64
The total size in bytes of the data stream. If the total size is known, it is recommended to configure it with this property.
Flags : Read / Write
Default value : 18446744073709551615
stream-type
“stream-type” GstAppStreamType *
The type of stream that this source is producing. For seekable streams the application should connect to the seek-data signal.
Flags : Read / Write
Default value : stream (0)
The results of the search are