Microsoft DirectX 9.0

Using Windows Media With DirectShow Editing Services

This section describes how to use Windows Media–based content in a DirectShow Editing Services (DES) application. There are two main scenarios:

To work with Windows Media files, the application must provide a software certificate, also called a key. It does this by implementing a key provider object. The key provider is a COM object the exposes the IServiceProvider interface. For information about implementing the key provider, see Unlocking the Windows Media Format SDK.

To use DES with Windows Media files, the following DES objects require the software key:

Important   Do not use the Smart Render Engine to read or write Windows Media files. Always use the Basic Render Engine (CLSID_RenderEngine).

To give an object the software key, query that object for the IObjectWithSite interface and call IObjectWithSite::SetSite with a pointer to your key provider. For example, the following code provides the software key to the render engine:

// Create your key provider, using an application-defined function:
IServiceProvider *pKey;
hr = MyCreateKeyProviderFunction(&pKey);  

// Query the Render Engine for IObjectWithSite.
IObjectWithSite *pOWS;
hr = pRenderEngine->QueryInterface(__uuidof(IObjectWithSite), 
    reinterpret_cast<void**>(&pOWS));
if (SUCCEEDED(hr))
{
    // Give it your key provider.
    hr = pOWS->SetSite(pKey);
    pOWS->Release();
}
pKey->Release();

To use Windows Media source clips in a DES project, simply call IObjectWithSite::SetSite on the render engine with a pointer to your key provider.

For information about writing Windows Media files, see Writing a Windows Media File in DES.