CBaseRenderer.GetSampleTimes 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 GetSampleTimes method retrieves the time stamps from a sample.

Syntax

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

Parameters

pMediaSample

Pointer to the sample's IMediaSample interface.

pStartTime

Pointer to a variable that receives the start time.

pEndTime

Pointer to a variable that receives the end time.

Return value

Returns an HRESULT value. Possible values include those 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.
E_FAIL
Do not render this sample.
VFW_E_START_TIME_AFTER_END
Bad time stamp: The end time is earlier than the start time.

Remarks

The filter calls this method to determine how it should handle a sample. If the return value is S_OK, the filter renders the sample immediately. If the return value is S_FALSE, the filter schedules the sample for rendering, based on the time stamps. If the return value is an error code, the filter rejects the sample.

This method returns S_OK if the sample has no time stamps, or if the filter does not have a reference clock. Otherwise, it returns the value of the CBaseRenderer::ShouldDrawSampleNow method. In the base class, ShouldDrawSampleNow always returns S_FALSE. The derived class can override this behavior. For example, if the derived class implements quality control management, it might return E_FAIL to drop a sample.

Requirements

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

See also

CBaseRenderer Class