# GstQueueArray

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

## GstQueueArray

### Methods

#### gst_queue_array_clear

    gst_queue_array_clear (GstQueueArray * array)

Clears queue array and frees all memory associated to it.

Parameters:

`array` –

a GstQueueArray object

Since : 1.16

#### 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.

Parameters:

`array` –

a GstQueueArray object

`idx` –

index to drop

Returns –

the dropped element

Since : 1.2

#### gst_queue_array_drop_struct

    gboolean
    gst_queue_array_drop_struct (GstQueueArray * array,
                                 guint idx,
                                 gpointer p_struct)

Drops the queue element at position idx from queue array and copies the data of the element or structure that was removed into p_struct if p_struct is set (not NULL).

Parameters:

`array` –

a GstQueueArray object

`idx` –

index to drop

`p_struct` –

address into which to store the data of the dropped structure, or NULL

Returns –

TRUE on success, or FALSE on error

Since : 1.6

#### 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.

Parameters:

`array` –

a GstQueueArray object

`func` ( [nullable]) –

comparison function, or NULL to find data by value

`data` –

data for comparison function

Returns –

Index of the found element or -1 if nothing was found.

Since : 1.2

#### gst_queue_array_free

    gst_queue_array_free (GstQueueArray * array)

Frees queue array and all memory associated to it.

Parameters:

`array` –

a GstQueueArray object

Since : 1.2

#### gst_queue_array_get_length

    guint
    gst_queue_array_get_length (GstQueueArray * array)

Returns the length of the queue array

Parameters:

`array` –

a GstQueueArray object

Returns –

the length of the queue array.

Since : 1.2

#### gst_queue_array_is_empty

    gboolean
    gst_queue_array_is_empty (GstQueueArray * array)

Checks if the queue array is empty.

Parameters:

`array` –

a GstQueueArray object

Returns –

TRUE if the queue array is empty

Since : 1.2

#### gst_queue_array_peek_head

    gpointer
    gst_queue_array_peek_head (GstQueueArray * array)

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

Parameters:

`array` –

a GstQueueArray object

Returns –

The head of the queue

Since : 1.2

#### gst_queue_array_peek_head_struct

    gpointer
    gst_queue_array_peek_head_struct (GstQueueArray * array)

Returns the head of the queue array without removing it from the queue.

Parameters:

`array` –

a GstQueueArray object

Returns ( [nullable]) –

pointer to element or struct, or NULL if array was empty. The data pointed to by the returned pointer stays valid only as long as the queue array is not modified further!

Since : 1.6

#### gst_queue_array_peek_nth

    gpointer
    gst_queue_array_peek_nth (GstQueueArray * array,
                              guint idx)

Returns the item at idx in array, but does not remove it from the queue.

Parameters:

`array` –
No description available
`idx` –
No description available
Returns ( [nullable]) –

The item, or NULL if idx was out of bounds

Since : 1.16

#### gst_queue_array_peek_nth_struct

    gpointer
    gst_queue_array_peek_nth_struct (GstQueueArray * array,
                                     guint idx)

Returns the item at idx in array, but does not remove it from the queue.

Parameters:

`array` –
No description available
`idx` –
No description available
Returns ( [nullable]) –

The item, or NULL if idx was out of bounds

Since : 1.16

#### gst_queue_array_peek_tail

    gpointer
    gst_queue_array_peek_tail (GstQueueArray * array)

Returns the tail of the queue array, but does not remove it from the queue.

Parameters:

`array` –

a GstQueueArray object

Returns –

The tail of the queue

Since : 1.14

#### gst_queue_array_peek_tail_struct

    gpointer
    gst_queue_array_peek_tail_struct (GstQueueArray * array)

Returns the tail of the queue array, but does not remove it from the queue.

Parameters:

`array` –

a GstQueueArray object

Returns –

The tail of the queue

Since : 1.14

#### gst_queue_array_pop_head

    gpointer
    gst_queue_array_pop_head (GstQueueArray * array)

Returns and head of the queue array and removes it from the queue.

Parameters:

`array` –

a GstQueueArray object

Returns –

The head of the queue

Since : 1.2

#### gst_queue_array_pop_head_struct

    gpointer
    gst_queue_array_pop_head_struct (GstQueueArray * array)

Returns the head of the queue array and removes it from the queue.

Parameters:

`array` –

a GstQueueArray object

Returns ( [nullable]) –

pointer to element or struct, or NULL if array was empty. The data pointed to by the returned pointer stays valid only as long as the queue array is not modified further!

Since : 1.6

#### gst_queue_array_pop_tail

    gpointer
    gst_queue_array_pop_tail (GstQueueArray * array)

Returns the tail of the queue array and removes it from the queue.

Parameters:

`array` –

a GstQueueArray object

Returns –

The tail of the queue

Since : 1.14

#### gst_queue_array_pop_tail_struct

    gpointer
    gst_queue_array_pop_tail_struct (GstQueueArray * array)

Returns the tail of the queue array and removes it from the queue.

Parameters:

`array` –

a GstQueueArray object

Returns –

The tail of the queue

Since : 1.14

#### gst_queue_array_push_sorted

    gst_queue_array_push_sorted (GstQueueArray * array,
                                 gpointer data,
                                 GCompareDataFunc func,
                                 gpointer user_data)

Pushes data to the queue array, finding the correct position by comparing data with each array element using func.

This has a time complexity of O(n), so depending on the size of the queue and expected access patterns, a different data structure might be better.

Assumes that the array is already sorted. If it is not, make sure to call gst_queue_array_sort first.

Parameters:

`array` –

a GstQueueArray object

`data` –

object to push

`func` –

comparison function

`user_data` ( [nullable]) –

data for comparison function

Since : 1.24

#### gst_queue_array_push_sorted_struct

    gst_queue_array_push_sorted_struct (GstQueueArray * array,
                                        gpointer p_struct,
                                        GCompareDataFunc func,
                                        gpointer user_data)

Pushes the element at address p_struct into the queue array (copying the contents of a structure of the struct_size specified when creating the queue into the array), finding the correct position by comparing the element at p_struct with each element in the array using func.

This has a time complexity of O(n), so depending on the size of the queue and expected access patterns, a different data structure might be better.

Assumes that the array is already sorted. If it is not, make sure to call gst_queue_array_sort first.

Parameters:

`array` –

a GstQueueArray object

`p_struct` –

address of element or structure to push into the queue

`func` –

comparison function

`user_data` ( [nullable]) –

data for comparison function

Since : 1.24

#### gst_queue_array_push_tail

    gst_queue_array_push_tail (GstQueueArray * array,
                               gpointer data)

Pushes data to the tail of the queue array.

Parameters:

`array` –

a GstQueueArray object

`data` –

object to push

Since : 1.2

#### gst_queue_array_push_tail_struct

    gst_queue_array_push_tail_struct (GstQueueArray * array,
                                      gpointer p_struct)

Parameters:

`array` –
No description available
`p_struct` –
No description available

#### GstBase.QueueArray.prototype.push_tail_struct

    function GstBase.QueueArray.prototype.push_tail_struct(p_struct: Object): {
        // javascript wrapper for 'gst_queue_array_push_tail_struct'
    }

Parameters:

`array` (GstQueueArray (not introspectable)) –
No description available
`p_struct` (Object) –
No description available

#### GstBase.QueueArray.push_tail_struct

    def GstBase.QueueArray.push_tail_struct (self, p_struct):
        #python wrapper for 'gst_queue_array_push_tail_struct'

Parameters:

`array` (GstQueueArray (not introspectable)) –
No description available
`p_struct` (object) –
No description available

#### gst_queue_array_set_clear_func

    gst_queue_array_set_clear_func (GstQueueArray * array,
                                    GDestroyNotify clear_func)

Sets a function to clear an element of array.

The clear_func will be called when an element in the array data segment is removed and when the array is freed and data segment is deallocated as well. clear_func will be passed a pointer to the element to clear, rather than the element itself.

Note that in contrast with other uses of GDestroyNotify functions, clear_func is expected to clear the contents of the array element it is given, but not free the element itself.

Parameters:

`array` –

a GstQueueArray object

`clear_func` –

a function to clear an element of array

Since : 1.16

#### gst_queue_array_sort

    gst_queue_array_sort (GstQueueArray * array,
                          GCompareDataFunc compare_func,
                          gpointer user_data)

Sorts the queue array by comparing elements against each other using the provided compare_func.

Parameters:

`array` –

a GstQueueArray object

`compare_func` –

comparison function

`user_data` ( [nullable]) –

data for comparison function

Since : 1.24

### Functions

#### 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.

Parameters:

`initial_size` –

Initial size of the new queue

Returns –

a new GstQueueArray object

Since : 1.2

#### gst_queue_array_new_for_struct

    GstQueueArray *
    gst_queue_array_new_for_struct (gsize struct_size,
                                    guint initial_size)

Allocates a new GstQueueArray object for elements (e.g. structures) of size struct_size, with an initial queue size of initial_size.

Parameters:

`struct_size` –

Size of each element (e.g. structure) in the array

`initial_size` –

Initial size of the new queue

Returns –

a new GstQueueArray object

Since : 1.6

The results of the search are