Iterator

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, Value.getObject), 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:

1 
2 GstIterator *it = _get_iterator(object);
3 GValue item = G_VALUE_INIT;
4 done = FALSE;
5 while (!done) {
6 switch (gst_iterator_next (it, &item)) {
7 case GST_ITERATOR_OK:
8 ...get/use/change item here...
9 g_value_reset (&item);
10 break;
11 case GST_ITERATOR_RESYNC:
12 ...rollback changes to items...
13 gst_iterator_resync (it);
14 break;
15 case GST_ITERATOR_ERROR:
16 ...wrong parameters were given...
17 done = TRUE;
18 break;
19 case GST_ITERATOR_DONE:
20 done = TRUE;
21 break;
22 }
23 }
24 g_value_unset (&item);
25 gst_iterator_free (it);

Constructors

this
this(GstIterator* gstIterator, bool ownedRef = false)

Sets our main struct and passes it to the parent class.

this
this(uint size, GType type, Mutex lock, uint* masterCookie, 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.

this
this(GType type, Mutex lock, uint* masterCookie, ref ListG list, ObjectG owner, GstIteratorItemFunction item)

Create a new iterator designed for iterating list.

this
this(GType type, Value object)

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

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

copy
Iterator copy()

Copy the iterator and its state.

filter
Iterator filter(GCompareFunc func, Value userData)

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.

findCustom
bool findCustom(GCompareFunc func, out Value elem, void* userData)

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.

fold
GstIteratorResult fold(GstIteratorFoldFunction func, Value ret, void* userData)

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.

foreac
GstIteratorResult foreac(GstIteratorForeachFunction func, void* userData)

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

free
void free()

Free the iterator.

getIteratorStruct
GstIterator* getIteratorStruct(bool transferOwnership = false)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

next
GstIteratorResult next(out Value elem)

Get the next item from the iterator in elem.

push
void push(Iterator 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.

resync
void resync()

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

Static functions

getType
GType getType()

Variables

gstIterator
GstIterator* gstIterator;

the main Gtk struct

Meta