IMFSourceReader::SetCurrentPosition method

Seeks to a new position in the media source.


HRESULT SetCurrentPosition(
  [in] REFGUID        guidTimeFormat,
  [in] REFPROPVARIANT varPosition


guidTimeFormat [in]

A GUID that specifies the time format. The time format defines the units for the varPosition parameter. The following value is defined for all media sources:


100-nanosecond units.


Some media sources might support additional values.

varPosition [in]

The position from which playback will be started. The units are specified by the guidTimeFormat parameter. If the guidTimeFormat parameter is GUID_NULL, set the variant type to VT_I8.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription

The method succeeded.


One or more sample requests are still pending.



The SetCurrentPosition method does not guarantee exact seeking. The accuracy of the seek depends on the media content. If the media content contains a video stream, the SetCurrentPosition method typically seeks to the nearest key frame before the desired position. The distance between key frames depends on several factors, including the encoder implementation, the video content, and the particular encoding settings used to encode the content. The distance between key frame can vary within a single video file (for example, depending on scene complexity).

After seeking, the application should call IMFSourceReader::ReadSample and advance to the desired position.

This interface is available on Windows Vista if Platform Update Supplement for Windows Vista is installed.


Minimum supported client

Windows 7, Windows Vista and Platform Update Supplement for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | Windows Store apps]



See also

Source Reader