MFT_MESSAGE_COMMAND_DRAIN
Requests a Media Foundation transform (MFT) to drain all stored data.
Message Parameter
None.
Remarks
To send this message, call IMFTransform::ProcessMessage.
After this message is sent, the specified input stream does not accept input until the MFT processes all data from previous calls to IMFTransform::ProcessInput.
The draining process varies slightly between synchronous MFTs and asynchronous MFTs:
Synchronous MFTs
- After the client sends this message, it calls IMFTransform::ProcessOutput in a loop, until ProcessOutput returns the error code MF_E_TRANSFORM_NEED_MORE_INPUT.
- As long as the MFT still has data to process, further calls to ProcessInput will fail. The MFT continues to produce output until it uses all stored data. The MFT discards any data that cannot be processed into a complete output sample. (For example, it should drop a partial video frame.)
Asynchronous MFTs
- The MFT continues to send METransformHaveOutput events until it has no more data to process. It does not send METransformNeedInput events during this time.
- After the MFT sends the last METransformHaveOutput event, it sends an METransformDrainComplete event.
- After draining is complete, the MFT does not send another METransformNeedInput event until it receives an MFT_MESSAGE_NOTIFY_START_OF_STREAM message from the client.
After the client has drained the MFT, the client can send more input data. The first sample after the drain operation must have the discontinuity attribute (MFSampleExtension_Discontinuity attribute).
Note
Earlier versions of this documentation stated that the ulParam event parameter is a member of the _MFT_DRAIN_TYPE enumeration. That is not correct. The ulParam contains a stream identifier.
Implementation
An asynchronous MFT must always return METransformDrainComplete after it has drained.
A synchronous MFT can ignore this message and return S_OK if the following conditions are true:
- The MFT never stores more than one input sample at a time.
- Each input sample produces a single output sample.
Otherwise, a synchronous MFT must implement this message.
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista [desktop apps only] |
Minimum supported server |
Windows Server 2008 [desktop apps only] |
Header |
|
See also