Instantiating Codec MFTs

You can create a codec MFT by calling the COM function CoCreateInstance. You must pass the class identifier of the MFT, the interface identifier of IMFTransform, and a pointer to an IMFTransform pointer.

The class identifiers of the codec MFTs are defined as constants in the wmcodecdsp.h header file.

The constant for the IMFTransform interface identifier is IID_IMFTransform.

The following code example demonstrates how to create an instance of a codec MFT:

HRESULT CreateVideoEncoderMFT(IMFTransform** ppMFT)
{
    if (ppMFT == NULL)
        return E_POINTER;

    return CoCreateInstance(CLSID_CWMV9EncMediaObject,
                            NULL,
                            CLSCTX_INPROC_SERVER, 
                            IID_IMFTransform, 
                            (void**)ppMFT);
}

See Also

Working with Codec MFTs

 

 

Send comments about this topic to Microsoft

Build date: 4/7/2010