Using Custom Mutual Exclusion Types

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

You can use mutual exclusion objects in a profile to meet the needs of custom scenarios. By passing the GUID value CLSID_WMMUTEX_Unknown to IWMMutualExclusion::SetType, you inform the mutual exclusion object that you are using a custom scenario.

You must manually control stream selection when you read a file with a custom mutual exclusion value. The reader object will use the first stream you add to the mutual exclusion as the default.

Use the following steps to create a custom mutual exclusion object and add it to a profile:

  1. Create a profile manager by calling the WMCreateProfileManager function.

  2. Either start with an existing profile, or create an entirely new one.

  3. Add streams to the new profile by calling IWMProfile::CreateNewStream. Configure the streams as needed using the methods of IWMStreamConfig. You can also call QueryInterface to access other interfaces in the stream configuration object.

    CreateNewStream creates only a stream configuration object, and does not affect the profile. After a stream is configured properly, you must call IWMProfile::AddStream to add the stream to the profile.

  4. Create a mutual exclusion object by calling IWMProfile::CreateNewMutualExclusion.

  5. Add the desired streams to the mutual exclusion object by calling IWMStreamList::AddStream (available directly from IWMMutualExclusion, which inherits from IWMStreamList).

  6. Set the type of mutual exclusion to custom by calling IWMMutualExclusion::SetType. Pass the CLSID_WMMUTEX_Unknown as the type GUID.

  7. Add the configured mutual exclusion object to the profile by calling IWMProfile::AddMutualExclusion.

IWMMutualExclusion Interface

IWMProfile Interface

IWMProfileManager Interface

IWMStreamConfig Interface

IWMStreamList Interface

Using Mutual Exclusion

WMCreateProfileManager