Table of Contents

Class MediaBuffer

Namespace
NAudio.Dmo
Assembly
NAudio.Dmo.dll

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

maxLength int

Maximum length in bytes

Properties

Length

Length of data in the media buffer

public int Length { get; set; }

Property Value

int

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

disposing bool

~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

bufferPointerPointer nint

Pointer to variable into which buffer pointer should be written

validDataLengthPointer nint

Pointer 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

maxLength int

Max length (output parameter)

Returns

int

HRESULT

LoadData(ReadOnlySpan<byte>)

Loads data into this buffer

public void LoadData(ReadOnlySpan<byte> data)

Parameters

data ReadOnlySpan<byte>

Data to load

RetrieveData(Span<byte>)

Retrieves the data in the output buffer into a span

public void RetrieveData(Span<byte> destination)

Parameters

destination Span<byte>

Span to copy data into

SetLength(int)

Set length of valid data in the buffer

public int SetLength(int length)

Parameters

length int

length

Returns

int

HRESULT