IMFClockStateSink::OnClockStart method (mfidl.h)

Called when the presentation clock starts.


HRESULT OnClockStart(
  [in] MFTIME   hnsSystemTime,
  [in] LONGLONG llClockStartOffset


[in] hnsSystemTime

The system time when the clock started, in 100-nanosecond units.

[in] llClockStartOffset

The new starting time for the clock, in 100-nanosecond units. This parameter can also equal PRESENTATION_CURRENT_POSITION, indicating the clock has started or restarted from its current position.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


This method is called when the presentation clock's IMFPresentationClock::Start method is called, with the following exception: If the clock is paused and Start is called with the value PRESENTATION_CURRENT_POSITION, IMFClockStateSink::OnClockRestart is called instead of OnClockStart.

The clock notifies the presentation time source by calling the time source's OnClockStart method. This call occurs synchronously within the Start method. If the time source returns an error from OnClockStart, the presentation clock's Start method returns an error and the state change does not take place.

For any object that is not the presentation time source, the OnClockStart method is called asynchronously, after the state change is completed. In that case, the return value from this method is ignored.

The value given in llClockStartOffset is the presentation time when the clock starts, so it is relative to the start of the presentation. Media sinks should not render any data with a presentation time earlier than llClockStartOffSet. If a sample straddles the offset—that is, if the offset falls between the sample's start and stop times—the sink should either trim the sample so that only data after llClockStartOffset is rendered, or else simply drop the sample.


Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header mfidl.h
Library Mfuuid.lib

See also



Presentation Clock