Table of Contents

Class MfActivate

Namespace
NAudio.MediaFoundation
Assembly
NAudio.Wasapi.dll

Wrapper for IMFActivate providing managed access to activation objects.

public class MfActivate : IDisposable
Inheritance
MfActivate
Implements
Inherited Members

Properties

AttributeCount

Gets the number of attributes set on this object.

public int AttributeCount { get; }

Property Value

int

Methods

ActivateObject(Guid)

Creates the object associated with this activation object.

public nint ActivateObject(Guid interfaceId)

Parameters

interfaceId Guid

The interface ID to request.

Returns

nint

The activated object as an IntPtr. The caller owns the reference.

DetachObject()

Detaches the created object from the activation object.

public void DetachObject()

Dispose()

Dispose

public void Dispose()

Dispose(bool)

Releases the native IntPtr ref unconditionally. When called from Dispose() (disposing=true) also calls FinalRelease on the RCW; the finalizer path leaves the RCW alone because ComObject has its own finalizer with no defined ordering relative to ours.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

~MfActivate()

Finalizer — runs only if Dispose was not called. Releases the native IntPtr ref; the source-generated RCW has its own ComObject finalizer that releases its ref independently.

protected ~MfActivate()

GetAttributeByIndex(int, out Guid, nint)

Retrieves an attribute at the specified index.

public void GetAttributeByIndex(int index, out Guid key, nint valuePtr)

Parameters

index int

Zero-based index of the attribute

key Guid

Receives the attribute GUID key

valuePtr nint

Receives the attribute value as a PropVariant. Caller must free with PropVariant.Clear.

GetBlobAsArrayOf<T>(Guid)

Gets a blob attribute as an array of structs.

public T[] GetBlobAsArrayOf<T>(Guid key) where T : new()

Parameters

key Guid

Returns

T[]

Type Parameters

T

GetGuid(Guid)

Gets a GUID attribute.

public Guid GetGuid(Guid key)

Parameters

key Guid

The attribute key GUID.

Returns

Guid

The attribute value.

GetString(Guid)

Gets a string attribute.

public string GetString(Guid key)

Parameters

key Guid

The attribute key GUID.

Returns

string

The string value.

GetUInt32(Guid)

Gets a UINT32 attribute.

public int GetUInt32(Guid key)

Parameters

key Guid

The attribute key GUID.

Returns

int

The attribute value.

ShutdownObject()

Shuts down the created object.

public void ShutdownObject()