IWMSyncReader::SetRangeByFrame method

The SetRangeByFrame method configures the synchronous reader to read a portion of the file specified by a starting video frame number and a number of frames to read.

Syntax

HRESULT SetRangeByFrame(
  WORD     wStreamNum,
  QWORD    qwFrameNumber,
  LONGLONG cFramesToRead
);

Parameters

wStreamNum

Stream number.

qwFrameNumber

Frame number at which to begin playback. The first frame in a file is number 1.

cFramesToRead

Count of frames to read. Pass 0 to continue playback to the end of the file.

Return value

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

Return code Description
S_OK
The method succeeded.
E_INVALIDARG
cFramesToRead contains a negative number.

Remarks

If the call is successful, all streams are synchronized to the same position based on the presentation time of the selected frame. Subsequent calls to GetNextSample will retrieve samples for all active streams, not just the stream specified in the call to SetRangeByFrame. If you want to receive only samples for a single video stream by frame, you must call SetStreamsSelected and pass the desired stream number prior to calling GetNextSample.

To use SetRangeByFrame, the file in the synchronous reader must be indexed by frame numbers. You can configure the indexer object to index by frame numbers with a call to IWMIndexer2::Configure. Then make a call to IWMIndexer::StartIndexing to index the file with the new settings.

When you set a range for compressed sample delivery using a starting frame number, the synchronous reader will deliver samples starting at the first key frame before the specified frame. If you want to identify the presentation time of a frame, use IWMSyncReader2::SetRangeByFrameEx.

Passing a negative number results in an error.

You can call SetRangeByFrame at any time after a file has been loaded in the synchronous reader.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 9 Series SDK, or later versions of the SDK
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wmsdkidl.h (include Wmsdk.h)
Library Wmvcore.lib; WMStubDRM.lib (if you use DRM)

See also

IWMIndexer Interface

IWMSyncReader Interface

IWMSyncReader2::SetRangeByFrameEx

IWMSyncReader::SetRange