CTransformFilter.Receive method

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The Receive method receives a media sample, processes it, and delivers an output sample to the downstream filter.

Syntax

HRESULT Receive(
   IMediaSample *pSample
);

Parameters

pSample

Pointer to the IMediaSample interface on the input sample.

Return value

Returns an HRESULT value. Possible values include the following:

Return code Description
S_FALSE
The upstream filter should stop sending samples.
S_OK
Success.

Remarks

The filter's input pin calls this method when it receives a sample. This method calls the CTransformFilter::InitializeOutputSample method, which prepares a new output sample. Then it calls the CTransformFilter::Transform method, which the derived class must implement. The Transform method processes the input data and produces output data.

If the Transform method returns S_FALSE, the Receive method drops this sample. On the first dropped sample, the filter sends an EC_QUALITY_CHANGE event to the filter graph manager. Otherwise, if the Transform method returns S_OK, the filter delivers the output sample. To do so, it calls the IMemInputPin::Receive method on the downstream input pin.

Requirements

Requirement Value
Header
Transfrm.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CTransformFilter Class