AVBlocks for .NET
3.0
Audio and Video Software Development Kit
|
A buffer for media data. More...
Public Member Functions | |
MediaBuffer () | |
Creates a MediaBuffer object with no data. | |
MediaBuffer (byte[] data) | |
Creates a buffer by using the supplied byte array for the internal data buffer. | |
MediaBuffer (int bufferSize) | |
Creates a buffer by specifying the size of the internal data buffer. | |
bool | Attach (byte[] buffer, bool setData) |
Attaches an external buffer storage. | |
virtual object | Clone () |
Creates a deep copy of this object. | |
byte[] | Detach () |
Detaches an external data buffer. | |
bool | SetData (int dataOffset, int dataSize) |
This is a convenience method that sets buffer data offset and size at once. | |
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.
MediaBuffer | ( | byte[] | data | ) |
Creates a buffer by using the supplied byte array for the internal data buffer.
data | A byte array which is used by the new MediaBuffer instance. |
MediaBuffer | ( | int | bufferSize | ) |
Creates a buffer by specifying the size of the internal data buffer.
bufferSize | Specifies the size of the internal storage |
bool Attach | ( | byte[] | buffer, |
bool | setData | ||
) |
Attaches an external buffer storage.
buffer | An array that should be used as an external storage. |
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. |
|
virtual |
Creates a deep copy of this object.
Only the reference to the external buffer is copied when MediaBuffer does not own its data buffer, i.e. uses external / attached data. On the contrary, when MediaBuffer owns its data, a new copy of the data is created.
System.OutOfMemoryException | The object cannot be cloned because there's not enough memory. |
References MediaBuffer.MediaBuffer().
Referenced by MediaSample.Clone().
byte[] Detach | ( | ) |
Detaches an external data buffer.
bool SetData | ( | int | dataOffset, |
int | dataSize | ||
) |
This is a convenience method that sets buffer data offset and size at once.
dataOffset | The offset in the buffer where valid data starts. |
dataSize | The size in bytes of the valid data in the buffer. |
false if dataOffset and dataSize are not accepted by the method and the valid data is not set.
Referenced by MediaInfo.Push(), and Transcoder.Push().