IMFTransform::ProcessInput method (mftransform.h)
Delivers data to an input stream on this Media Foundation transform (MFT).
Syntax
HRESULT ProcessInput(
[in] DWORD dwInputStreamID,
[in] IMFSample *pSample,
[in] DWORD dwFlags
);
Parameters
[in] dwInputStreamID
Input stream identifier. To get the list of stream identifiers, call IMFTransform::GetStreamIDs.
[in] pSample
Pointer to the IMFSample interface of the input sample. The sample must contain at least one media buffer that contains valid input data.
[in] dwFlags
Reserved. Must be zero.
Return value
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
Return code | Description |
---|---|
|
The method succeeded. |
|
Invalid argument. |
|
Invalid stream identifier. |
|
The input sample requires a valid sample duration. To set the duration, call IMFSample::SetSampleDuration.
Some MFTs require that input samples have valid durations. Some MFTs do not require sample durations. |
|
The input sample requires a time stamp. To set the time stamp, call IMFSample::SetSampleTime.
Some MFTs require that input samples have valid time stamps. Some MFTs do not require time stamps. |
|
The transform cannot process more input at this time. |
|
The media type is not set on one or more streams. |
|
The media type is not supported for DirectX Video Acceleration (DXVA). A DXVA-enabled decoder might return this error code. |
Remarks
In most cases, if the method succeeds, the MFT stores the sample and holds a reference count on the IMFSample pointer. Do not re-use the sample until the MFT releases the sample. Instead of storing the sample, however, an MFT might copy the sample data into a new buffer. In that case, the MFT should set the MFT_INPUT_STREAM_DOES_NOT_ADDREF flag in the IMFTransform::GetInputStreamInfo method.
If the MFT already has enough input data to produce an output sample, it does not accept new input data, and ProcessInput returns MF_E_NOTACCEPTING. At that point, the client should clear the pending input data by doing one of the following:
- Generate new output by calling IMFTransform::ProcessOutput.
- Flush the input data by calling IMFTransform::ProcessMessage with the MFT_MESSAGE_COMMAND_FLUSH message.
An MFT can process the input data in the ProcessInput method. However, most MFTs wait until the client calls ProcessOutput.
After the client has set valid media types on all of the streams, the MFT should always be in one of two states: Able to accept more input, or able to produce more output. It should never be in both states or neither state. An MFT should only accept as much input as it needs to generate at least one output sample, at which point ProcessInput returns MF_E_NOTACCEPTING. When ProcessInput returns MF_E_NOTACCEPTING, the client can assume that the MFT is ready to produce output.
If an MFT encounters a non-fatal error in the input data, it can simply drop the data and attempt to recover when it gets the more input data. To request more input data, the MFT returns MF_E_TRANSFORM_NEED_MORE_INPUT from the IMFTransform::ProcessOutput method. If the MFT drops any data, it should set the MFSampleExtension_Discontinuity attribute attribute on the next output sample, to notify the caller that there is a gap in the data stream.
If MFT_UNIQUE_METHOD_NAMES is defined before including mftransform.h, this method is renamed MFTProcessInput. See Creating Hybrid DMO/MFT Objects.
Asynchronous Processing
The previous remarks describe the synchronous processing model. To support asynchronous processing, see Asynchronous MFTs.Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | mftransform.h |
Library | Mfuuid.lib |