# GstIterator

A GstIterator is used to retrieve multiple objects from another object in a threadsafe way.

Various GStreamer objects provide access to their internal structures using an iterator.

Note that if calling a GstIterator function results in your code receiving a refcounted object (with, say, g_value_get_object), the refcount for that object will not be increased. Your code is responsible for taking a reference if it wants to continue using it later.

The basic use pattern of an iterator is as follows:

       GstIterator *it = _get_iterator(object);
       GValue item = G_VALUE_INIT;
       done = FALSE;
       while (!done) {
         switch (gst_iterator_next (it, &item)) {
           case GST_ITERATOR_OK:
             ...get/use/change item here...
             g_value_reset (&item);
             break;
           case GST_ITERATOR_RESYNC:
             ...rollback changes to items...
             gst_iterator_resync (it);
             break;
           case GST_ITERATOR_ERROR:
             ...wrong parameters were given...
             done = TRUE;
             break;
           case GST_ITERATOR_DONE:
             done = TRUE;
             break;
         }
       }
       g_value_unset (&item);
       gst_iterator_free (it);

## GstIterator

GstIterator base structure. The values of this structure are protected for subclasses, use the methods to use the GstIterator.

### Members

`copy` (GstIteratorCopyFunction) –

The function to copy the iterator

`next` (GstIteratorNextFunction) –

The function to get the next item in the iterator

`item` (GstIteratorItemFunction) –

The function to be called for each item retrieved

`resync` (GstIteratorResyncFunction) –

The function to call when a resync is needed.

`free` (GstIteratorFreeFunction) –

The function to call when the iterator is freed

`pushed` (GstIterator *) –

The iterator that is currently pushed with gst_iterator_push

`type` (GType) –

The type of the object that this iterator will return

`lock` (GMutex *) –

The lock protecting the data structure and the cookie.

`cookie` (guint32) –

The cookie; the value of the master_cookie when this iterator was created.

`master_cookie` (guint32*) –

A pointer to the master cookie.

`size` (guint) –

the size of the iterator

## Gst.Iterator

Gst.Iterator base structure. The values of this structure are protected for subclasses, use the methods to use the Gst.Iterator.

### Members

`copy` (Gst.IteratorCopyFunction) –

The function to copy the iterator

`next` (Gst.IteratorNextFunction) –

The function to get the next item in the iterator

`item` (Gst.IteratorItemFunction) –

The function to be called for each item retrieved

`resync` (Gst.IteratorResyncFunction) –

The function to call when a resync is needed.

`free` (Gst.IteratorFreeFunction) –

The function to call when the iterator is freed

`pushed` (Gst.Iterator) –

The iterator that is currently pushed with Gst.Iterator.prototype.push

`type` (GObject.Type) –

The type of the object that this iterator will return

`lock` (GLib.Mutex) –

The lock protecting the data structure and the cookie.

`cookie` (Number) –

The cookie; the value of the master_cookie when this iterator was created.

`master_cookie` (Number) –

A pointer to the master cookie.

`size` (Number) –

the size of the iterator

## Gst.Iterator

Gst.Iterator base structure. The values of this structure are protected for subclasses, use the methods to use the Gst.Iterator.

### Members

`copy` (Gst.IteratorCopyFunction) –

The function to copy the iterator

`next` (Gst.IteratorNextFunction) –

The function to get the next item in the iterator

`item` (Gst.IteratorItemFunction) –

The function to be called for each item retrieved

`resync` (Gst.IteratorResyncFunction) –

The function to call when a resync is needed.

`free` (Gst.IteratorFreeFunction) –

The function to call when the iterator is freed

`pushed` (Gst.Iterator) –

The iterator that is currently pushed with Gst.Iterator.push

`type` (GObject.Type) –

The type of the object that this iterator will return

`lock` (GLib.Mutex) –

The lock protecting the data structure and the cookie.

`cookie` (int) –

The cookie; the value of the master_cookie when this iterator was created.

`master_cookie` (int) –

A pointer to the master cookie.

`size` (int) –

the size of the iterator

### Constructors

#### gst_iterator_new

    GstIterator *
    gst_iterator_new (guint size,
                      GType type,
                      GMutex * lock,
                      guint32* master_cookie,
                      GstIteratorCopyFunction copy,
                      GstIteratorNextFunction next,
                      GstIteratorItemFunction item,
                      GstIteratorResyncFunction resync,
                      GstIteratorFreeFunction free)

Create a new iterator. This function is mainly used for objects implementing the next/resync/free function to iterate a data structure.

For each item retrieved, the item function is called with the lock held. The free function is called when the iterator is freed.

Parameters:

`size` –

the size of the iterator structure

`type` –

GType of children

`lock` –

pointer to a GMutex.

`master_cookie` –

pointer to a guint32 that is changed when the items in the iterator changed.

`copy` –

copy function

`next` –

function to get next item

`item` –

function to call on each item retrieved

`resync` –

function to resync the iterator

`free` –

function to free the iterator

Returns –

the new GstIterator.

MT safe.

#### gst_iterator_new_list

    GstIterator *
    gst_iterator_new_list (GType type,
                           GMutex * lock,
                           guint32* master_cookie,
                           GList ** list,
                           GObject * owner,
                           GstIteratorItemFunction item)

Create a new iterator designed for iterating list.

The list you iterate is usually part of a data structure owner and is protected with lock.

The iterator will use lock to retrieve the next item of the list and it will then call the item function before releasing lock again.

When a concurrent update to the list is performed, usually by owner while holding lock, master_cookie will be updated. The iterator implementation will notice the update of the cookie and will return GST_ITERATOR_RESYNC to the user of the iterator in the next call to gst_iterator_next.

Parameters:

`type` –

GType of elements

`lock` –

pointer to a GMutex protecting the list.

`master_cookie` –

pointer to a guint32 that is incremented when the list is changed.

`list` –

pointer to the list

`owner` –

object owning the list

`item` –

function to call on each item retrieved

Returns –

the new GstIterator for list.

MT safe.

#### gst_iterator_new_single

    GstIterator *
    gst_iterator_new_single (GType type,
                             const GValue * object)

This GstIterator is a convenient iterator for the common case where a GstIterator needs to be returned but only a single object has to be considered. This happens often for the GstPadIterIntLinkFunction.

Parameters:

`type` –

GType of the passed object

`object` –

object that this iterator should return

Returns –

the new GstIterator for object.

#### Gst.Iterator.prototype.new_single

    function Gst.Iterator.prototype.new_single(type: GObject.Type, object: GObject.Value): {
        // javascript wrapper for 'gst_iterator_new_single'
    }

This Gst.Iterator is a convenient iterator for the common case where a Gst.Iterator needs to be returned but only a single object has to be considered. This happens often for the Gst.PadIterIntLinkFunction.

Parameters:

`type` (GObject.Type) –

GObject.Type of the passed object

`object` (GObject.Value) –

object that this iterator should return

Returns (Gst.Iterator) –

the new Gst.Iterator for object.

#### Gst.Iterator.new_single

    def Gst.Iterator.new_single (type, object):
        #python wrapper for 'gst_iterator_new_single'

This Gst.Iterator is a convenient iterator for the common case where a Gst.Iterator needs to be returned but only a single object has to be considered. This happens often for the Gst.PadIterIntLinkFunction.

Parameters:

`type` (GObject.Type) –

GObject.Type of the passed object

`object` (GObject.Value) –

object that this iterator should return

Returns (Gst.Iterator) –

the new Gst.Iterator for object.

### Methods

#### gst_iterator_copy

    GstIterator *
    gst_iterator_copy (const GstIterator * it)

Copy the iterator and its state.

Parameters:

`it` –

a GstIterator

Returns –

a new copy of it.

#### Gst.Iterator.prototype.copy

    function Gst.Iterator.prototype.copy(): {
        // javascript wrapper for 'gst_iterator_copy'
    }

Copy the iterator and its state.

Parameters:

`it` (Gst.Iterator) –

a Gst.Iterator

Returns (Gst.Iterator) –

a new copy of it.

#### Gst.Iterator.copy

    def Gst.Iterator.copy (self):
        #python wrapper for 'gst_iterator_copy'

Copy the iterator and its state.

Parameters:

`it` (Gst.Iterator) –

a Gst.Iterator

Returns (Gst.Iterator) –

a new copy of it.

#### gst_iterator_filter

    GstIterator *
    gst_iterator_filter (GstIterator * it,
                         GCompareFunc func,
                         const GValue * user_data)

Create a new iterator from an existing iterator. The new iterator will only return those elements that match the given compare function func. The first parameter that is passed to func is the GValue of the current iterator element and the second parameter is user_data. func should return 0 for elements that should be included in the filtered iterator.

When this iterator is freed, it will also be freed.

Parameters:

`it` –

The GstIterator to filter

`func` ( [scope call]) –

the compare function to select elements

`user_data` ( [closure]) –

user data passed to the compare function

Returns ( [transfer: full]) –

a new GstIterator.

MT safe.

#### Gst.Iterator.prototype.filter

    function Gst.Iterator.prototype.filter(func: GLib.CompareFunc, user_data: GObject.Value): {
        // javascript wrapper for 'gst_iterator_filter'
    }

Create a new iterator from an existing iterator. The new iterator will only return those elements that match the given compare function func. The first parameter that is passed to func is the GObject.Value of the current iterator element and the second parameter is user_data. func should return 0 for elements that should be included in the filtered iterator.

When this iterator is freed, it will also be freed.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to filter

`func` (GLib.CompareFunc) –

the compare function to select elements

`user_data` (GObject.Value) –

user data passed to the compare function

Returns (Gst.Iterator) –

a new Gst.Iterator.

MT safe.

#### Gst.Iterator.filter

    def Gst.Iterator.filter (self, func, user_data):
        #python wrapper for 'gst_iterator_filter'

Create a new iterator from an existing iterator. The new iterator will only return those elements that match the given compare function func. The first parameter that is passed to func is the GObject.Value of the current iterator element and the second parameter is user_data. func should return 0 for elements that should be included in the filtered iterator.

When this iterator is freed, it will also be freed.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to filter

`func` (GLib.CompareFunc) –

the compare function to select elements

`user_data` (GObject.Value) –

user data passed to the compare function

Returns (Gst.Iterator) –

a new Gst.Iterator.

MT safe.

#### gst_iterator_find_custom

    gboolean
    gst_iterator_find_custom (GstIterator * it,
                              GCompareFunc func,
                              GValue * elem,
                              gpointer user_data)

Find the first element in it that matches the compare function func. func should return 0 when the element is found. The first parameter to func will be the current element of the iterator and the second parameter will be user_data. The result will be stored in elem if a result is found.

The iterator will not be freed.

This function will return FALSE if an error happened to the iterator or if the element wasn't found.

Parameters:

`it` –

The GstIterator to iterate

`func` ( [scope call]) –

the compare function to use

`elem` ( [out]) –

pointer to a GValue where to store the result

`user_data` ( [closure]) –

user data passed to the compare function

Returns –

Returns TRUE if the element was found, else FALSE.

MT safe.

#### Gst.Iterator.prototype.find_custom

    function Gst.Iterator.prototype.find_custom(func: GLib.CompareFunc, user_data: Object): {
        // javascript wrapper for 'gst_iterator_find_custom'
    }

Find the first element in it that matches the compare function func. func should return 0 when the element is found. The first parameter to func will be the current element of the iterator and the second parameter will be user_data. The result will be stored in elem if a result is found.

The iterator will not be freed.

This function will return FALSE if an error happened to the iterator or if the element wasn't found.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to iterate

`func` (GLib.CompareFunc) –

the compare function to use

`user_data` (Object) –

user data passed to the compare function

Returns a tuple made of:

(Number ) –

Returns TRUE if the element was found, else FALSE.

MT safe.

`elem` (GObject.Value ) –

Returns TRUE if the element was found, else FALSE.

MT safe.

#### Gst.Iterator.find_custom

    def Gst.Iterator.find_custom (self, func, *user_data):
        #python wrapper for 'gst_iterator_find_custom'

Find the first element in it that matches the compare function func. func should return 0 when the element is found. The first parameter to func will be the current element of the iterator and the second parameter will be user_data. The result will be stored in elem if a result is found.

The iterator will not be freed.

This function will return FALSE if an error happened to the iterator or if the element wasn't found.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to iterate

`func` (GLib.CompareFunc) –

the compare function to use

`user_data` (variadic) –

user data passed to the compare function

Returns a tuple made of:

(bool ) –

Returns TRUE if the element was found, else FALSE.

MT safe.

`elem` (GObject.Value ) –

Returns TRUE if the element was found, else FALSE.

MT safe.

#### gst_iterator_fold

    GstIteratorResult
    gst_iterator_fold (GstIterator * it,
                       GstIteratorFoldFunction func,
                       GValue * ret,
                       gpointer user_data)

Folds func over the elements of iter. That is to say, func will be called as func (object, ret, user_data) for each object in it. The normal use of this procedure is to accumulate the results of operating on the objects in ret.

This procedure can be used (and is used internally) to implement the gst_iterator_foreach and gst_iterator_find_custom operations.

The fold will proceed as long as func returns TRUE. When the iterator has no more arguments, GST_ITERATOR_DONE will be returned. If func returns FALSE, the fold will stop, and GST_ITERATOR_OK will be returned. Errors or resyncs will cause fold to return GST_ITERATOR_ERROR or GST_ITERATOR_RESYNC as appropriate.

The iterator will not be freed.

Parameters:

`it` –

The GstIterator to fold over

`func` ( [scope call]) –

the fold function

`ret` –

the seed value passed to the fold function

`user_data` ( [closure]) –

user data passed to the fold function

Returns –

A GstIteratorResult, as described above.

MT safe.

#### Gst.Iterator.prototype.fold

    function Gst.Iterator.prototype.fold(func: Gst.IteratorFoldFunction, ret: GObject.Value, user_data: Object): {
        // javascript wrapper for 'gst_iterator_fold'
    }

Folds func over the elements of iter. That is to say, func will be called as func (object, ret, user_data) for each object in it. The normal use of this procedure is to accumulate the results of operating on the objects in ret.

This procedure can be used (and is used internally) to implement the Gst.Iterator.prototype.foreach and Gst.Iterator.prototype.find_custom operations.

The fold will proceed as long as func returns TRUE. When the iterator has no more arguments, Gst.IteratorResult.DONE will be returned. If func returns FALSE, the fold will stop, and Gst.IteratorResult.OK will be returned. Errors or resyncs will cause fold to return Gst.IteratorResult.ERROR or Gst.IteratorResult.RESYNC as appropriate.

The iterator will not be freed.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to fold over

`func` (Gst.IteratorFoldFunction) –

the fold function

`ret` (GObject.Value) –

the seed value passed to the fold function

`user_data` (Object) –

user data passed to the fold function

Returns (Gst.IteratorResult) –

A Gst.IteratorResult, as described above.

MT safe.

#### Gst.Iterator.fold

    def Gst.Iterator.fold (self, func, ret, *user_data):
        #python wrapper for 'gst_iterator_fold'

Folds func over the elements of iter. That is to say, func will be called as func (object, ret, user_data) for each object in it. The normal use of this procedure is to accumulate the results of operating on the objects in ret.

This procedure can be used (and is used internally) to implement the Gst.Iterator.foreach and Gst.Iterator.find_custom operations.

The fold will proceed as long as func returns TRUE. When the iterator has no more arguments, Gst.IteratorResult.DONE will be returned. If func returns FALSE, the fold will stop, and Gst.IteratorResult.OK will be returned. Errors or resyncs will cause fold to return Gst.IteratorResult.ERROR or Gst.IteratorResult.RESYNC as appropriate.

The iterator will not be freed.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to fold over

`func` (Gst.IteratorFoldFunction) –

the fold function

`ret` (GObject.Value) –

the seed value passed to the fold function

`user_data` (variadic) –

user data passed to the fold function

Returns (Gst.IteratorResult) –

A Gst.IteratorResult, as described above.

MT safe.

#### gst_iterator_foreach

    GstIteratorResult
    gst_iterator_foreach (GstIterator * it,
                          GstIteratorForeachFunction func,
                          gpointer user_data)

Iterate over all element of it and call the given function func for each element.

Parameters:

`it` –

The GstIterator to iterate

`func` ( [scope call]) –

the function to call for each element.

`user_data` ( [closure]) –

user data passed to the function

Returns –

the result call to gst_iterator_fold. The iterator will not be freed.

MT safe.

#### Gst.Iterator.prototype.foreach

    function Gst.Iterator.prototype.foreach(func: Gst.IteratorForeachFunction, user_data: Object): {
        // javascript wrapper for 'gst_iterator_foreach'
    }

Iterate over all element of it and call the given function func for each element.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to iterate

`func` (Gst.IteratorForeachFunction) –

the function to call for each element.

`user_data` (Object) –

user data passed to the function

Returns (Gst.IteratorResult) –

the result call to Gst.Iterator.prototype.fold. The iterator will not be freed.

MT safe.

#### Gst.Iterator.foreach

    def Gst.Iterator.foreach (self, func, *user_data):
        #python wrapper for 'gst_iterator_foreach'

Iterate over all element of it and call the given function func for each element.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to iterate

`func` (Gst.IteratorForeachFunction) –

the function to call for each element.

`user_data` (variadic) –

user data passed to the function

Returns (Gst.IteratorResult) –

the result call to Gst.Iterator.fold. The iterator will not be freed.

MT safe.

#### gst_iterator_free

    gst_iterator_free (GstIterator * it)

Free the iterator.

MT safe.

Parameters:

`it` –

The GstIterator to free

#### Gst.Iterator.prototype.free

    function Gst.Iterator.prototype.free(): {
        // javascript wrapper for 'gst_iterator_free'
    }

Free the iterator.

MT safe.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to free

#### Gst.Iterator.free

    def Gst.Iterator.free (self):
        #python wrapper for 'gst_iterator_free'

Free the iterator.

MT safe.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to free

#### gst_iterator_next

    GstIteratorResult
    gst_iterator_next (GstIterator * it,
                       GValue * elem)

Get the next item from the iterator in elem.

Only when this function returns GST_ITERATOR_OK, elem will contain a valid value. elem must have been initialized to the type of the iterator or initialized to zeroes with g_value_unset. The caller is responsible for unsetting or resetting elem with g_value_unset or g_value_reset after usage.

When this function returns GST_ITERATOR_DONE, no more elements can be retrieved from it.

A return value of GST_ITERATOR_RESYNC indicates that the element list was concurrently updated. The user of it should call gst_iterator_resync to get the newly updated list.

A return value of GST_ITERATOR_ERROR indicates an unrecoverable fatal error.

Parameters:

`it` –

The GstIterator to iterate

`elem` ( [out]) –

pointer to hold next element

Returns –

The result of the iteration. Unset elem after usage.

MT safe.

#### Gst.Iterator.prototype.next

    function Gst.Iterator.prototype.next(): {
        // javascript wrapper for 'gst_iterator_next'
    }

Get the next item from the iterator in elem.

Only when this function returns Gst.IteratorResult.OK, elem will contain a valid value. elem must have been initialized to the type of the iterator or initialized to zeroes with GObject.Value.prototype.unset. The caller is responsible for unsetting or resetting elem with GObject.Value.prototype.unset or GObject.Value.prototype.reset after usage.

When this function returns Gst.IteratorResult.DONE, no more elements can be retrieved from it.

A return value of Gst.IteratorResult.RESYNC indicates that the element list was concurrently updated. The user of it should call Gst.Iterator.prototype.resync to get the newly updated list.

A return value of Gst.IteratorResult.ERROR indicates an unrecoverable fatal error.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to iterate

Returns a tuple made of:

(Gst.IteratorResult ) –

The result of the iteration. Unset elem after usage.

MT safe.

`elem` (GObject.Value ) –

The result of the iteration. Unset elem after usage.

MT safe.

#### Gst.Iterator.next

    def Gst.Iterator.next (self):
        #python wrapper for 'gst_iterator_next'

Get the next item from the iterator in elem.

Only when this function returns Gst.IteratorResult.OK, elem will contain a valid value. elem must have been initialized to the type of the iterator or initialized to zeroes with GObject.Value.unset. The caller is responsible for unsetting or resetting elem with GObject.Value.unset or GObject.Value.reset after usage.

When this function returns Gst.IteratorResult.DONE, no more elements can be retrieved from it.

A return value of Gst.IteratorResult.RESYNC indicates that the element list was concurrently updated. The user of it should call Gst.Iterator.resync to get the newly updated list.

A return value of Gst.IteratorResult.ERROR indicates an unrecoverable fatal error.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to iterate

Returns a tuple made of:

(Gst.IteratorResult ) –

The result of the iteration. Unset elem after usage.

MT safe.

`elem` (GObject.Value ) –

The result of the iteration. Unset elem after usage.

MT safe.

#### gst_iterator_push

    gst_iterator_push (GstIterator * it,
                       GstIterator * other)

Pushes other iterator onto it. All calls performed on it are forwarded to other. If other returns GST_ITERATOR_DONE, it is popped again and calls are handled by it again.

This function is mainly used by objects implementing the iterator next function to recurse into substructures.

When gst_iterator_resync is called on it, other will automatically be popped.

MT safe.

Parameters:

`it` –

The GstIterator to use

`other` –

The GstIterator to push

#### Gst.Iterator.prototype.push

    function Gst.Iterator.prototype.push(other: Gst.Iterator): {
        // javascript wrapper for 'gst_iterator_push'
    }

Pushes other iterator onto it. All calls performed on it are forwarded to other. If other returns Gst.IteratorResult.DONE, it is popped again and calls are handled by it again.

This function is mainly used by objects implementing the iterator next function to recurse into substructures.

When Gst.Iterator.prototype.resync is called on it, other will automatically be popped.

MT safe.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to use

`other` (Gst.Iterator) –

The Gst.Iterator to push

#### Gst.Iterator.push

    def Gst.Iterator.push (self, other):
        #python wrapper for 'gst_iterator_push'

Pushes other iterator onto it. All calls performed on it are forwarded to other. If other returns Gst.IteratorResult.DONE, it is popped again and calls are handled by it again.

This function is mainly used by objects implementing the iterator next function to recurse into substructures.

When Gst.Iterator.resync is called on it, other will automatically be popped.

MT safe.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to use

`other` (Gst.Iterator) –

The Gst.Iterator to push

#### gst_iterator_resync

    gst_iterator_resync (GstIterator * it)

Resync the iterator. this function is mostly called after gst_iterator_next returned GST_ITERATOR_RESYNC.

When an iterator was pushed on it, it will automatically be popped again with this function.

MT safe.

Parameters:

`it` –

The GstIterator to resync

#### Gst.Iterator.prototype.resync

    function Gst.Iterator.prototype.resync(): {
        // javascript wrapper for 'gst_iterator_resync'
    }

Resync the iterator. this function is mostly called after Gst.Iterator.prototype.next returned Gst.IteratorResult.RESYNC.

When an iterator was pushed on it, it will automatically be popped again with this function.

MT safe.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to resync

#### Gst.Iterator.resync

    def Gst.Iterator.resync (self):
        #python wrapper for 'gst_iterator_resync'

Resync the iterator. this function is mostly called after Gst.Iterator.next returned Gst.IteratorResult.RESYNC.

When an iterator was pushed on it, it will automatically be popped again with this function.

MT safe.

Parameters:

`it` (Gst.Iterator) –

The Gst.Iterator to resync

## Function Macros

### GST_ITERATOR

    #define GST_ITERATOR(it)                ((GstIterator*)(it))

Macro to cast to a GstIterator

Parameters:

`it` –

the GstIterator value

### GST_ITERATOR_COOKIE

    #define GST_ITERATOR_COOKIE(it)         (GST_ITERATOR(it)->cookie)

Macro to get the cookie of a GstIterator. The cookie of the iterator is the value of the master cookie when the iterator was created. Whenever the iterator is iterated, the value is compared to the value of the master cookie. If they are different, a concurrent modification happened to the iterator and a resync is needed.

Parameters:

`it` –

the GstIterator to get the cookie of

### GST_ITERATOR_LOCK

    #define GST_ITERATOR_LOCK(it)           (GST_ITERATOR(it)->lock)

Macro to get the lock protecting the datastructure being iterated.

Parameters:

`it` –

the GstIterator to get the lock of

### GST_ITERATOR_ORIG_COOKIE

    #define GST_ITERATOR_ORIG_COOKIE(it)    (GST_ITERATOR(it)->master_cookie)

Macro to get a pointer to where the master cookie is stored. The master cookie protects the structure being iterated and gets updated whenever the datastructure changes.

Parameters:

`it` –

the GstIterator to get the master cookie of

## Enumerations

### GstIteratorItem

The result of a GstIteratorItemFunction.

##### Members

`GST_ITERATOR_ITEM_SKIP` (0) –

Skip this item

`GST_ITERATOR_ITEM_PASS` (1) –

Return item

`GST_ITERATOR_ITEM_END` (2) –

Stop after this item.

### Gst.IteratorItem

The result of a Gst.IteratorItemFunction.

##### Members

`Gst.IteratorItem.SKIP` (0) –

Skip this item

`Gst.IteratorItem.PASS` (1) –

Return item

`Gst.IteratorItem.END` (2) –

Stop after this item.

### Gst.IteratorItem

The result of a Gst.IteratorItemFunction.

##### Members

`Gst.IteratorItem.SKIP` (0) –

Skip this item

`Gst.IteratorItem.PASS` (1) –

Return item

`Gst.IteratorItem.END` (2) –

Stop after this item.

### GstIteratorResult

The result of gst_iterator_next.

##### Members

`GST_ITERATOR_DONE` (0) –

No more items in the iterator

`GST_ITERATOR_OK` (1) –

An item was retrieved

`GST_ITERATOR_RESYNC` (2) –

Datastructure changed while iterating

`GST_ITERATOR_ERROR` (3) –

An error happened

### Gst.IteratorResult

The result of Gst.Iterator.prototype.next.

##### Members

`Gst.IteratorResult.DONE` (0) –

No more items in the iterator

`Gst.IteratorResult.OK` (1) –

An item was retrieved

`Gst.IteratorResult.RESYNC` (2) –

Datastructure changed while iterating

`Gst.IteratorResult.ERROR` (3) –

An error happened

### Gst.IteratorResult

The result of Gst.Iterator.next.

##### Members

`Gst.IteratorResult.DONE` (0) –

No more items in the iterator

`Gst.IteratorResult.OK` (1) –

An item was retrieved

`Gst.IteratorResult.RESYNC` (2) –

Datastructure changed while iterating

`Gst.IteratorResult.ERROR` (3) –

An error happened

## Callbacks

### GstIteratorCopyFunction

    (*GstIteratorCopyFunction) (const GstIterator * it,
                                GstIterator * copy)

This function will be called when creating a copy of it and should create a copy of all custom iterator fields or increase their reference counts.

Parameters:

`it` –

The original iterator

`copy` –

The copied iterator

### Gst.IteratorCopyFunction

    function Gst.IteratorCopyFunction(it: Gst.Iterator, copy: Gst.Iterator): {
        // javascript wrapper for 'GstIteratorCopyFunction'
    }

This function will be called when creating a copy of it and should create a copy of all custom iterator fields or increase their reference counts.

Parameters:

`it` (Gst.Iterator) –

The original iterator

`copy` (Gst.Iterator) –

The copied iterator

### Gst.IteratorCopyFunction

    def Gst.IteratorCopyFunction (it, copy):
        #python wrapper for 'GstIteratorCopyFunction'

This function will be called when creating a copy of it and should create a copy of all custom iterator fields or increase their reference counts.

Parameters:

`it` (Gst.Iterator) –

The original iterator

`copy` (Gst.Iterator) –

The copied iterator

### GstIteratorFoldFunction

    gboolean
    (*GstIteratorFoldFunction) (const GValue * item,
                                GValue * ret,
                                gpointer user_data)

A function to be passed to gst_iterator_fold.

Parameters:

`item` –

the item to fold

`ret` –

a GValue collecting the result

`user_data` –

data passed to gst_iterator_fold

Returns –

TRUE if the fold should continue, FALSE if it should stop.

### Gst.IteratorFoldFunction

    function Gst.IteratorFoldFunction(item: GObject.Value, ret: GObject.Value, user_data: Object): {
        // javascript wrapper for 'GstIteratorFoldFunction'
    }

A function to be passed to Gst.Iterator.prototype.fold.

Parameters:

`item` (GObject.Value) –

the item to fold

`ret` (GObject.Value) –

a GObject.Value collecting the result

`user_data` (Object) –

data passed to Gst.Iterator.prototype.fold

Returns (Number) –

TRUE if the fold should continue, FALSE if it should stop.

### Gst.IteratorFoldFunction

    def Gst.IteratorFoldFunction (item, ret, *user_data):
        #python wrapper for 'GstIteratorFoldFunction'

A function to be passed to Gst.Iterator.fold.

Parameters:

`item` (GObject.Value) –

the item to fold

`ret` (GObject.Value) –

a GObject.Value collecting the result

`user_data` (variadic) –

data passed to Gst.Iterator.fold

Returns (bool) –

TRUE if the fold should continue, FALSE if it should stop.

### GstIteratorForeachFunction

    (*GstIteratorForeachFunction) (const GValue * item,
                                   gpointer user_data)

A function that is called by gst_iterator_foreach for every element.

Parameters:

`item` –

The item

`user_data` –

User data

### Gst.IteratorForeachFunction

    function Gst.IteratorForeachFunction(item: GObject.Value, user_data: Object): {
        // javascript wrapper for 'GstIteratorForeachFunction'
    }

A function that is called by Gst.Iterator.prototype.foreach for every element.

Parameters:

`item` (GObject.Value) –

The item

`user_data` (Object) –

User data

### Gst.IteratorForeachFunction

    def Gst.IteratorForeachFunction (item, *user_data):
        #python wrapper for 'GstIteratorForeachFunction'

A function that is called by Gst.Iterator.foreach for every element.

Parameters:

`item` (GObject.Value) –

The item

`user_data` (variadic) –

User data

### GstIteratorFreeFunction

    (*GstIteratorFreeFunction) (GstIterator * it)

This function will be called when the iterator is freed.

Implementors of a GstIterator should implement this function and pass it to the constructor of the custom iterator. The function will be called with the iterator lock held.

Parameters:

`it` –

the iterator

### Gst.IteratorFreeFunction

    function Gst.IteratorFreeFunction(it: Gst.Iterator): {
        // javascript wrapper for 'GstIteratorFreeFunction'
    }

This function will be called when the iterator is freed.

Implementors of a Gst.Iterator should implement this function and pass it to the constructor of the custom iterator. The function will be called with the iterator lock held.

Parameters:

`it` (Gst.Iterator) –

the iterator

### Gst.IteratorFreeFunction

    def Gst.IteratorFreeFunction (it):
        #python wrapper for 'GstIteratorFreeFunction'

This function will be called when the iterator is freed.

Implementors of a Gst.Iterator should implement this function and pass it to the constructor of the custom iterator. The function will be called with the iterator lock held.

Parameters:

`it` (Gst.Iterator) –

the iterator

### GstIteratorItemFunction

    GstIteratorItem
    (*GstIteratorItemFunction) (GstIterator * it,
                                const GValue * item)

The function that will be called after the next item of the iterator has been retrieved. This function can be used to skip items or stop the iterator.

The function will be called with the iterator lock held.

Parameters:

`it` –

the iterator

`item` –

the item being retrieved.

Returns –

the result of the operation.

### Gst.IteratorItemFunction

    function Gst.IteratorItemFunction(it: Gst.Iterator, item: GObject.Value): {
        // javascript wrapper for 'GstIteratorItemFunction'
    }

The function that will be called after the next item of the iterator has been retrieved. This function can be used to skip items or stop the iterator.

The function will be called with the iterator lock held.

Parameters:

`it` (Gst.Iterator) –

the iterator

`item` (GObject.Value) –

the item being retrieved.

Returns (Gst.IteratorItem) –

the result of the operation.

### Gst.IteratorItemFunction

    def Gst.IteratorItemFunction (it, item):
        #python wrapper for 'GstIteratorItemFunction'

The function that will be called after the next item of the iterator has been retrieved. This function can be used to skip items or stop the iterator.

The function will be called with the iterator lock held.

Parameters:

`it` (Gst.Iterator) –

the iterator

`item` (GObject.Value) –

the item being retrieved.

Returns (Gst.IteratorItem) –

the result of the operation.

### GstIteratorNextFunction

    GstIteratorResult
    (*GstIteratorNextFunction) (GstIterator * it,
                                GValue * result)

The function that will be called when the next element of the iterator should be retrieved.

Implementors of a GstIterator should implement this function and pass it to the constructor of the custom iterator. The function will be called with the iterator lock held.

Parameters:

`it` –

the iterator

`result` –

a pointer to hold the next item

Returns –

the result of the operation.

### Gst.IteratorNextFunction

    function Gst.IteratorNextFunction(it: Gst.Iterator, result: GObject.Value): {
        // javascript wrapper for 'GstIteratorNextFunction'
    }

The function that will be called when the next element of the iterator should be retrieved.

Implementors of a Gst.Iterator should implement this function and pass it to the constructor of the custom iterator. The function will be called with the iterator lock held.

Parameters:

`it` (Gst.Iterator) –

the iterator

`result` (GObject.Value) –

a pointer to hold the next item

Returns (Gst.IteratorResult) –

the result of the operation.

### Gst.IteratorNextFunction

    def Gst.IteratorNextFunction (it, result):
        #python wrapper for 'GstIteratorNextFunction'

The function that will be called when the next element of the iterator should be retrieved.

Implementors of a Gst.Iterator should implement this function and pass it to the constructor of the custom iterator. The function will be called with the iterator lock held.

Parameters:

`it` (Gst.Iterator) –

the iterator

`result` (GObject.Value) –

a pointer to hold the next item

Returns (Gst.IteratorResult) –

the result of the operation.

### GstIteratorResyncFunction

    (*GstIteratorResyncFunction) (GstIterator * it)

This function will be called whenever a concurrent update happened to the iterated datastructure. The implementor of the iterator should restart the iterator from the beginning and clean up any state it might have.

Implementors of a GstIterator should implement this function and pass it to the constructor of the custom iterator. The function will be called with the iterator lock held.

Parameters:

`it` –

the iterator

### Gst.IteratorResyncFunction

    function Gst.IteratorResyncFunction(it: Gst.Iterator): {
        // javascript wrapper for 'GstIteratorResyncFunction'
    }

This function will be called whenever a concurrent update happened to the iterated datastructure. The implementor of the iterator should restart the iterator from the beginning and clean up any state it might have.

Implementors of a Gst.Iterator should implement this function and pass it to the constructor of the custom iterator. The function will be called with the iterator lock held.

Parameters:

`it` (Gst.Iterator) –

the iterator

### Gst.IteratorResyncFunction

    def Gst.IteratorResyncFunction (it):
        #python wrapper for 'GstIteratorResyncFunction'

This function will be called whenever a concurrent update happened to the iterated datastructure. The implementor of the iterator should restart the iterator from the beginning and clean up any state it might have.

Implementors of a Gst.Iterator should implement this function and pass it to the constructor of the custom iterator. The function will be called with the iterator lock held.

Parameters:

`it` (Gst.Iterator) –

the iterator

The results of the search are