IMediaSeeking::SetTimeFormat method (strmif.h)

[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 SetTimeFormat method sets the time format for subsequent seek operations.

Syntax

HRESULT SetTimeFormat(
  [in] const GUID *pFormat
);

Parameters

[in] pFormat

Pointer to a GUID that specifies the time format. See Time Format GUIDs.

Return value

Returns an HRESULT value. Possible values include the following.

Return code Description
S_OK
Success.
E_INVALIDARG
Invalid argument.
E_NOTIMPL
Method is not supported.
E_POINTER
NULL pointer argument.
VFW_E_WRONG_STATE
Filter graph is not stopped.

Remarks

This method specifies the time units used by other IMediaSeeking methods, such as IMediaSeeking::GetPositions and IMediaSeeking::SetPositions. Whenever you call one of these other methods, any parameters that express time values are given in units of the current time format.

The default time format is REFERENCE_TIME units (100 nanoseconds). Other time formats include frames, samples, and bytes. To determine if a given format is supported, call the IMediaSeeking::IsFormatSupported method. If a format is supported, you can switch to that format by calling SetTimeFormat. Only one time format is active at any one time.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header strmif.h (include Dshow.h)
Library Strmiids.lib

See also

Error and Success Codes

IMediaSeeking Interface

IMediaSeeking::GetTimeFormat

IMediaSeeking::QueryPreferredFormat