CBaseRenderer.ShouldDrawSampleNow 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 ShouldDrawSampleNow method determines how a sample is scheduled for rendering.

Syntax

virtual HRESULT ShouldDrawSampleNow(
   IMediaSample   *pMediaSample,
   REFERENCE_TIME *pStartTime,
   REFERENCE_TIME *pEndTime
);

Parameters

pMediaSample

Pointer to the sample's IMediaSample interface.

pStartTime

Pointer to a variable that contains the sample's start time.

pEndTime

Pointer to a variable that contains the sample's end time.

Return value

Returns S_FALSE. If the derived class overrides this method, return one of the values shown in the following table.

Return code Description
S_OK
The sample should be rendered immediately.
S_FALSE
The sample should be scheduled for rendering, based on the time stamps.
Error code
Do not render this sample.

Remarks

The CBaseRenderer::GetSampleTimes method calls this method. By default, samples are always scheduled for rendering based on their time stamps. The derived class can override this method; for example, to implement quality control.

Requirements

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

See also

CBaseRenderer Class