basesink: Add GST_BASE_SINK_FLOW_DROPPED return value

This new flow return value can be used in ::render virtual method
to signal that a frame is not being rendered.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
This commit is contained in:
Nicolas Dufresne 2023-02-15 13:10:25 -05:00 committed by GStreamer Marge Bot
parent 018fdf36b1
commit 5c256cffa6
2 changed files with 22 additions and 0 deletions

View file

@ -3950,6 +3950,11 @@ again:
if (bclass->render)
ret = bclass->render (basesink, GST_BUFFER_CAST (obj));
if (ret == GST_BASE_SINK_FLOW_DROPPED) {
ret = GST_FLOW_OK;
goto dropped;
}
} else {
GstBufferList *buffer_list = GST_BUFFER_LIST_CAST (obj);
@ -3959,6 +3964,9 @@ again:
/* Set the first buffer and buffer list to be included in last sample */
gst_base_sink_set_last_buffer (basesink, sync_buf);
gst_base_sink_set_last_buffer_list (basesink, buffer_list);
/* Not currently supported */
g_assert (ret != GST_BASE_SINK_FLOW_DROPPED);
}
if (ret == GST_FLOW_STEP)

View file

@ -58,6 +58,20 @@ G_BEGIN_DECLS
#define GST_BASE_SINK_PREROLL_SIGNAL(obj) g_cond_signal (GST_BASE_SINK_GET_PREROLL_COND (obj));
#define GST_BASE_SINK_PREROLL_BROADCAST(obj) g_cond_broadcast (GST_BASE_SINK_GET_PREROLL_COND (obj));
/**
* GST_BASE_SINK_FLOW_DROPPED:
*
* A #GstFlowReturn that can be returned from
* #GstBaseSinkClass::render to indicate that the output buffer was not
* rendered.
*
* Note that this is currently not support for #GstBaseSinkClass::render_list
* virtual method.
*
* Since: 1.24
*/
#define GST_BASE_SINK_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS
typedef struct _GstBaseSink GstBaseSink;
typedef struct _GstBaseSinkClass GstBaseSinkClass;
typedef struct _GstBaseSinkPrivate GstBaseSinkPrivate;