Table of Contents

Class MediaFoundationApi

Namespace
NAudio.MediaFoundation
Assembly
NAudio.Wasapi.dll

Main interface for using Media Foundation with NAudio.

public static class MediaFoundationApi
Inheritance
MediaFoundationApi
Inherited Members

Remarks

Factory return-shape convention (Phase 2e′): factories return (IntPtr Ptr, T Rcw) when the caller needs the IntPtr to pass to a different native MF API (e.g. NAudio.MediaFoundation.MediaFoundationApi.CreateMediaType() → IntPtr to IMFTransform::SetInputType; NAudio.MediaFoundation.MediaFoundationApi.CreateSample() → IntPtr to IMFSinkWriter::WriteSample; CreateAttributes(int) → IntPtr to CreateSinkWriterFromUrl(string, nint, nint)). The wrapper holds both refs and must release both via ReleaseBoth<TInterface>(TInterface, nint). Factories return only T (or only IntPtr) when the caller never needs the other half — the helper releases the unneeded ref internally before returning.

Methods

EnumerateTransforms(Guid)

Enumerate the installed Media Foundation transforms in the specified category

public static IEnumerable<MfActivate> EnumerateTransforms(Guid category)

Parameters

category Guid

A category from MediaFoundationTransformCategories

Returns

IEnumerable<MfActivate>

Shutdown()

Shuts down Media Foundation

public static void Shutdown()

Startup()

Initializes Media Foundation - only needs to be called once per process

public static void Startup()