Preliminary. ThinkMeta ConcurrentTasks and this documentation are preliminary; everything is subject to change.

API reference / Media Foundation

Functions and constants functions

Free functions and constants of Media Foundation.

On this page
Use
import ThinkMeta.ConcurrentTasks.MediaFoundation.Await;
Namespace
ThinkMeta::ConcurrentTasks::MediaFoundation

Functions

MediaFoundation::Await

Waits for the next event of a Media Foundation event generator.

Syntax

inline HRESULT Await(
    IMFMediaEventGenerator* generator,
    IMFMediaEvent** event
) noexcept;

Parameters

generatorIMFMediaEventGenerator*
The generator, for example an asynchronous transform (IMFTransform queried for IMFMediaEventGenerator), a media source or a media session.
eventIMFMediaEvent**
Receives the event; release it after use.

Return value

Type: HRESULT

S_OK, or the error of BeginGetEvent or EndGetEvent, for example MF_E_SHUTDOWN once the generator has been shut down.

Remarks

Suspends the calling task until the generator queues an event; the scheduler thread runs other tasks meanwhile. The asynchronous counterpart of IMFMediaEventGenerator::GetEvent, which would block the thread. A generator accepts one outstanding request: wait for its events from one task at a time. Task or converted thread only. There is no timed variant, and shutting the generator down does not end a pending wait: wait only for events the generator will send, for example METransformDrainComplete after MFT_MESSAGE_COMMAND_DRAIN. After a shutdown, the function returns MF_E_SHUTDOWN at once. Needs the multithreaded apartment and a started Media Foundation (MFStartup).

See also

Synchronization::Await

Generated from ThinkMeta.ConcurrentTasks.API @ 5bad03a (2026-11-01).