plugins: add init/clear functions to GstQueueArray

This commit is contained in:
Tim-Philipp Müller 2012-07-14 19:38:39 +01:00
parent 94f6ba9c0b
commit 2b17de7504
2 changed files with 21 additions and 5 deletions

View file

@ -23,17 +23,24 @@
#include <gst/gst.h>
#include "gstqueuearray.h"
GstQueueArray *
gst_queue_array_new (guint initial_size)
void
gst_queue_array_init (GstQueueArray * array, guint initial_size)
{
GstQueueArray *array = g_malloc (sizeof (GstQueueArray));
array->size = initial_size;
array->array = g_new0 (gpointer, initial_size);
array->head = 0;
array->tail = 0;
array->length = 0;
}
GstQueueArray *
gst_queue_array_new (guint initial_size)
{
GstQueueArray *array;
array = g_new (GstQueueArray, 1);
gst_queue_array_init (array, initial_size);
return array;
}
@ -102,9 +109,15 @@ gst_queue_array_is_empty (GstQueueArray * array)
}
void
gst_queue_array_free (GstQueueArray * array)
gst_queue_array_clear (GstQueueArray * array)
{
g_free (array->array);
}
void
gst_queue_array_free (GstQueueArray * array)
{
gst_queue_array_clear (array);
g_free (array);
}

View file

@ -35,6 +35,9 @@ struct _GstQueueArray
guint length;
};
void gst_queue_array_init (GstQueueArray * array, guint initial_size);
void gst_queue_array_clear (GstQueueArray * array);
GstQueueArray *gst_queue_array_new (guint initial_size);
gpointer gst_queue_array_pop_head (GstQueueArray * array);
void gst_queue_array_push_tail (GstQueueArray * array, gpointer data);