CBaseFilter.StreamTime 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 StreamTime method retrieves the current stream time.

Syntax

virtual HRESULT StreamTime(
  [ref] CRefTime &rtStream
);

Parameters

rtStream [ref]

Reference to a CRefTime object that receives the current stream time.

Return value

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

Return code Description
S_OK
Success.
VFW_E_NO_CLOCK
No reference clock is available.

Remarks

Stream time is defined as the current reference time (as given by the reference clock) minus the start time (specified by CBaseFilter::m_tStart). A media sample's time stamp specifies the stream time when it should be rendered. If a sample with a time stamp less than the current stream time has not yet been rendered, it is late.

This method gets the stream time by calling IReferenceClock::GetTime to get the current reference time, and then subtracting the initial start time.

Requirements

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

See also

Time and Clocks in DirectShow

CBaseFilter Class