GstQueueArray

## GstQueueArray GstQueueArray — Array based queue object |

## Synopsis

    #include <gst/base/gstqueuearray.h>

                        GstQueueArray;
    GstQueueArray *     gst_queue_array_new                 (guint initial_size);
    void                gst_queue_array_free                (GstQueueArray *array);
    guint               gst_queue_array_get_length          (GstQueueArray *array);
    gpointer            gst_queue_array_pop_head            (GstQueueArray *array);
    gpointer            gst_queue_array_peek_head           (GstQueueArray *array);
    void                gst_queue_array_push_tail           (GstQueueArray *array,
                                                             gpointer data);
    gboolean            gst_queue_array_is_empty            (GstQueueArray *array);
    gpointer            gst_queue_array_drop_element        (GstQueueArray *array,
                                                             guint idx);
    guint               gst_queue_array_find                (GstQueueArray *array,
                                                             GCompareFunc func,
                                                             gpointer data);

## Description

GstQueueArray is an object that provides standard queue functionality based on an array instead of linked lists. This reduces the overhead caused by memory managment by a large factor.

## Details

### GstQueueArray

    typedef struct _GstQueueArray GstQueueArray;

### gst_queue_array_new ()

    GstQueueArray *     gst_queue_array_new                 (guint initial_size);

Allocates a new GstQueueArray object with an initial queue size of `initial_size`.

`initial_size` : | Initial size of the new queue
Returns : | a new GstQueueArray object

Since 1.2.0

### gst_queue_array_free ()

    void                gst_queue_array_free                (GstQueueArray *array);

Frees queue `array` and all memory associated to it.

`array` : | a GstQueueArray object

Since 1.2.0

### gst_queue_array_get_length ()

    guint               gst_queue_array_get_length          (GstQueueArray *array);

Returns the length of the queue `array`

`array` : | a GstQueueArray object
Returns : | the length of the queue `array`.

Since 1.2.0

### gst_queue_array_pop_head ()

    gpointer            gst_queue_array_pop_head            (GstQueueArray *array);

Returns and head of the queue `array` and does not remove it from the queue.

`array` : | a GstQueueArray object
Returns : | The head of the queue

Since 1.2.0

### gst_queue_array_peek_head ()

    gpointer            gst_queue_array_peek_head           (GstQueueArray *array);

### gst_queue_array_push_tail ()

    void                gst_queue_array_push_tail           (GstQueueArray *array,
                                                             gpointer data);

Pushes `data` to the tail of the queue `array`.

`array` : | a GstQueueArray object
`data` : | object to push

Since 1.2.0

### gst_queue_array_is_empty ()

    gboolean            gst_queue_array_is_empty            (GstQueueArray *array);

Checks if the queue `array` is empty.

`array` : | a GstQueueArray object
Returns : | `TRUE` if the queue `array` is empty

Since 1.2.0

### gst_queue_array_drop_element ()

    gpointer            gst_queue_array_drop_element        (GstQueueArray *array,
                                                             guint idx);

Drops the queue element at position `idx` from queue `array`.

`array` : | a GstQueueArray object
`idx` : | index to drop
Returns : | the dropped element

Since 1.2.0

### gst_queue_array_find ()

    guint               gst_queue_array_find                (GstQueueArray *array,
                                                             GCompareFunc func,
                                                             gpointer data);

Finds an element in the queue `array`, either by comparing every element with `func` or by looking up `data` if no compare function `func` is provided, and returning the index of the found element.

Note that the index is not 0-based, but an internal index number with a random offset. The index can be used in connection with `gst_queue_array_drop_element()`. FIXME: return index 0-based and make `_drop_element()` take a 0-based index.

`array` : | a GstQueueArray object
`func` : | comparison function, or `NULL` to find `data` by value. [allow-none]
`data` : | data for comparison function
Returns : | Index of the found element or -1 if nothing was found.

Since 1.2.0