summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.com>2021-02-19 14:45:08 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.com>2021-07-22 13:53:53 +0200
commit457e33fee579705b6a3ec8ac058a2c9ad71b4bfa (patch)
tree5b7600c5a0dc44b5c21c3eb8a182498538149d79
parentaba6bd7822f4c0f572765bfaada76f454a594317 (diff)
downloadgstreamer-plugins-base-457e33fee579705b6a3ec8ac058a2c9ad71b4bfa.tar.gz
appsink: factor out dequeue_object()
No semantic change, will be used to implement new event API. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1046>
-rw-r--r--gst-libs/gst/app/gstappsink.c74
1 files changed, 44 insertions, 30 deletions
diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c
index fed56a5e5..65822c849 100644
--- a/gst-libs/gst/app/gstappsink.c
+++ b/gst-libs/gst/app/gstappsink.c
@@ -854,45 +854,59 @@ flushing:
}
static GstMiniObject *
-dequeue_buffer (GstAppSink * appsink)
+dequeue_object (GstAppSink * appsink)
{
GstAppSinkPrivate *priv = appsink->priv;
GstMiniObject *obj;
+ obj = gst_queue_array_pop_head (priv->queue);
+
+ if (GST_IS_BUFFER (obj) || GST_IS_BUFFER_LIST (obj)) {
+ GST_DEBUG_OBJECT (appsink, "dequeued buffer/list %p", obj);
+ priv->num_buffers--;
+ } else if (GST_IS_EVENT (obj)) {
+ GstEvent *event = GST_EVENT_CAST (obj);
+
+ switch (GST_EVENT_TYPE (obj)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ GST_DEBUG_OBJECT (appsink, "activating caps %" GST_PTR_FORMAT, caps);
+ gst_caps_replace (&priv->last_caps, caps);
+ priv->sample = gst_sample_make_writable (priv->sample);
+ gst_sample_set_caps (priv->sample, priv->last_caps);
+ break;
+ }
+ case GST_EVENT_SEGMENT:
+ gst_event_copy_segment (event, &priv->last_segment);
+ priv->sample = gst_sample_make_writable (priv->sample);
+ gst_sample_set_segment (priv->sample, &priv->last_segment);
+ GST_DEBUG_OBJECT (appsink, "activated segment %" GST_SEGMENT_FORMAT,
+ &priv->last_segment);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return obj;
+}
+
+static GstMiniObject *
+dequeue_buffer (GstAppSink * appsink)
+{
+ GstMiniObject *obj;
+
do {
- obj = gst_queue_array_pop_head (priv->queue);
+ obj = dequeue_object (appsink);
if (GST_IS_BUFFER (obj) || GST_IS_BUFFER_LIST (obj)) {
- GST_DEBUG_OBJECT (appsink, "dequeued buffer/list %p", obj);
- priv->num_buffers--;
break;
- } else if (GST_IS_EVENT (obj)) {
- GstEvent *event = GST_EVENT_CAST (obj);
-
- switch (GST_EVENT_TYPE (obj)) {
- case GST_EVENT_CAPS:
- {
- GstCaps *caps;
-
- gst_event_parse_caps (event, &caps);
- GST_DEBUG_OBJECT (appsink, "activating caps %" GST_PTR_FORMAT, caps);
- gst_caps_replace (&priv->last_caps, caps);
- priv->sample = gst_sample_make_writable (priv->sample);
- gst_sample_set_caps (priv->sample, priv->last_caps);
- break;
- }
- case GST_EVENT_SEGMENT:
- gst_event_copy_segment (event, &priv->last_segment);
- priv->sample = gst_sample_make_writable (priv->sample);
- gst_sample_set_segment (priv->sample, &priv->last_segment);
- GST_DEBUG_OBJECT (appsink, "activated segment %" GST_SEGMENT_FORMAT,
- &priv->last_segment);
- break;
- default:
- break;
- }
- gst_mini_object_unref (obj);
}
+
+ gst_mini_object_unref (obj);
} while (TRUE);
return obj;