From 89eac59e928b24363f405f11751720cabd0b4a75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 4 Mar 2018 10:53:10 +0200 Subject: [PATCH] queuearray: Implement pop_tail_struct() for completeness All other variants of {peek,pop}_{head,tail}_{,struct} were already implemented. https://bugzilla.gnome.org/show_bug.cgi?id=794035 --- docs/libs/gstreamer-libs-sections.txt | 1 + libs/gst/base/gstqueuearray.c | 35 +++++++++++++++++++++++++++++++++++ libs/gst/base/gstqueuearray.h | 2 ++ win32/common/libgstbase.def | 1 + 4 files changed, 39 insertions(+) diff --git a/docs/libs/gstreamer-libs-sections.txt b/docs/libs/gstreamer-libs-sections.txt index 36a42d4..66f77af 100644 --- a/docs/libs/gstreamer-libs-sections.txt +++ b/docs/libs/gstreamer-libs-sections.txt @@ -938,6 +938,7 @@ gst_queue_array_push_tail_struct gst_queue_array_peek_head_struct gst_queue_array_pop_head_struct gst_queue_array_peek_tail_struct +gst_queue_array_pop_tail_struct gst_queue_array_drop_struct diff --git a/libs/gst/base/gstqueuearray.c b/libs/gst/base/gstqueuearray.c index ebec179..c52ee39 100644 --- a/libs/gst/base/gstqueuearray.c +++ b/libs/gst/base/gstqueuearray.c @@ -402,6 +402,41 @@ gst_queue_array_pop_tail (GstQueueArray * array) } /** + * gst_queue_array_pop_tail_struct: (skip) + * @array: a #GstQueueArray object + * + * Returns the tail of the queue @array and removes + * it from the queue. + * + * Returns: The tail of the queue + * + * Since: 1.14 + */ +gpointer +gst_queue_array_pop_tail_struct (GstQueueArray * array) +{ + gpointer ret; + guint len, idx; + + g_return_val_if_fail (array != NULL, NULL); + + len = array->length; + + /* empty array */ + if (len == 0) + return NULL; + + idx = (array->head + (len - 1)) % array->size; + + ret = array->array + (array->elt_size * idx); + + array->tail = idx; + array->length--; + + return ret; +} + +/** * gst_queue_array_is_empty: (skip) * @array: a #GstQueueArray object * diff --git a/libs/gst/base/gstqueuearray.h b/libs/gst/base/gstqueuearray.h index 5752320..bbb465f 100644 --- a/libs/gst/base/gstqueuearray.h +++ b/libs/gst/base/gstqueuearray.h @@ -84,6 +84,8 @@ gboolean gst_queue_array_drop_struct (GstQueueArray * array, guint idx, gpointer p_struct); GST_EXPORT +gpointer gst_queue_array_pop_tail_struct (GstQueueArray * array); +GST_EXPORT gpointer gst_queue_array_peek_tail_struct (GstQueueArray * array); G_END_DECLS diff --git a/win32/common/libgstbase.def b/win32/common/libgstbase.def index c6788f2..528ed98 100644 --- a/win32/common/libgstbase.def +++ b/win32/common/libgstbase.def @@ -321,6 +321,7 @@ EXPORTS gst_queue_array_pop_head gst_queue_array_pop_head_struct gst_queue_array_pop_tail + gst_queue_array_pop_tail_struct gst_queue_array_push_tail gst_queue_array_push_tail_struct gst_type_find_helper -- 2.7.4