Field of Use Restrictions
A field-of-use restriction is a provision that limits how a license for a particular technology can be used.
Media Foundation provides a mechanism for enforcing field-of-use restrictions on Media Foundation transforms (MFTs), particularly codecs. This mechanism requires the MFT to block its own use by applications until the application has performed a handshake with the MFT. Media Foundation does not define the handshake—typically, it would involve some sort of cryptographic exchange.
If an MFT has field-of-use restrictions, set the MFT_ENUM_FLAG_FIELDOFUSE flag when you register the MFT. This flag applies to the following MFT registration APIs:
By default, MFTs registered with this flag are excluded from enumeration results. To enumerate MFTs with field-of-use restrictions, call MFTEnumEx and specify the MFT_ENUM_FLAG_FIELDOFUSE flag in the Flags parameter. The following diagram illustrates this process.
The MFTEnum function always excludes any MFTs that have field-of-use restrictions.
To use an MFT with field-of-use restrictions, perform the following steps:
- The application implements the IMFFieldOfUseMFTUnlock interface.
- The IMFFieldOfUseMFTUnlock::Unlock method takes a pointer to the IUnknown interface of the MFT.
- In the Unlock method, the application performs the required handshake, using whatever mechanism is defined by the MFT. This step is not defined by Media Foundation API.
- If the Unlock method succeeds, the MFT unlocks itself.
The application specifies the IMFFieldOfUseMFTUnlock pointer by setting the MFT_FIELDOFUSE_UNLOCK_Attribute attribute. There are several different ways to set this attribute, depending on how your application creates the decoder or encoding pipeline:
|API||How to Unlock Field-Of-Use|
|Source Reader||If your application uses the Source Reader to decode a media file, set the MFT_FIELDOFUSE_UNLOCK_Attribute attribute in the configuration parameters. See Source Reader Attributes.|
|Sink Writer||If your application uses the sink writer to encode a media file, set the MFT_FIELDOFUSE_UNLOCK_Attribute attribute in the configuration parameters. See Sink Writer Attributes.|
|Fast Transcode||If your application uses the Fast Transcode feature to create an encoding topology, set the MFT_FIELDOFUSE_UNLOCK_Attribute when you call IMFTranscodeProfile::SetContainerAttributes. For more information about the Fast Transcode feature, see Transcode API.|
|Topology||If you create a topology directly, set the MFT_FIELDOFUSE_UNLOCK_Attribute as an attribute on the topology. See Topology Attributes.|
|MFT Activation Object|
The following diagram shows the relation between MFT activation objects and the IMFFieldOfUseMFTUnlock interface.