CTransformInputPin.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 the next media sample in the stream. This method implements the IMemInputPin::Receive method.

Syntax

HRESULT Receive(
   IMediaSample *pSample
);

Parameters

pSample

Pointer to the sample's IMediaSample interface.

Return value

Returns an HRESULT value. Possible values include those shown in the following table.

Return code Description
S_FALSE
Pin is currently flushing; sample was rejected.
S_OK
Success.

Remarks

This method calls the pin's CBaseInputPin::Receive method, which checks the pin's streaming state and checks for format changes in the media type. Then it calls the filter's CTransformFilter::Receive method, which processes the sample and delivers it downstream.

If the filter needs to access the sample after this method returns, it should hold a reference count by calling the IUnknown::AddRef method on the sample. For example, some decoder filters need the current sample in order to decode the next sample.

Requirements

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