gstreamermm 1.4.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gst::Buffer Class Reference

SECTION:gstbuffer : Data-passing buffer type : #GstPad, #GstMiniObject, #GstMemory, #GstMeta, #GstBufferPool. More...

Inheritance diagram for Gst::Buffer:
[legend]
Collaboration diagram for Gst::Buffer:
[legend]

## 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...
GstBuffer* | gobj ()
| Provides access to the underlying C instance. More...
const GstBuffer* | gobj () const
| Provides access to the underlying C instance. More...
GstBuffer* | 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...
Glib::RefPtr< Gst::Buffer > | copy () const
| Create a copy of the given buffer. More...
Glib::RefPtr< Gst::Buffer > | copy_region (Gst::BufferCopyFlags flags, gsize offset, gsize size)
| Creates a sub-buffer from parent at offset and size. More...
Glib::RefPtr< Gst::Buffer > | create_writable ()
| Makes a writable buffer from the given buffer. More...
Glib::RefPtr< Gst::Memory > | get_memory (guint idx) const
| Get the memory block at index idx in buffer. More...
gsize | get_size () const
| Get the total size of the memory blocks in buffer. More...
gsize | get_sizes (gsize& offset, gsize& max_size) const
| Get the total size of the memory blocks in b. More...
gsize | get_sizes_range (guint idx, gint length, gsize& offset, gsize& max_size) const
| Get the total size of length memory blocks stating from idx in buffer. More...
bool | resize_range (guint idx, gint length, gssize offset, gssize size)
| Set the total size of the length memory blocks starting at idx in buffer. More...
void | resize (gssize offset, gssize size)
| Set the offset and total size of the memory blocks in buffer. More...
void | set_size (gssize size)
| Set the total size of the memory blocks in buffer. More...
Glib::RefPtr< Gst::Memory > | peek_memory (guint idx)
| Get the memory block at idx in buffer. More...
guint | n_memory () const
| Get the amount of memory blocks that this buffer has. More...
void | insert_memory (guint idx, Glib::RefPtr< Gst::Memory >& mem)
| Insert the memory block to at . More...
Glib::RefPtr< Gst::Memory > | get_all_memory () const
| Get all the memory block in buffer. More...
gsize | fill (gsize offset, gconstpointer src, gsize size)
| Copy size bytes from src to buffer at offset. More...
Glib::RefPtr< Gst::Buffer > | append (const Glib::RefPtr< Gst::Buffer >& buf) const
| Append all the memory from buf2 to buf1. More...
Glib::RefPtr< Gst::Buffer > | append_region (const Glib::RefPtr< Gst::Buffer >& buf, gssize offset, gssize size) const
| Append size bytes at offset from buf2 to buf1. More...
void | replace_memory_range (guint idx, gint length, Glib::RefPtr< Gst::Memory >& mem)
| Replaces length memory blocks in buffer starting at idx with mem. More...
Glib::RefPtr< Gst::Memory > | get_memory_range (guint idx, gint length)
| Get length memory blocks in buffer starting at idx. More...
void | remove_memory_range (guint idx, gint length)
| Remove length memory blocks in buffer starting from idx. More...
bool | find_memory (gsize offset, gsize size, guint& idx, guint& length, gsize& skip)
| Find the memory blocks that span size bytes starting from offset in buffer. More...
void | prepend_memory (Glib::RefPtr< Gst::Memory >& mem)
| Prepend the memory block to . More...
void | append_memory (Glib::RefPtr< Gst::Memory >& mem)
| Append the memory block to . More...
void | remove_memory (guint idx)
| Remove the memory block in b at index i. More...
void | remove_all_memory ()
| Remove all the memory blocks in buffer. More...
gsize | memset (gsize offset, guint8 val, gsize size)
| Fill buf with size bytes with val starting from offset. More...
void | replace_memory (guint idx, Glib::RefPtr< Gst::Memory >& mem)
| Replaces the memory block at index idx in buffer with mem. More...
void | replace_all_memory (Glib::RefPtr< Gst::Memory >& mem)
| Replaces all memory in buffer with mem. More...
gsize | extract (gsize offset, gpointer dest, gsize size)
| Copy size bytes starting from offset in buffer to dest. More...
void | extract_dup (gsize offset, gsize size, gpointer& dest, gsize& dest_size)
| Extracts a copy of at most size bytes the data at offset into a Bytes. More...
int | memcmp (gsize offset, gconstpointer mem, gsize size)
| Compare size bytes starting from offset in buffer with the memory in mem. More...
ClockTime | get_pts () const
void | set_pts (const ClockTime& value)
ClockTime | get_dts () const
void | set_dts (const ClockTime& value)
ClockTime | get_duration () const
| Get duration of this buffer. More...
void | set_duration (const ClockTime& value)
bool | map (const Glib::RefPtr< Gst::MapInfo >& info, MapFlags flags)
| This function fills info with the Gst::MapInfo of all merged memory blocks in buffer. More...
bool | map_range (guint idx, gint length, const Glib::RefPtr< Gst::MapInfo >& info, MapFlags flags)
| This function fills info with the Gst::MapInfo of length merged memory blocks starting at idx in buffer. More...
void | unmap (const Glib::RefPtr< Gst::MapInfo >& info)
| Release the memory previously mapped with gst_buffer_map(). More...
guint64 | get_offset () const
| Get the offset of this buffer. More...
guint64 | get_offset_end () const
| Get the offset end of this buffer. 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 ()
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< Buffer > | create ()
static void | copy_into (const Glib::RefPtr< Gst::Buffer >& destination_buffer, const Glib::RefPtr< Gst::Buffer >& source_buffer, BufferCopyFlags flags, gsize offset, gsize size)
| Copies the information from src into dest. More...
static Glib::RefPtr< Gst::Buffer > | create (guint size)
static guint64 | offset_none ()
| Constant for no-offset return results. More...

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

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gst::Buffer > | wrap (GstBuffer* 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...

## Additional Inherited Members
Public Types inherited from Gst::MiniObject
typedef sigc::slot< void > | SlotFinalizer

## Detailed Description

SECTION:gstbuffer : Data-passing buffer type : #GstPad, #GstMiniObject, #GstMemory, #GstMeta, #GstBufferPool.

Buffers are the basic unit of data transfer in GStreamer. They contain the timing and offset along with other arbitrary metadata that is associated with the #GstMemory blocks that the buffer contains.

Buffers are usually created with Gst::Buffer::create. After a buffer has been created one will typically allocate memory for it and add it to the buffer. The following example creates a buffer that can hold a given video frame with a given width, height and bits per plane.

Buffers can contain a list of Gst::Memory objects. You can retrieve how many memory objects with n_memory() and you can get a pointer to memory with peek_memory()

A buffer will usually have timestamps, and a duration, but neither of these are guaranteed (they may be set to #GST_CLOCK_TIME_NONE). Whenever a meaningful value can be given for these, they should be set. The timestamps and duration are measured in nanoseconds (they are Gst::ClockTime values).

The buffer DTS refers to the timestamp when the buffer should be decoded and is usually monotonically increasing. The buffer PTS refers to the timestamp when the buffer content should be presented to the user and is not always monotonically increasing.

A buffer can also have one or both of a start and an end offset. These are media-type specific. For video buffers, the start offset will generally be the frame number. For audio buffers, it will be the number of samples produced so far. For compressed data, it could be the byte offset in a source or destination file. Likewise, the end offset will be the offset of the end of the buffer. These can only be meaningfully interpreted if you know the media type of the buffer (the preceeding CAPS event). Either or both can be set to Gst::BUFFER_OFFSET_NONE.

To efficiently create a smaller buffer out of an existing one, you can use copy_region(). This method tries to share the memory objects between the two buffers.

If a plug-in wants to modify the buffer data or metadata in-place, it should first obtain a buffer that is safe to modify by using create_writable(). This function is optimized so that a copy will only be made when it is necessary.

Several flags of the buffer can be set and unset with the GST_BUFFER_FLAG_SET() and GST_BUFFER_FLAG_UNSET() macros. Use GST_BUFFER_FLAG_IS_SET() to test if a certain Gst::BufferFlag is set.

Buffers can be efficiently merged into a larger buffer with append(). Copying of memory will only be done when absolutely needed.

Arbitrary extra metadata can be set on a buffer with add_meta(). Metadata can be retrieved with get_meta(). See also Gst::Meta

An element should either unref the buffer or push it out on a src pad using Gst::Pad::push() (see Gst::Pad).

## Constructor & Destructor Documentation

Gst::Buffer::Buffer | ( |  | ) |
| protected

## Member Function Documentation

Glib::RefPtr<Gst::Buffer> Gst::Buffer::append | ( | const Glib::RefPtr< Gst::Buffer >& | buf | ) | const

Append all the memory from buf2 to buf1.

The result buffer will contain a concatenation of the memory of buf1 and buf2.

Parameters

  buf2 | The second source Gst::Buffer to append.

Returns
  The new Gst::Buffer that contains the memory of the two source buffers.

void Gst::Buffer::append_memory | ( | Glib::RefPtr< Gst::Memory >& | mem | ) |

Append the memory block to .

This function takes ownership of and thus doesn't increase its refcount.

This function is identical to insert_memory() with an index of -1. See insert_memory() for more details.

Parameters

  mem | a Gst::Memory.

Glib::RefPtr<Gst::Buffer> Gst::Buffer::append_region | ( | const Glib::RefPtr< Gst::Buffer >& | buf,
|  | gssize | offset,
|  | gssize | size
| ) |  | const

Append size bytes at offset from buf2 to buf1.

The result buffer will contain a concatenation of the memory of buf1 and the requested region of buf2.

Parameters

  buf2 | The second source Gst::Buffer to append.
  offset | The offset in buf2.
  size | The size or -1 of buf2.

Returns
  The new Gst::Buffer that contains the memory of the two source buffers.

Glib::RefPtr<Gst::Buffer> Gst::Buffer::copy | ( |  | ) | const

Create a copy of the given buffer.

This will also make a newly allocated copy of the data the source buffer contains.

Returns
  The Gst::Buffer copy.

static void Gst::Buffer::copy_into | ( | const Glib::RefPtr< Gst::Buffer >& | destination_buffer,
|  | const Glib::RefPtr< Gst::Buffer >& | source_buffer,
|  | BufferCopyFlags | flags,
|  | gsize | offset,
|  | gsize | size
| ) |  |
| static

Copies the information from src into dest.

If dest already contains memory and flags contains GST_BUFFER_COPY_MEMORY, the memory from src will be appended to dest.

flags indicate which fields will be copied.

Parameters

  src | A source Gst::Buffer.
  flags | Flags indicating what metadata fields should be copied.
  offset | Offset to copy from.
  size | Total size to copy. If -1, all data is copied.

Returns
  `true` if the copying succeeded, `false` otherwise.

Glib::RefPtr<Gst::Buffer> Gst::Buffer::copy_region | ( | Gst::BufferCopyFlags | flags,
|  | gsize | offset,
|  | gsize | size
| ) |  |

Creates a sub-buffer from parent at offset and size.

This sub-buffer uses the actual memory space of the parent buffer. This function will copy the offset and timestamp fields when the offset is 0. If not, they will be set to Gst::CLOCK_TIME_NONE and Gst::BUFFER_OFFSET_NONE. If offset equals 0 and size equals the total size of buffer, the duration and offset end fields are also copied. If not they will be set to Gst::CLOCK_TIME_NONE and Gst::BUFFER_OFFSET_NONE.

MT safe.

Parameters

  flags | The Gst::BufferCopyFlags.
  offset | The offset into parent Gst::Buffer at which the new sub-buffer begins.
  size | The size of the new Gst::Buffer sub-buffer, in bytes.

Returns
  The new Gst::Buffer or `0` if the arguments were invalid.

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

static Glib::RefPtr<Gst::Buffer> Gst::Buffer::create | ( | guint | size | ) |
| static

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

Makes a writable buffer from the given buffer.

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

Returns
  A buffer (possibly the same pointer) that is writable.

gsize Gst::Buffer::extract | ( | gsize | offset,
|  | gpointer | dest,
|  | gsize | size
| ) |  |

Copy size bytes starting from offset in buffer to dest.

Parameters

  offset | The offset to extract.
  dest | The destination address.
  size | The size to extract.

Returns
  The amount of bytes extracted. This value can be lower than size when buffer did not contain enough data.

void Gst::Buffer::extract_dup | ( | gsize | offset,
|  | gsize | size,
|  | gpointer & | dest,
|  | gsize & | dest_size
| ) |  |

Extracts a copy of at most size bytes the data at offset into a Bytes.

dest must be freed using Glib::free() when done.

Parameters

  offset | The offset to extract.
  size | The size to extract.
  dest | A pointer where the destination array will be written.
  dest_size | A location where the size of dest can be written.

gsize Gst::Buffer::fill | ( | gsize | offset,
|  | gconstpointer | src,
|  | gsize | size
| ) |  |

Copy size bytes from src to buffer at offset.

Parameters

  offset | The offset to fill.
  src | The source address.
  size | The size to fill.

Returns
  The amount of bytes copied. This value can be lower than size when buffer did not contain enough data.

bool Gst::Buffer::find_memory | ( | gsize | offset,
|  | gsize | size,
|  | guint & | idx,
|  | guint & | length,
|  | gsize & | skip
| ) |  |

Find the memory blocks that span size bytes starting from offset in buffer.

When this function returns `true`, idx will contain the index of the first memory bock where the byte for offset can be found and length contains the number of memory blocks containing the size remaining bytes. skip contains the number of bytes to skip in the memory bock at idx to get to the byte for offset.

size can be -1 to get all the memory blocks after idx.

Parameters

  offset | An offset.
  size | A size.
  idx | Pointer to index.
  length | Pointer to length.
  skip | Pointer to skip.

Returns
  `true` when size bytes starting from offset could be found in buffer and idx, length and skip will be filled.

Glib::RefPtr<Gst::Memory> Gst::Buffer::get_all_memory | ( |  | ) | const

Get all the memory block in buffer.

The memory blocks will be merged into one large Gst::Memory.

Returns
  A Gst::Memory that contains the merged memory. Use gst_memory_unref() after usage.

ClockTime Gst::Buffer::get_dts | ( |  | ) | const

ClockTime Gst::Buffer::get_duration | ( |  | ) | const

Get duration of this buffer.

Returns
  he duration in nanoseconds (as a Gst::ClockTime) of the data in the buffer. Value will be Gst::CLOCK_TIME_NONE if the duration is unknown.

Glib::RefPtr<Gst::Memory> Gst::Buffer::get_memory | ( | guint | idx | ) | const

Get the memory block at index idx in buffer.

Parameters

  idx | An index.

Returns
  A Gst::Memory that contains the data of the memory block at idx. Use gst_memory_unref() after usage.

Glib::RefPtr<Gst::Memory> Gst::Buffer::get_memory_range | ( | guint | idx,
|  | gint | length
| ) |  |

Get length memory blocks in buffer starting at idx.

The memory blocks will be merged into one large Gst::Memory.

If length is -1, all memory starting from idx is merged.

Parameters

  idx | An index.
  length | A length.

Returns
  A Gst::Memory that contains the merged data of length blocks starting at idx. Use gst_memory_unref() after usage.

guint64 Gst::Buffer::get_offset | ( |  | ) | const

Get the offset of this buffer.

Returns
  The offset in the source file of the beginning of this buffer.

guint64 Gst::Buffer::get_offset_end | ( |  | ) | const

Get the offset end of this buffer.

Returns
  The offset in the source file of the end of this buffer.

ClockTime Gst::Buffer::get_pts | ( |  | ) | const

gsize Gst::Buffer::get_size | ( |  | ) | const

Get the total size of the memory blocks in buffer.

Returns
  Total size of the memory blocks in buffer.

gsize Gst::Buffer::get_sizes | ( | gsize & | offset,
|  | gsize & | max_size
| ) |  | const

Get the total size of the memory blocks in b.

When not `0`, offset will contain the offset of the data in the first memory block in buffer and maxsize will contain the sum of the size and offset and the amount of extra padding on the last memory block. offset and maxsize can be used to resize the buffer memory blocks with gst_buffer_resize().

Parameters

  offset | A pointer to the offset.
  maxsize | A pointer to the maxsize.

Returns
  Total size of the memory blocks in buffer.

gsize Gst::Buffer::get_sizes_range | ( | guint | idx,
|  | gint | length,
|  | gsize & | offset,
|  | gsize & | max_size
| ) |  | const

Get the total size of length memory blocks stating from idx in buffer.

When not `0`, offset will contain the offset of the data in the memory block in buffer at idx and maxsize will contain the sum of the size and offset and the amount of extra padding on the memory block at idx + length -1. offset and maxsize can be used to resize the buffer memory blocks with gst_buffer_resize_range().

Parameters

  idx | An index.
  length | A length.
  offset | A pointer to the offset.
  maxsize | A pointer to the maxsize.

Returns
  Total size of length memory blocks starting at idx in buffer.

GstBuffer* Gst::Buffer::gobj | ( |  | ) |

Provides access to the underlying C instance.

const GstBuffer* Gst::Buffer::gobj | ( |  | ) | const

Provides access to the underlying C instance.

GstBuffer* Gst::Buffer::gobj_copy | ( |  | ) | const

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

void Gst::Buffer::insert_memory | ( | guint | idx,
|  | Glib::RefPtr< Gst::Memory >& | mem
| ) |  |

Insert the memory block to at .

This function takes ownership of and thus doesn't increase its refcount.

Only get_max_memory() can be added to a buffer. If more memory is added, existing memory blocks will automatically be merged to make room for the new memory.

Parameters

  idx | the index to add the memory at, or -1 to append it to the end.
  mem | a Gst::Memory.

bool Gst::Buffer::map | ( | const Glib::RefPtr< Gst::MapInfo >& | info,
|  | MapFlags | flags
| ) |  |

This function fills info with the Gst::MapInfo of all merged memory blocks in buffer.

flags describe the desired access of the memory. When flags is Gst::MAP_WRITE, buffer should be writable (as returned from gst_buffer_is_writable()).

When buffer is writable but the memory isn't, a writable copy will automatically be created and returned. The readonly copy of the buffer memory will then also be replaced with this writable copy.

The memory in info should be unmapped with gst_buffer_unmap() after usage.

Parameters

  info | Info about the mapping.
  flags | Flags for the mapping.

Returns
  `true` if the map succeeded and info contains valid data.

bool Gst::Buffer::map_range | ( | guint | idx,
|  | gint | length,
|  | const Glib::RefPtr< Gst::MapInfo >& | info,
|  | MapFlags | flags
| ) |  |

This function fills info with the Gst::MapInfo of length merged memory blocks starting at idx in buffer.

When length is -1, all memory blocks starting from idx are merged and mapped.

flags describe the desired access of the memory. When flags is Gst::MAP_WRITE, buffer should be writable (as returned from gst_buffer_is_writable()).

When buffer is writable but the memory isn't, a writable copy will automatically be created and returned. The readonly copy of the buffer memory will then also be replaced with this writable copy.

The memory in info should be unmapped with gst_buffer_unmap() after usage.

Parameters

  idx | An index.
  length | A length.
  info | Info about the mapping.
  flags | Flags for the mapping.

Returns
  `true` if the map succeeded and info contains valid data.

int Gst::Buffer::memcmp | ( | gsize | offset,
|  | gconstpointer | mem,
|  | gsize | size
| ) |  |

Compare size bytes starting from offset in buffer with the memory in mem.

Parameters

  offset | The offset in buffer.
  mem | The memory to compare.
  size | The size to compare.

Returns
  0 if the memory is equal.

gsize Gst::Buffer::memset | ( | gsize | offset,
|  | guint8 | val,
|  | gsize | size
| ) |  |

Fill buf with size bytes with val starting from offset.

Parameters

  offset | The offset in buffer.
  val | The value to set.
  size | The size to set.

Returns
  The amount of bytes filled. This value can be lower than size when buffer did not contain enough data.

guint Gst::Buffer::n_memory | ( |  | ) | const

Get the amount of memory blocks that this buffer has.

This amount is never larger than what gst_buffer_get_max_memory() returns.

Returns
  The amount of memory block in this buffer.

static guint64 Gst::Buffer::offset_none | ( |  | ) |
| static

Constant for no-offset return results.

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

Glib::RefPtr<Gst::Memory> Gst::Buffer::peek_memory | ( | guint | idx | ) |

Get the memory block at idx in buffer.

The memory block stays valid until the memory block in buffer is removed, replaced or merged, typically with any call that modifies the memory in buffer.

Parameters

  idx | An index.

Returns
  The Gst::Memory at idx.

void Gst::Buffer::prepend_memory | ( | Glib::RefPtr< Gst::Memory >& | mem | ) |

Prepend the memory block to .

This function takes ownership of and thus doesn't increase its refcount.

This function is identical to insert_memory() with an index of 0. See insert_memory() for more details.

Parameters

  mem | a Gst::Memory.

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

Increment the reference count for this object.

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

void Gst::Buffer::remove_all_memory | ( |  | ) |

Remove all the memory blocks in buffer.

void Gst::Buffer::remove_memory | ( | guint | idx | ) |

Remove the memory block in b at index i.

Parameters

  idx | An index.

void Gst::Buffer::remove_memory_range | ( | guint | idx,
|  | gint | length
| ) |  |

Remove length memory blocks in buffer starting from idx.

length can be -1, in which case all memory starting from idx is removed.

Parameters

  idx | An index.
  length | A length.

void Gst::Buffer::replace_all_memory | ( | Glib::RefPtr< Gst::Memory >& | mem | ) |

Replaces all memory in buffer with mem.

Parameters

  mem | A Gst::Memory.

void Gst::Buffer::replace_memory | ( | guint | idx,
|  | Glib::RefPtr< Gst::Memory >& | mem
| ) |  |

Replaces the memory block at index idx in buffer with mem.

Parameters

  idx | An index.
  mem | A Gst::Memory.

void Gst::Buffer::replace_memory_range | ( | guint | idx,
|  | gint | length,
|  | Glib::RefPtr< Gst::Memory >& | mem
| ) |  |

Replaces length memory blocks in buffer starting at idx with mem.

If length is -1, all memory starting from idx will be removed and replaced with mem.

buffer should be writable.

Parameters

  idx | An index.
  length | A length should not be 0.
  mem | A Gst::Memory.

void Gst::Buffer::resize | ( | gssize | offset,
|  | gssize | size
| ) |  |

Set the offset and total size of the memory blocks in buffer.

Parameters

  offset | The offset adjustement.
  size | The new size or -1 to just adjust the offset.

bool Gst::Buffer::resize_range | ( | guint | idx,
|  | gint | length,
|  | gssize | offset,
|  | gssize | size
| ) |  |

Set the total size of the length memory blocks starting at idx in buffer.

Parameters

  idx | An index.
  length | A length.
  offset | The offset adjustement.
  size | The new size or -1 to just adjust the offset.

Returns
  `true` if resizing succeeded, `false` otherwise.

void Gst::Buffer::set_dts | ( | const ClockTime& | value | ) |

void Gst::Buffer::set_duration | ( | const ClockTime& | value | ) |

void Gst::Buffer::set_pts | ( | const ClockTime& | value | ) |

void Gst::Buffer::set_size | ( | gssize | size | ) |

Set the total size of the memory blocks in buffer.

Parameters

  size | The new size.

void Gst::Buffer::unmap | ( | const Glib::RefPtr< Gst::MapInfo >& | info | ) |

Release the memory previously mapped with gst_buffer_map().

Parameters

  info | A Gst::MapInfo.

void Gst::Buffer::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

Glib::RefPtr< Gst::Buffer > wrap | ( | GstBuffer * | 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.

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

- gstreamermm/buffer.h