public class MediaBuffer : IMediaBuffer, IWriteable, IDisposable
Default-Implementation of the IMediaBuffer interface. For more information, see .
MediaBuffer(Int32 maxlength)
Creates a MediaBuffer and allocates the specified number of bytes in the memory.
public void MediaBuffer(Int32 maxlength)
Parameters
maxlength
Int32The number of bytes which has to be allocated in the memory.
Dispose()
Frees the allocated memory of the internally used buffer.
public void Dispose()
Finalize()
Frees the allocated memory of the internally used buffer.
protected void Finalize()
GetBufferAndLength(IntPtr ppBuffer, IntPtr validDataByteLength)
The GetBufferAndLength method retrieves the buffer and the size of the valid data in the buffer.
none Int32 GetBufferAndLength(IntPtr ppBuffer, IntPtr validDataByteLength)
Parameters
ppBuffer
IntPtrAddress of a pointer that receives the buffer array. Can be Zero if validDataByteLength is not Zero.
validDataByteLength
IntPtrPointer to a variable that receives the size of the valid data, in bytes. Can be Zero if ppBuffer is not Zero.
Returns
HRESULT
GetMaxLength(Int32& length)
The GetMaxLength method retrieves the maximum number of bytes this buffer can hold.
none Int32 GetMaxLength(Int32& length)
Parameters
length
Int32&A variable that receives the buffer's maximum size, in bytes.
Returns
HRESULT
Read(Byte[] buffer, Int32 offset)
Reads a sequence of bytes from the internally used buffer.
public void Read(Byte[] buffer, Int32 offset)
Parameters
buffer
Byte[]Array of bytes to store the read bytes in.
offset
Int32Zero-based byte offset in the specified buffer at which to begin storing the data read from the buffer.
Read(Byte[] buffer, Int32 offset, Int32 count)
Reads a sequence of bytes from the buffer.
public void Read(Byte[] buffer, Int32 offset, Int32 count)
Parameters
buffer
Byte[]Array of bytes to store the read bytes in.
offset
Int32Zero-based byte offset in the specified buffer at which to begin storing the data read from the buffer.
count
Int32The maximum number of bytes to read from the buffer.
SetLength(Int32 length)
The SetLength method specifies the length of the data currently in the buffer.
none Int32 SetLength(Int32 length)
Parameters
length
Int32Size of the data, in bytes. The value must not exceed the buffer's maximum size. Call the GetMaxLength method to obtain the maximum size.
Returns
HRESULT
Write(Byte[] buffer, Int32 offset, Int32 count)
Writes a sequence of bytes to the internally used buffer.
public void Write(Byte[] buffer, Int32 offset, Int32 count)
Parameters
buffer
Byte[]Array of bytes. The Write method copies data from the specified array of bytes to the internally used buffer.
offset
Int32Zero-based bytes offset in the specified buffer at which to begin copying bytes to the internally used buffer.
count
Int32The number of bytes to be copied.
Length
Gets the length of the data currently in the buffer.
public Int32 Length { get; set; }
MaxLength
Gets the maximum number of bytes this buffer can hold.
public Int32 MaxLength { get; }