To Seek By SMPTE Time Code Using the Asynchronous Reader
[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
The reader object can seek to a point in a file based on the SMPTE time code associated with a video stream. Time code data is encapsulated in WMT_TIMECODE_EXTENSION_DATA structures that are attached to video samples as data unit extensions.
SMPTE time codes are defined by a range and a time code within that range. A range is a continuous series of time codes. Each time code is defined by hours, minutes, seconds, and frames.
To seek data in an ASF file by SMPTE time code using the asynchronous reader, perform the following steps.
- Obtain a pointer to the IWMReaderAdvanced3 interface of the reader object by calling IWMReader::QueryInterface.
- Set the starting time code and duration by calling IWMReaderAdvanced3::StartAtPosition. You must specify the stream number of a video stream that is indexed by time code. The reader will synchronize the rest of the outputs to the presentation time of the specified frame of the specified stream and begin delivering output samples.
- Handle the samples as you normally would in your implementation of the IWMReaderCallback::OnSample method.
Related topics