Gst::BufferList Class Reference

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

`#include <gstreamermm/bufferlist.h>`

Inheritance diagram for Gst::BufferList:
[legend]

## Public Types

typedef sigc::slot< bool, Glib::RefPtr< Gst::Buffer >&, guint > | SlotForeach
| For example, Gst::BufferListItem on_foreach(const Glib::RefPtr<Gst::Buffer>& buffer, guint group, guint idx);. More...
Public Types inherited from Gst::MiniObject
typedef sigc::slot< void > | SlotFinalizer

## Public Member Functions

void | reference () const
| Increment the reference count for this object. More...
void | unreference () const
| Decrement the reference count for this object. More...
GstBufferList* | gobj ()
| Provides access to the underlying C instance. More...
const GstBufferList* | gobj () const
| Provides access to the underlying C instance. More...
GstBufferList* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
| BufferList ()=delete
| BufferList (const BufferList&)=delete
BufferList& | operator= (const BufferList&)=delete
void | remove (guint idx, guint length)
| Remove length buffers starting from idx in list. More...
Glib::RefPtr< Gst::Buffer > | remove (guint idx)
| Get the buffer at idx. More...
guint | length () const
| Returns the number of buffers in list. More...
void | copy () const
| Create a shallow copy of the given buffer list. More...
void | copy_deep () const
| Create a copy of the given buffer list. More...
void | insert (gint idx, Glib::RefPtr< Gst::Buffer >&& buffer)
| Insert buffer at idx in list. More...
void | insert (gint idx, const Glib::RefPtr< Gst::Buffer >& buffer)
| A insert() convenience overload. Allows to re-use buffer parameter after function call. More...
void | foreach (const SlotForeach& slot)
| Call slot for each buffer in list. More...
Glib::RefPtr< Gst::Buffer > | get (guint idx)
| Get the buffer at idx. More...
Glib::RefPtr< const Gst::Buffer > | get (guint idx) const
| Get the buffer at idx. More...
Public Member Functions inherited from Gst::MiniObject
void | reference () const
| Increment the reference count for this object. More...
void | unreference () const
| Decrement the reference count for this object. More...
GstMiniObject* | gobj ()
| Provides access to the underlying C instance. More...
const GstMiniObject* | gobj () const
| Provides access to the underlying C instance. More...
GstMiniObject* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
| MiniObject ()=delete
| MiniObject (const MiniObject&)=delete
MiniObject& | operator= (const MiniObject&)=delete
| ~MiniObject ()
guint | get_flags () const
void | set_flags (const guint& value)
gint | get_refcount () const
gint | get_lockstate () const
bool | lock (LockFlags flags)
| Lock the mini-object with the specified access mode in flags. More...
void | unlock (LockFlags flags)
| Unlock the mini-object with the specified access mode in flags. More...
bool | is_writable () const
| If mini_object has the LOCKABLE flag set, check if the current EXCLUSIVE lock on object is the only one, this means that changes to the object will not be visible to any other object. More...
Glib::RefPtr< MiniObject > | create_writable ()
| Checks if a mini-object is writable. More...
void | set_qdata (GQuark quark, QuarkData* data)
| This sets an opaque, named pointer on a miniobject. More...
QuarkData* | get_qdata (GQuark quark) const
| This function gets back user data pointers stored via set_qdata(). More...
QuarkData* | steal_qdata (GQuark quark)
| This function gets back user data pointers stored via set_qdata() and removes the data from object without invoking its destroy() function (if any was set). More...
void | add_finalize_notifier (const SlotFinalizer& slot)
| Adds notifier when mini object is finalized. More...
void | remove_finalize_notifier ()
| Remove finalize notifier. More...

## Static Public Member Functions

static Glib::RefPtr< BufferList > | create ()

## Protected Member Functions

void | operator delete (void*, std::size_t)
Protected Member Functions inherited from Gst::MiniObject
void | operator delete (void*, std::size_t)

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gst::BufferList > | wrap (GstBufferList* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gst::MiniObject
Glib::RefPtr< Gst::MiniObject > | wrap (GstMiniObject* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

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

## SlotForeach

typedef sigc::slot< bool, Glib::RefPtr<Gst::Buffer>&, 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

## BufferList() [1/2]

Gst::BufferList::BufferList | ( |  | ) |

delete

## BufferList() [2/2]

Gst::BufferList::BufferList | ( | const BufferList& |  | ) |

delete

## Member Function Documentation

## copy()

void Gst::BufferList::copy | ( |  | ) | const

Create a shallow copy of the given buffer list.

This will make a newly allocated copy of the source list with copies of buffer pointers. The refcount of buffers pointed to will be increased by one.

Returns
  A new copy of list.

## copy_deep()

void Gst::BufferList::copy_deep | ( |  | ) | const

Create a copy of the given buffer list.

This will make a newly allocated copy of the buffer that the source buffer list contains.

Returns
  A new copy of list.

## create()

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

static

## foreach()

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

## get() [1/2]

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

Get the buffer at idx.

Parameters

  idx | The index.

Returns
  The buffer at idx in group or `nullptr` when there is no buffer. The buffer remains valid as long as list is valid and buffer is not removed from the list.

## get() [2/2]

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

Get the buffer at idx.

Parameters

  idx | The index.

Returns
  The buffer at idx in group or `nullptr` when there is no buffer. The buffer remains valid as long as list is valid and buffer is not removed from the list.

## gobj() [1/2]

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

Provides access to the underlying C instance.

## gobj() [2/2]

const GstBufferList* Gst::BufferList::gobj | ( |  | ) | const

Provides access to the underlying C instance.

## gobj_copy()

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

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

## insert() [1/2]

void Gst::BufferList::insert | ( | gint | idx,
|  | Glib::RefPtr< Gst::Buffer >&& | buffer
| ) |  |

Insert buffer at idx in list.

Other buffers are moved to make room for this new buffer.

A -1 value for idx will append the buffer at the end.

Parameters

  idx | The index.
  buffer | A Gst::Buffer.

## insert() [2/2]

void Gst::BufferList::insert | ( | gint | idx,
|  | const Glib::RefPtr< Gst::Buffer >& | buffer
| ) |  |

A insert() convenience overload. Allows to re-use buffer parameter after function call.

## length()

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

Returns the number of buffers in list.

Returns
  The number of buffers in the buffer list.

## operator delete()

void Gst::BufferList::operator delete | ( | void * | ,
|  | std::size_t |
| ) |  |

protected

## operator=()

BufferList& Gst::BufferList::operator= | ( | const BufferList& |  | ) |

delete

## reference()

void Gst::BufferList::reference | ( |  | ) | const

Increment the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

## remove() [1/2]

void Gst::BufferList::remove | ( | guint | idx,
|  | guint | length
| ) |  |

Remove length buffers starting from idx in list.

The following buffers are moved to close the gap.

Parameters

  idx | The index.
  length | The amount to remove.

## remove() [2/2]

Glib::RefPtr<Gst::Buffer> Gst::BufferList::remove | ( | guint | idx | ) |

Get the buffer at idx.

Parameters

  idx | The index.

Returns
  The buffer at idx in group or `nullptr` when there is no buffer. The buffer remains valid as long as list is valid and buffer is not removed from the list.

## unreference()

void Gst::BufferList::unreference | ( |  | ) | const

Decrement the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

## Friends And Related Function Documentation

## wrap()

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

related

A Glib::wrap() method for this object.

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.