Instantiating an Encoder MFT
In Microsoft Media Foundation, encoders are implemented as Media Foundation transforms (MFTs). Before creating an encoder, you must first find the encoder that is most suited to your needs.
Windows Media audio codecs
Major type: MFMediaType_Audio
SubType: MFAudioFormat_WMAudioV9, MFAudioFormat_WMAudioV8, MFAudioFormat_WMAudio_Lossless, MFAudioFormat_WMASPDIF
Windows Media video codecs
Major type: MFMediaType_Video
SubType: MFVideoFormat_WVC1, MFVideoFormat_WMV3, MFVideoFormat_WMV2, MFVideoFormat_WMV1
Media Foundation provides several functions that your application can call to enumerate the various encoders available in your system. Encoders are registered as COM objects and the registry entry follows the standard format for COM class factories. The registry maintains the CLSIDs for the encoders, which are categorized by the media format (audio or video). The class identifiers of the Windows Media encoders are defined as constants in the wmcodecdsp.h header file. In Media Foundation, the encoders can be registered through calls to MFTRegisterLocal or MFTRegisterLocalByCLSID by specifying the catergory, the supported input types, and the supported output types. Upon successful registration through these functions, the MFTs are considered by the Media Foundation enumeration functions.
For creating an instance of an encoder MFT, an application has the following choices.
- Create the encoder MFT directly and receive a pointer to the IMFTransform interface. For more information, see Creating an Encoder by Using CoCreateInstance.
- Create an instance of the activation object for the encoder MFT and receive a pointer to the IMFActivate interface. For more information, see Using an Encoder's Activation Objects.
If your application is using Pipeline Layer ASF Components to encode a file to ASF format, you must insert the encoder MFT into the pipeline as a transform node. While creating the transform node in the encoding topology, you can either set the object type as a pointer to the IMFTransform interface or the IMFActivate object. Media Foundation provides activation objects for Windows Media encoders so that they can be conveniently set as the transform node in the encoding topology. When the topology is resolved, the Media Session uses the activation object to create an instance of the encoder MFT.