Commit 89eac59e authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

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
parent a1bf0f0e
......@@ -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
</SECTION>
......
......@@ -401,6 +401,41 @@ gst_queue_array_pop_tail (GstQueueArray * array)
return ret;
}
/**
* 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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment