gstreamermm
1.0.10
|
A data-passing buffer type, supporting sub-buffers. More...
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... | |
void | copy_into (Glib::RefPtr< Gst::Buffer > source_buffer, BufferCopyFlags flags, gsize offset, gsize size) |
Copies the information from src into dest. 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... | |
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... | |
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... | |
gsize | extract (gsize offset, gpointer dest, gsize size) |
Copy size bytes starting from offset in buffer to dest. 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... | |
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... | |
![]() | |
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) |
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... | |
Static Public Member Functions | |
static Glib::RefPtr< Buffer > | create () |
static Glib::RefPtr< Gst::Buffer > | create (guint size) |
Protected Member Functions | |
Buffer () | |
void | operator delete (void*, std::size_t) |
![]() | |
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... | |
![]() | |
Glib::RefPtr< Gst::MiniObject > | wrap (GstMiniObject* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
A data-passing buffer type, supporting sub-buffers.
Buffers are the basic unit of data transfer in GStreamer. The Gst::Buffer type provides all the state necessary to define a region of memory as part of a stream. Sub-buffers are also supported, allowing a smaller region of a buffer to become its own buffer, with mechanisms in place to ensure that neither memory space goes away prematurely.
Buffers are usually created with create(). After a buffer has been created one will typically allocate memory for it and set the size of the buffer data. The following example creates a buffer that can hold a given video frame with a given width, height and bits per plane.
|
protected |
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.
buf2 | The second source Gst::Buffer to append. |
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.
buf2 | The second source Gst::Buffer to append. |
offset | The offset in buf2. |
size | The size or -1 of buf2. |
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.
void Gst::Buffer::copy_into | ( | Glib::RefPtr< Gst::Buffer > | source_buffer, |
BufferCopyFlags | flags, | ||
gsize | offset, | ||
gsize | size | ||
) |
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.
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. |
true
if the copying succeeded, false
otherwise.
|
static |
|
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.
gsize Gst::Buffer::extract | ( | gsize | offset, |
gpointer | dest, | ||
gsize | size | ||
) |
Copy size bytes starting from offset in buffer to dest.
offset | The offset to extract. |
dest | The destination address. |
size | The size to extract. |
gsize Gst::Buffer::fill | ( | gsize | offset, |
gconstpointer | src, | ||
gsize | size | ||
) |
Copy size bytes from src to buffer at offset.
offset | The offset to fill. |
src | The source address. |
size | The size to fill. |
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.
ClockTime Gst::Buffer::get_dts | ( | ) | const |
ClockTime Gst::Buffer::get_duration | ( | ) | const |
Get duration of this buffer.
Glib::RefPtr<Gst::Memory> Gst::Buffer::get_memory | ( | guint | idx | ) | const |
Get the memory block at index idx in buffer.
idx | An index. |
guint64 Gst::Buffer::get_offset | ( | ) | const |
Get the offset of this buffer.
guint64 Gst::Buffer::get_offset_end | ( | ) | const |
Get the offset 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.
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.
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.
info | Info about the mapping. |
flags | Flags for the mapping. |
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.
offset | The offset in buffer. |
mem | The memory to compare. |
size | The size to compare. |
gsize Gst::Buffer::memset | ( | gsize | offset, |
guint8 | val, | ||
gsize | size | ||
) |
Fill buf with size bytes with val starting from offset.
offset | The offset in buffer. |
val | The value to set. |
size | The size to set. |
|
protected |
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.
idx | An index. |
void Gst::Buffer::replace_memory | ( | guint | idx, |
Glib::RefPtr< Gst::Memory > | mem | ||
) |
Replaces the memory block at index idx in buffer with mem.
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.
idx | An index. |
length | A length should not be 0. |
mem | A Gst::Memory. |
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::unmap | ( | const Glib::RefPtr< Gst::MapInfo >& | info | ) |
Release the memory previously mapped with gst_buffer_map().
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.
|
related |
A Glib::wrap() method for this object.
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. |