Class MediaBuffer
Implements the COM IMediaBuffer interface as a managed object backed by CoTaskMem allocation.
[GeneratedComClass]
[ComExposedClass<ComClassInformation>]
public class MediaBuffer : IMediaBuffer, IDisposable
- Inheritance
-
MediaBuffer
- Implements
- Inherited Members
Constructors
MediaBuffer(int)
Creates a new Media Buffer
public MediaBuffer(int maxLength)
Parameters
maxLengthintMaximum length in bytes
Properties
Length
Length of data in the media buffer
public int Length { get; set; }
Property Value
Methods
Dispose()
Dispose and free memory for buffer
public void Dispose()
Dispose(bool)
Releases the unmanaged CoTaskMem buffer. Called from both Dispose() and the finalizer; FreeCoTaskMem(nint) is safe to call from a finalizer thread.
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
~MediaBuffer()
Finalizer — frees the unmanaged buffer if Dispose was not called.
protected ~MediaBuffer()
GetBufferAndLength(nint, nint)
Gets buffer and / or length
public int GetBufferAndLength(nint bufferPointerPointer, nint validDataLengthPointer)
Parameters
bufferPointerPointernintPointer to variable into which buffer pointer should be written
validDataLengthPointernintPointer to variable into which valid data length should be written
Returns
- int
HRESULT
GetMaxLength(out int)
Gets the maximum length of the buffer
public int GetMaxLength(out int maxLength)
Parameters
maxLengthintMax length (output parameter)
Returns
- int
HRESULT
LoadData(ReadOnlySpan<byte>)
Loads data into this buffer
public void LoadData(ReadOnlySpan<byte> data)
Parameters
dataReadOnlySpan<byte>Data to load
RetrieveData(Span<byte>)
Retrieves the data in the output buffer into a span
public void RetrieveData(Span<byte> destination)
Parameters
SetLength(int)
Set length of valid data in the buffer
public int SetLength(int length)
Parameters
lengthintlength
Returns
- int
HRESULT