Redigera

Dela via


Field of Use Restrictions

Note

This topic applies to Windows 7 or later.

 

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.

Registration and Enumeration

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.

diagram showing mft and an application sending data to the registry

The MFTEnum function always excludes any MFTs that have field-of-use restrictions.

Unlocking the MFT

To use an MFT with field-of-use restrictions, perform the following steps:

  1. The application implements the IMFFieldOfUseMFTUnlock interface.
  2. The IMFFieldOfUseMFTUnlock::Unlock method takes a pointer to the IUnknown interface of the MFT.
  3. 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.
  4. 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 If your application directly enumerates the decoders or encoders that it will use, set the MFT_FIELDOFUSE_UNLOCK_Attribute on the IMFActivate pointers returned by the MFTEnumEx function.
Set the attribute before calling IMFActivate::ActivateObject to create the MFT. The activation object calls IMFFieldOfUseMFTUnlock::Unlock when it creates the MFT.

 

The following diagram shows the relation between MFT activation objects and the IMFFieldOfUseMFTUnlock interface.

diagram showing an application, activation object and mft with arrows to an fou object, which has an arrow back to mft

Media Foundation Transforms