Microsoft DirectX 9.0


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


HRESULT Receive(
    IMediaSample *pSample



Pointer to the IMediaSample interface on the input sample.

Return Value

Returns an HRESULT value. Possible values include the following:

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


This method calls CVideoTransformFilter::ShouldSkipFrame to determine whether it should deliver this sample or simply discard it. If ShouldSkipFrame returns FALSE (indicating the sample should be delivered), the method does the following:

  1. Calls CTransformFilter::InitializeOutputSample to prepare the output sample
  2. Calls CTransformFilter::Transform to process the input sample. This method is pure virtual, and must be implemented in the derived class.
  3. Calls CBaseOutputPin::Deliver to deliver the output sample.

Also, this method checks for format changes on the input or output sample, by calling IMediaSample::GetMediaType. If there is a format change, the method sets the connection type on the corresponding pin. Before it sets the new type, it calls StopStreaming. After it sets the new type, it calls StartStreaming. The derived class can use these methods to update its internal state. The derived class might also need to check for the new format in its Transform method.

See Also