appsink
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.
For the documentation of the API, please see the
libgstapp section in the GStreamer Plugins Base Libraries documentation.Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBaseSink ╰──appsink
Implemented interfaces
Factory details
Authors: – David Schleef
Classification: – Generic/Sink
Rank – none
Plugin – app
Package – GStreamer Base Plug-ins
Pad Templates
sink
ANY
Signals
eos
eos_callback (GstElement * appsink, gpointer udata)
def eos_callback (appsink, udata):
#python callback for the 'eos' signal
function eos_callback(appsink: GstElement * appsink, udata: gpointer udata): {
// javascript callback for the 'eos' signal
}
Signal that the end-of-stream has been reached. This signal is emitted from the streaming thread.
Parameters:
appsink
–
the appsink element that emitted the signal
udata
–
Flags: Run Last
new-preroll
GstFlowReturn * new_preroll_callback (GstElement * appsink, gpointer udata)
def new_preroll_callback (appsink, udata):
#python callback for the 'new-preroll' signal
function new_preroll_callback(appsink: GstElement * appsink, udata: gpointer udata): {
// javascript callback for the 'new-preroll' signal
}
Signal that a new preroll sample is available.
This signal is emitted from the streaming thread and only when the "emit-signals" property is TRUE.
The new preroll sample can be retrieved with the "pull-preroll" action signal or gst_app_sink_pull_preroll either from this signal callback or from any other thread.
Note that this signal is only emitted when the "emit-signals" property is set to TRUE, which it is not by default for performance reasons.
Parameters:
appsink
–
the appsink element that emitted the signal
udata
–
Flags: Run Last
new-sample
GstFlowReturn * new_sample_callback (GstElement * appsink, gpointer udata)
def new_sample_callback (appsink, udata):
#python callback for the 'new-sample' signal
function new_sample_callback(appsink: GstElement * appsink, udata: gpointer udata): {
// javascript callback for the 'new-sample' signal
}
Signal that a new sample is available.
This signal is emitted from the streaming thread and only when the "emit-signals" property is TRUE.
The new sample can be retrieved with the "pull-sample" action signal or gst_app_sink_pull_sample either from this signal callback or from any other thread.
Note that this signal is only emitted when the "emit-signals" property is set to TRUE, which it is not by default for performance reasons.
Parameters:
appsink
–
the appsink element that emitted the signal
udata
–
Flags: Run Last
pull-preroll
GstSample * pull_preroll_callback (GstElement * appsink, gpointer udata)
def pull_preroll_callback (appsink, udata):
#python callback for the 'pull-preroll' signal
function pull_preroll_callback(appsink: GstElement * appsink, udata: gpointer udata): {
// javascript callback for the 'pull-preroll' signal
}
Get the last preroll sample in appsink. This was the sample that caused the appsink to preroll in the PAUSED state.
This function is typically used when dealing with a pipeline in the PAUSED state. Calling this function after doing a seek will give the sample right after the seek position.
Calling this function will clear the internal reference to the preroll buffer.
Note that the preroll sample will also be returned as the first sample when calling gst_app_sink_pull_sample or the "pull-sample" action signal.
If an EOS event was received before any buffers, this function returns NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
This function blocks until a preroll sample or EOS is received or the appsink element is set to the READY/NULL state.
Parameters:
appsink
–
the appsink element to emit this signal on
udata
–
pull-sample
GstSample * pull_sample_callback (GstElement * appsink, gpointer udata)
def pull_sample_callback (appsink, udata):
#python callback for the 'pull-sample' signal
function pull_sample_callback(appsink: GstElement * appsink, udata: gpointer udata): {
// javascript callback for the 'pull-sample' signal
}
This function blocks until a sample or EOS becomes available or the appsink element is set to the READY/NULL state.
This function will only return samples when the appsink is in the PLAYING state. All rendered samples will be put in a queue so that the application can pull samples at its own rate.
Note that when the application does not pull samples fast enough, the queued samples could consume a lot of memory, especially when dealing with raw video frames. It's possible to control the behaviour of the queue with the "drop" and "max-buffers" properties.
If an EOS event was received before any buffers, this function returns NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
Parameters:
appsink
–
the appsink element to emit this signal on
udata
–
try-pull-preroll
GstSample * try_pull_preroll_callback (GstElement * appsink, guint64 timeout, gpointer udata)
def try_pull_preroll_callback (appsink, timeout, udata):
#python callback for the 'try-pull-preroll' signal
function try_pull_preroll_callback(appsink: GstElement * appsink, timeout: guint64 timeout, udata: gpointer udata): {
// javascript callback for the 'try-pull-preroll' signal
}
Get the last preroll sample in appsink. This was the sample that caused the appsink to preroll in the PAUSED state.
This function is typically used when dealing with a pipeline in the PAUSED state. Calling this function after doing a seek will give the sample right after the seek position.
Calling this function will clear the internal reference to the preroll buffer.
Note that the preroll sample will also be returned as the first sample when calling gst_app_sink_pull_sample or the "pull-sample" action signal.
If an EOS event was received before any buffers or the timeout expires, this function returns NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
This function blocks until a preroll sample or EOS is received, the appsink element is set to the READY/NULL state, or the timeout expires.
Parameters:
appsink
–
the appsink element to emit this signal on
timeout
–
the maximum amount of time to wait for the preroll sample
udata
–
Since : 1.10
try-pull-sample
GstSample * try_pull_sample_callback (GstElement * appsink, guint64 timeout, gpointer udata)
def try_pull_sample_callback (appsink, timeout, udata):
#python callback for the 'try-pull-sample' signal
function try_pull_sample_callback(appsink: GstElement * appsink, timeout: guint64 timeout, udata: gpointer udata): {
// javascript callback for the 'try-pull-sample' signal
}
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.
This function will only return samples when the appsink is in the PLAYING state. All rendered samples will be put in a queue so that the application can pull samples at its own rate.
Note that when the application does not pull samples fast enough, the queued samples could consume a lot of memory, especially when dealing with raw video frames. It's possible to control the behaviour of the queue with the "drop" and "max-buffers" properties.
If an EOS event was received before any buffers or the timeout expires, this function returns NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
Parameters:
appsink
–
the appsink element to emit this signal on
timeout
–
the maximum amount of time to wait for a sample
udata
–
Since : 1.10
Properties
drop
“drop” gboolean
Drop old buffers when the buffer queue is filled
Flags : Read / Write
Default value : false
emit-signals
“emit-signals” gboolean
Emit new-preroll and new-sample signals
Flags : Read / Write
Default value : false
max-buffers
“max-buffers” guint
The maximum number of buffers to queue internally (0 = unlimited)
Flags : Read / Write
Default value : 0
wait-on-eos
“wait-on-eos” gboolean
Wait for all buffers to be processed after receiving an EOS
Flags : Read / Write
Default value : true
The results of the search are