CBaseRenderer.PrepareReceive 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 PrepareReceive method prepares the filter to render a sample.

Syntax

virtual HRESULT PrepareReceive(
   IMediaSample *pMediaSample
);

Parameters

pMediaSample

Pointer to the sample's IMediaSample interface.

Return value

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

Return code Description
S_OK
Success.
E_FAIL
Failed.
E_UNEXPECTED
Unexpected error.
VFW_E_SAMPLE_REJECTED
Filter is dropping this sample.

Remarks

The filter calls this method from inside the CBaseRenderer::Receive method, before it renders a sample. If the filter is running, this method schedules the sample for rendering.

If the filter already has a pending sample, or if the end-of-stream was already reached, the method returns E_UNEXPECTED. Possibly the upstream filter is not serializing its streaming calls correctly.

If the scheduling algorithm determines that the sample should be dropped (see CBaseRenderer::ScheduleSample), the method returns VFW_E_SAMPLE_REJECTED. However, the input pin's IMemInputPin::Receive method does not pass this error code to the upstream filter, because dropping a sample is not an error.

Requirements

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

See also

CBaseRenderer Class