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
This commit is contained in:
Sebastian Dröge 2018-03-04 10:53:10 +02:00
parent a1bf0f0e6a
commit 89eac59e92
4 changed files with 39 additions and 0 deletions

View file

@ -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>

View file

@ -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

View file

@ -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

View file

@ -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