# Gst::BufferList Class Reference

A grouped scatter data buffer type for data-passing. More...

Inherits Gst::MiniObject.

Collaboration diagram for Gst::BufferList:
[legend]

List of all members.

## Public Types

typedef sigc::slot < Gst::BufferListItem, Glib::RefPtr< Gst::Buffer > &, guint, guint > | SlotForeach
| For example, Gst::BufferListItem on_foreach(const Glib::RefPtr<Gst::Buffer>& buffer, guint group, guint idx);.

## Public Member Functions

virtual | ~BufferList ()
GstBufferList* | gobj ()
| Provides access to the underlying C GstMiniObject.
const GstBufferList* | gobj () const
| Provides access to the underlying C GstMiniObject.
GstBufferList* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool | is_writable () const
| Tests if you can safely add buffers and groups into a buffer list.
Glib::RefPtr< BufferList > | create_writable ()
| Makes a writable buffer list from the buffer list.
guint | n_groups () const
void | foreach (const SlotForeach& slot)
| Call slot for each buffer in list.
Glib::RefPtr< Gst::Buffer > | get (guint group, guint idx)
| Get the buffer at idx in group.
Glib::RefPtr< const Gst::Buffer > | get (guint group, guint idx) const
| Get the buffer at idx in group.
void | iterate (BufferListIterator& result)
| Iterate the buffers in the buffer list.

## Static Public Member Functions

static Glib::RefPtr< BufferList > | create ()
| Creates a new, empty Gst::BufferList.

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gst::BufferList > | wrap (GstBufferList* object, bool take_copy=false)

## Detailed Description

A grouped scatter data buffer type for data-passing.

Buffer lists are units of grouped scatter/gather data transfer in GStreamer.

Buffer lists are created with create() and filled with data using a Gst::BufferListIterator. The iterator has no current buffer; its cursor position lies between buffers, immediately before the buffer that would be returned by Gst::BufferListIterator::next(). After iterating to the end of a group the iterator must be advanced to the next group by a call to Gst::BufferListIterator::next_group() before any further calls to Gst::BufferListIterator::next() can return buffers again. The cursor position of a newly created iterator lies before the first group; a call to Gst::BufferListIterator::next_group() is necessary before calls to Gst::BufferListIterator::next() can return buffers.

For more details, see the C API docs.

## Member Typedef Documentation

typedef sigc::slot< Gst::BufferListItem, Glib::RefPtr<Gst::Buffer>&, guint, guint> Gst::BufferList::SlotForeach

For example, Gst::BufferListItem on_foreach(const Glib::RefPtr<Gst::Buffer>& buffer, guint group, guint idx);.

A slot that will be called from foreach(). The buffer field will be a reference to the buffer at idx in group.

When this function returns Gst::BUFFER_LIST_CONTINUE, the next buffer will be returned. When Gst::BUFFER_LIST_SKIP_GROUP is returned, all remaining buffers in the current group will be skipped and the first buffer of the next group is returned (if any). When Gst::BUFFER_LIST_END is returned, foreach() will return.

When the buffer is set to 0, the item will be removed from the bufferlist. When the buffer has been made writable, the new buffer reference can be assigned to the buffer.

## Constructor & Destructor Documentation

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

## Member Function Documentation

static Glib::RefPtr<BufferList> Gst::BufferList::create | ( |  | ) | `[static]`

Creates a new, empty Gst::BufferList.

The caller is responsible for unreffing the returned Gst::BufferList.

Since gstreamermm 0.10:
  .24

Returns:
  The new Gst::BufferList. gst_buffer_list_unref() after usage.

Glib::RefPtr<BufferList> Gst::BufferList::create_writable | ( |  | ) |

Makes a writable buffer list from the buffer list.

If the buffer list is already writable, this will simply return the same buffer list. A copy will otherwise be made.

Returns:
  The same buffer list if it is writable, otherwise a new copy.

Since 0.10.24

Reimplemented from Gst::MiniObject.

void Gst::BufferList::foreach | ( | const SlotForeach & | slot | ) |

Call slot for each buffer in list.

slot can modify the passed buffer pointer or its contents. The return value of slot define if this function returns or if the remaining buffers in a group should be skipped.

Parameters:

  | slot | A SlotForeach to call on each buffer.

Since 0.10.24

Glib::RefPtr<Gst::Buffer> Gst::BufferList::get | ( | guint | group,
|  | guint | idx |
| ) |  |  |

Get the buffer at idx in group.

Note that this function is not efficient for iterating over the entire list. Use an iterator or list_foreach() instead.

Since gstreamermm 0.10:
  .24

Parameters:

  | group | The group.
  | idx | The index in group.

Returns:
  The buffer at idx in group or `0` when there is no buffer. The buffer remains valid as long as list is valid.

Glib::RefPtr<const Gst::Buffer> Gst::BufferList::get | ( | guint | group,
|  | guint | idx |
| ) |  |  | const

Get the buffer at idx in group.

Note that this function is not efficient for iterating over the entire list. Use an iterator or list_foreach() instead.

Since gstreamermm 0.10:
  .24

Parameters:

  | group | The group.
  | idx | The index in group.

Returns:
  The buffer at idx in group or `0` when there is no buffer. The buffer remains valid as long as list is valid.

const GstBufferList* Gst::BufferList::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GstMiniObject.

Reimplemented from Gst::MiniObject.

GstBufferList* Gst::BufferList::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GstMiniObject.

Reimplemented from Gst::MiniObject.

GstBufferList* Gst::BufferList::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gst::MiniObject.

bool Gst::BufferList::is_writable | ( |  | ) | const

Tests if you can safely add buffers and groups into a buffer list.

Returns:
  `true` if the buffer list is writable, `false` otherwise.

Since 0.10.24

Reimplemented from Gst::MiniObject.

void Gst::BufferList::iterate | ( | BufferListIterator& | result | ) |

Iterate the buffers in the buffer list.

Parameters:

  | result | A place in which to store the iterator. Sine 0.10.24.

guint Gst::BufferList::n_groups | ( |  | ) | const

## Friends And Related Function Documentation

Glib::RefPtr< Gst::BufferList > wrap | ( | GstBufferList * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

Parameters:

  | object | The C instance
  | take_copy | false if the result should take ownership of the C instance. true if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

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

- gstreamermm/bufferlist.h