# Gst::BufferListIterator Class Reference

An opaque iterator for a Gst::BufferList. More...

List of all members.

## Public Types

typedef sigc::slot < Glib::RefPtr< Gst::Buffer > , const Glib::RefPtr < Gst::Buffer >& > | SlotProcess
| For example, Glib::RefPtr<Gst::Buffer> on_process(const Glib::RefPtr<Gst::Buffer>& buffer);.

## Public Member Functions

| BufferListIterator ()
| Default constructor.
| BufferListIterator (GstBufferListIterator* castitem, bool take_ownership=true)
| C object constructor.
virtual | ~BufferListIterator ()
| Destructor.
GstBufferListIterator* | gobj ()
| Provides access to the underlying C object.
const GstBufferListIterator* | gobj () const
| Provides access to the underlying C object.
guint | n_buffers () const
| Returns the number of buffers left to iterate in the current group.
void | add (const Glib::RefPtr< Gst::Buffer >& buffer)
| Inserts buffer into the Gst::BufferList iterated with it.
void | add_group ()
| Inserts a new, empty group into the Gst::BufferList iterated with it.
Glib::RefPtr< Gst::Buffer > | next ()
| Returns the next buffer in the list iterated with it.
Glib::RefPtr< const Gst::Buffer > | next () const
| Returns the next buffer in the list iterated with it.
bool | next_group ()
| Advance the iterator it to the first buffer in the next group.
void | remove ()
| Removes the last buffer returned by list_iterator_next() from the Gst::BufferList iterated with it.
Glib::RefPtr< Gst::Buffer > | steal ()
| Returns the last buffer returned by list_iterator_next() without modifying the refcount of the buffer.
void | take (const Glib::RefPtr< Gst::Buffer >& buffer)
| Replaces the last buffer returned by list_iterator_next() with buffer in the Gst::BufferList iterated with it and takes ownership of buffer.
Glib::RefPtr< Gst::Buffer > | process (const SlotProcess& slot)
| Calls the given function for the last buffer returned by next().
Glib::RefPtr< Gst::Buffer > | merge_group ()
| Merge a buffer list group into a normal Gst::Buffer by copying its metadata and memcpying its data into consecutive memory.

## Protected Member Functions

void | set_gobject (GstBufferListIterator* castitem, bool take_ownership=true)

## Protected Attributes

GstBufferListIterator* | gobject_
bool | take_ownership

## Detailed Description

An opaque iterator for a Gst::BufferList.

## Member Typedef Documentation

typedef sigc::slot< Glib::RefPtr<Gst::Buffer>, const Glib::RefPtr<Gst::Buffer>& > Gst::BufferListIterator::SlotProcess

For example, Glib::RefPtr<Gst::Buffer> on_process(const Glib::RefPtr<Gst::Buffer>& buffer);.

A slot for processing the last buffer returned by Gst::BufferListIterator::next(). The slot can leave the buffer in the list, replace the buffer in the list or remove the buffer from the list, depending on the return value. If the slot returns 0, the buffer will be removed from the list, otherwise the buffer will be replaced with the returned buffer.

The last buffer returned by Gst::BufferListIterator::next() will be replaced with the buffer returned from the function. If 0 is returned, the buffer will be removed from the list. The list must be writable.

## Constructor & Destructor Documentation

Gst::BufferListIterator::BufferListIterator | ( |  | ) |

Default constructor.

Gst::BufferListIterator::BufferListIterator | ( | GstBufferListIterator * | castitem,
|  | bool | take_ownership = `true` |
| ) |  |  | `[explicit]`

C object constructor.

Parameters:

  | castitem | The C object.
  | take_ownership | Whether to destroy the C object with the wrapper or not.

virtual Gst::BufferListIterator::~BufferListIterator | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

void Gst::BufferListIterator::add | ( | const Glib::RefPtr< Gst::Buffer >& | buffer | ) |

Inserts buffer into the Gst::BufferList iterated with it.

The buffer is inserted into the current group, immediately before the buffer that would be returned by list_iterator_next(). The buffer is inserted before the implicit cursor, a subsequent call to list_iterator_next() will return the buffer after the inserted buffer, if any.

This function takes ownership of buffer.

Since gstreamermm 0.10:
  .24

Parameters:

  | buffer | A Gst::Buffer.

void Gst::BufferListIterator::add_group | ( |  | ) |

Inserts a new, empty group into the Gst::BufferList iterated with it.

The group is inserted immediately before the group that would be returned by list_iterator_next_group(). A subsequent call to list_iterator_next_group() will advance the iterator to the group after the inserted group, if any.

Since gstreamermm 0.10:
  .24

const GstBufferListIterator* Gst::BufferListIterator::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C object.

GstBufferListIterator* Gst::BufferListIterator::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C object.

Glib::RefPtr<Gst::Buffer> Gst::BufferListIterator::merge_group | ( |  | ) |

Merge a buffer list group into a normal Gst::Buffer by copying its metadata and memcpying its data into consecutive memory.

All buffers in the current group after the implicit cursor will be merged into one new buffer. The metadata of the new buffer will be a copy of the metadata of the buffer that would be returned by list_iterator_next(). If there is no buffer in the current group after the implicit cursor, `0` will be returned.

This function will not move the implicit cursor or in any other way affect the state of the iterator it or the list.

Since gstreamermm 0.10:
  .24

Returns:
  A new Gst::Buffer, gst_buffer_unref() after usage, or `0`.

guint Gst::BufferListIterator::n_buffers | ( |  | ) | const

Returns the number of buffers left to iterate in the current group.

I.e. the number of calls that can be made to list_iterator_next() before it returns `0`.

This function will not move the implicit cursor or in any other way affect the state of the iterator it.

Since gstreamermm 0.10:
  .24

Returns:
  The number of buffers left to iterate in the current group.

Glib::RefPtr<Gst::Buffer> Gst::BufferListIterator::next | ( |  | ) |

Returns the next buffer in the list iterated with it.

If the iterator is at the end of a group, `0` will be returned. This function may be called repeatedly to iterate through the current group.

The caller will not get a new ref to the returned Gst::Buffer and must not unref it.

Since gstreamermm 0.10:
  .24

Returns:
  The next buffer in the current group of the buffer list, or `0`.

Glib::RefPtr<const Gst::Buffer> Gst::BufferListIterator::next | ( |  | ) | const

Returns the next buffer in the list iterated with it.

If the iterator is at the end of a group, `0` will be returned. This function may be called repeatedly to iterate through the current group.

The caller will not get a new ref to the returned Gst::Buffer and must not unref it.

Since gstreamermm 0.10:
  .24

Returns:
  The next buffer in the current group of the buffer list, or `0`.

bool Gst::BufferListIterator::next_group | ( |  | ) |

Advance the iterator it to the first buffer in the next group.

If the iterator is at the last group, `false` will be returned. This function may be called repeatedly to iterate through the groups in a buffer list.

Since gstreamermm 0.10:
  .24

Returns:
  `true` if the iterator could be advanced to the next group, `false` if the iterator was already at the last group.

Glib::RefPtr<Gst::Buffer> Gst::BufferListIterator::process | ( | const SlotProcess & | slot | ) |

Calls the given function for the last buffer returned by next().

next() must have been called on it before this function is called. remove() and steal() must not have been called since the last call to next().

See the SlotProcess docs for more details.

Parameters:

  | slot | The slot to be called.

Returns:
  The return value from slot.

void Gst::BufferListIterator::remove | ( |  | ) |

Removes the last buffer returned by list_iterator_next() from the Gst::BufferList iterated with it.

list_iterator_next() must have been called on it before this function is called. This function can only be called once per call to list_iterator_next().

The removed buffer is unreffed.

Since gstreamermm 0.10:
  .24

void Gst::BufferListIterator::set_gobject | ( | GstBufferListIterator * | castitem,
|  | bool | take_ownership = `true` |
| ) |  |  | `[protected]`

Glib::RefPtr<Gst::Buffer> Gst::BufferListIterator::steal | ( |  | ) |

Returns the last buffer returned by list_iterator_next() without modifying the refcount of the buffer.

Since gstreamermm 0.10:
  .24

Returns:
  The last buffer returned by list_iterator_next().

void Gst::BufferListIterator::take | ( | const Glib::RefPtr< Gst::Buffer >& | buffer | ) |

Replaces the last buffer returned by list_iterator_next() with buffer in the Gst::BufferList iterated with it and takes ownership of buffer.

list_iterator_next() must have been called on it before this function is called. list_iterator_remove() must not have been called since the last call to list_iterator_next().

This function unrefs the replaced buffer if it has not been stolen with list_iterator_steal() and takes ownership of buffer (i.e. the refcount of buffer is not increased).

Since gstreamermm 0.10:
  .24

Parameters:

  | buffer | A Gst::Buffer.

## Member Data Documentation

GstBufferListIterator* Gst::BufferListIterator::gobject_ `[protected]`

bool Gst::BufferListIterator::take_ownership `[protected]`

The documentation for this class was generated from the following file:

- gstreamermm/bufferlist.h