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.
- The IWMDRMLicenseManagement::BackupLicenses method generates MEWMDRMLicenseBackupProgress events with associated IWMDRMLicenseBackupRestoreStatus interfaces.
- The IWMDRMLicenseManagement::RestoreLicenses method generates MEWMDRMLicenseRestoreProgress events with associated IWMDRMLicenseBackupRestoreStatus interfaces.
- The IWMDRMSecurity::PerformSecurityUpdate method, when used to perform individualization, generates MEWMDRMIndividualizationProgress events with associated IWMDRMIndividualizationStatus interfaces.
- The IWMDRMLicenseManagement::AcquireLicense method, when used to prepare data for non-silent license acquisition, generates an MEWMDRMLicenseAcquisitionCompleted event with an associated IWMDRMNonSilentLicenseAquisition interface.