Using the Media Foundation Event Model

The asynchronous methods supported by the Windows Media DRM Client Extended APIs use the same event model that is used by the Media Foundation SDK. Each object that supports asynchronous methods implements the IWMDRMEventGenerator interface, which can be used to retrieve an event when an asynchronous operation is complete.

The IWMDRMEventGenerator interface inherits from the IMFMediaEventGenerator interface, which is documented in the Media Foundation SDK documentation.

The example code in the DRM Individualization Example uses the IMFMediaEventGenerator::GetEvent method to retrieve events from the queue one at a time. Using GetEvent is more straightforward than using IMFMediaEventGenerator::BeginGetEvent and IMFMediaEventGenerator::EndGetEvent with a callback, which makes the code examples easier to understand. Whether you use GetEvent in your code or implement IMFAsyncCallback and use BeginGetEvent and EndGetEvent, the logic to handle the event after it has been received is the same.

Several of the asynchronous methods generate events that contain references to objects that can be used to obtain more detailed status information. In these cases, the generated event has an IUnknown pointer as its value, which can be queried to retrieve the status interface. The following list summarizes the relationships between asynchronous calls, generated events, and other interfaces.

DRM Individualization Example

Getting Started

Media Foundation SDK Documentation