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, 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

Variables

GstReserved
void*[4] GstReserved;
cookie
uint cookie;

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

copy
GstIteratorCopyFunction copy;

The function to copy the iterator

free
GstIteratorFreeFunction free;

The function to call when the iterator is freed

item
GstIteratorItemFunction item;

The function to be called for each item retrieved

lock
GMutex* lock;

The lock protecting the data structure and the cookie.

masterCookie
uint* masterCookie;

A pointer to the master cookie.

next
GstIteratorNextFunction next;

The function to get the next item in the iterator

pushed
GstIterator* pushed;

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

resync
GstIteratorResyncFunction resync;

The function to call when a resync is needed.

size
uint size;

the size of the iterator

type
GType type;

The type of the object that this iterator will return