Gjsify LogoGjsify Logo

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

Hierarchy

  • Iterator

Index

Constructors

Properties

cookie: number

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

field

The function to copy the iterator

field

The function to call when the iterator is freed

field

The function to be called for each item retrieved

field
lock: GLib.Mutex

The lock protecting the data structure and the cookie.

field
master_cookie: number

A pointer to the master cookie.

field

The function to get the next item in the iterator

field
pushed: Gst.Iterator

The iterator that is currently pushed with gst_iterator_push()

field

The function to call when a resync is needed.

field
size: number

the size of the iterator

field
type: GType<unknown>

The type of the object that this iterator will return

field
name: string

Methods

  • 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

    • func: CompareFunc

      the compare function to select elements

    • user_data: any

      user data passed to the compare function

    Returns Gst.Iterator

  • 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

    Returns [boolean, any]

  • 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

    Returns Gst.IteratorResult

  • 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

    Returns void

  • 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<unknown>

      #GType of the passed object

    • object: any

      object that this iterator should return

    Returns Gst.Iterator

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method