AVBlocks for C++
3.0
Audio and Video Software Development Kit
|
A buffer for media data. More...
#include <av.h>
Public Member Functions | |
virtual bool_t | alloc (int32_t size, bool_t keepData)=0 |
Allocates internal buffer storage. | |
virtual bool_t | append (const void *data, int32_t dataSize)=0 |
Appends data to the end of the MediaBuffer data. | |
virtual bool_t | attach (void *buffer, int32_t size, bool_t setData)=0 |
Attaches an external buffer storage. | |
virtual int32_t | capacity () const =0 |
Returns the size of the buffer in bytes. | |
virtual void | clear ()=0 |
Clears existing data. | |
virtual MediaBuffer * | clone () const =0 |
Creates a deep copy of this object. | |
virtual uint8_t * | data () const =0 |
Returns a pointer to the first byte of data. | |
virtual int32_t | dataOffset () const =0 |
Returns the offset at which valid data starts in the buffer. | |
virtual int32_t | dataSize () const =0 |
Returns the size of the valid data that in the buffer. | |
virtual uint8_t * | detach ()=0 |
Detaches an external buffer storage. | |
virtual bool_t | external () const =0 |
Returns whether the MediaBuffer uses an external data buffer. | |
virtual void | free ()=0 |
Frees internal buffer storage. | |
virtual int32_t | freeLinearSpace () const =0 |
Returns the free linear space that can be used to append data without normalization. | |
virtual int32_t | freeSpace () const =0 |
Returns the free space that can be used to append data without buffer reallocation. | |
virtual void | normalize ()=0 |
Moves the existing data to the start of the buffer amd maximizes the free linear space. | |
virtual void | remove (int32_t dataSize)=0 |
Removes data from the beginning of the MediaBuffer data. | |
virtual bool_t | setData (int32_t dataOffset, int32_t dataSize)=0 |
Sets the offset at which valid data starts in the buffer block and the data size in bytes. | |
virtual uint8_t * | start () const =0 |
Returns a pointer to the start of the buffer. | |
Public Member Functions inherited from Reference | |
virtual int32_t | release () const =0 |
Releases the instance. | |
virtual int32_t | retain () const =0 |
Retains the instance. | |
virtual int32_t | retainCount () const =0 |
Returns the current reference count. | |
Protected Member Functions | |
~MediaBuffer () | |
This object can be destroyed only by its implementation. | |
A buffer for media data.
MediaBuffer has a capacity which is the size of the buffer and data size which is the size of the actual data in the buffer. The buffer is a continuous block of memory. The valid data is also a continuous block. The data can start at any offset in the buffer.
|
protected |
This object can be destroyed only by its implementation.
The caller must use Reference::release.
|
pure virtual |
Allocates internal buffer storage.
size | Requested buffer size. A buffer storage is allocated only if the requested size exceeds the current buffer size (capacity). The actual allocated buffer may be larger than the requested size. |
keepData | Specifies whether to keep the existing data when the existing buffer is resized. |
|
pure virtual |
Appends data to the end of the MediaBuffer data.
data | A pointer to the data that should be appended. |
dataSize | The number of bytes that should be appended. |
|
pure virtual |
Attaches an external buffer storage.
buffer | A pointer to the buffer storage. |
size | The buffer size. |
setData | Specifies whether to auto set data with a size equal to the buffer size. If TRUE the data size is set to the buffer size. If FALSE data size is 0. |
|
pure virtual |
Returns the size of the buffer in bytes.
|
pure virtual |
Clears existing data.
|
pure virtual |
Creates a deep copy of this object.
|
pure virtual |
Returns a pointer to the first byte of data.
This is effectively the same as start() + dataOffset().
|
pure virtual |
Returns the offset at which valid data starts in the buffer.
|
pure virtual |
Returns the size of the valid data that in the buffer.
|
pure virtual |
Detaches an external buffer storage.
|
pure virtual |
Returns whether the MediaBuffer uses an external data buffer.
|
pure virtual |
Frees internal buffer storage.
|
pure virtual |
Returns the free linear space that can be used to append data without normalization.
|
pure virtual |
Returns the free space that can be used to append data without buffer reallocation.
|
pure virtual |
Moves the existing data to the start of the buffer amd maximizes the free linear space.
|
pure virtual |
Removes data from the beginning of the MediaBuffer data.
dataSize | The number of bytes that should be removed from the valid data. |
|
pure virtual |
Sets the offset at which valid data starts in the buffer block and the data size in bytes.
The data offset and size are validated so that they are always within the buffer.
dataOffset | The offset at which valid data starts in the buffer. Allowed values range from 0 to capacity()-1. |
dataSize | The size of the valid data in the buffer. Allowed values range from 0 to capacity(). |
|
pure virtual |
Returns a pointer to the start of the buffer.