Implementing a Codec MFT
This topic provides some guidelines for implementing a decoder or encoder as a Media Foundation Transform (MFT) .
- Related topics
The following procedure is used to initialize an encoder:
- Query the MFT for the ICodecAPI interface.
- Call ICodecAPI::SetValue to set encoding properties.
- Call IMFTransform::SetOutputType to set the encoding format.
- Call IMFTransform::GetInputAvailableType to get a list of compatible input types. (This step might be skipped.)
- Call IMFTransform::SetInputType to set the uncompressed input format.
After the output type is set in step 3, the GetInputAvailableType method must return a list of input types that are compatible with the current output type. In other words, any types returned by GetInputAvailableType at this point must be valid for SetInputType.
For decoders, the order in which types are set is reversed: The input type is set first, followed by the output type. After the input type is set, the IMFTransform::GetOutputAvailableType method must return a list of types that can be passed to the IMFTransform::SetOutputType method.
Encoders and decoders should support NV12 as a common uncompressed format. This ensures that pipeline components can interoperate with minimal colorspace conversions. Of course, other formats can be supported as well.
Some decoders are optimized for transcoding (decoding and then re-encoding a stream) and are not suitable for use during playback.
If a decoder MFT is intended only for transcoding, set the MFT_ENUM_FLAG_TRANSCODE_ONLY flag when you register the MFT. (See MFTRegister.)
By default, transcode decoders are not returned by the MFTEnumEx function. To enumerate transcode decoders, call MFTEnumEx and set the MFT_ENUM_FLAG_TRANSCODE_ONLY flag in Flags parameter. When used in the MFTEnumEx function, this flag enumerated both transcode decoders and other decoders.
|MFTRegister MFT_ENUM_FLAG_TRANSCODE_ONLY||MFTEnumEx MFT_ENUM_FLAG_TRANSCODE_ONLY||Is MFT Enumerated?|
The media source might attach the following telecine attributes to the media samples that it delivers.
|MFSampleExtension_RepeatFirstField||Equivalent to "repeat first field" (RFF) flag.|
|MFSampleExtension_BottomFieldFirst||Inverse of "top field first" (TFF) flag.|
These flags provide a hint to the enhanced video renderer (EVR) when it performs deinterlacing. A decoder should propagate these flags downstream by copying them to the output samples, so that they reach the EVR.