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, gobject.value.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:

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);

Members

Functions

copy
gst.iterator.Iterator copy()

Copy the iterator and its state.

filter
gst.iterator.Iterator filter(glib.types.CompareFunc func, gobject.value.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 #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.

fold
gst.types.IteratorResult fold(gst.types.IteratorFoldFunction func, gobject.value.Value ret)

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.

foreach_
gst.types.IteratorResult foreach_(gst.types.IteratorForeachFunction func)

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

next
gst.types.IteratorResult next(gobject.value.Value elem)

Get the next item from the iterator in elem.

push
void push(gst.iterator.Iterator other)

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

resync
void resync()

Resync the iterator. this function is mostly called after gst.iterator.Iterator.next returned gst.types.IteratorResult.Resync.

Static functions

newSingle
gst.iterator.Iterator newSingle(gobject.types.GType type, gobject.value.Value 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.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.