Iterator

Description 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. The basic use pattern of an iterator is as follows: Last reviewed on 2005-11-09 (0.9.4)

Constructors

this
this(GstIterator* gstIterator)

Sets our main struct and passes it to the parent class

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

this
this(GType type, Mutex lock, uint* masterCookie, GList** list, void* owner, GstIteratorItemFunction item, GstIteratorDisposeFunction free)

Create a new iterator designed for iterating list.

Members

Functions

filter
Iterator filter(GCompareFunc func, void* userData)

Create a new iterator from an existing iterator. The new iterator will only return those elements that match the given compare function func. func should return 0 for elements that should be included in the iterator. When this iterator is freed, it will also be freed.

findCustom
void* findCustom(GCompareFunc func, void* userData)

Find the first element in it that matches the compare function func. func should return 0 when the element is found. The iterator will not be freed. This function will return NULL if an error or resync happened to the iterator.

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

Folds func over the elements of iter. That is to say, proc will be called as proc (object, ret, user_data) for each object in iter. 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 foreach and 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.

foreac
GstIteratorResult foreac(GFunc func, void* userData)

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

free
void free()

Free the iterator. MT safe.

getIteratorStruct
GstIterator* getIteratorStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

next
GstIteratorResult next(void** elem)

Get the next item from the iterator. For iterators that return refcounted objects, the returned object will have its refcount increased and should therefore be unreffed after usage.

push
void push(Iterator other)

Pushes other iterator onto it. All calls performed on it are forwarded tot 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. MT safe.

resync
void resync()

Resync the iterator. this function is mostly called after gst_iterator_next() returned GST_ITERATOR_RESYNC. MT safe.

Variables

gstIterator
GstIterator* gstIterator;

the main Gtk struct

Meta