Discussion:
Seek to near end of file
(too old to reply)
M Lafferty
2010-03-10 14:21:01 UTC
Permalink
I am using IWMSyncReader to access a wmv file. The file is indexed.

When I use IWMSyncReader::SetRangeByFrame the method fails if the FrameNo is
within 11 frames of the end of the file.

The file is 662 frames long

SetRangeByFrame(650, 0) works OK
SetRangeByFrame(651, 0) fails, with result 0xC00D002B.

This is a problem, as my application regularly needs to seek to the end of
the file. I could seek to the last possible frame, then GetNextFrame to where
I want to be, but this is very inefficient and I have no way of knowing the
position of the last seekable frame.

Does anyone have any advice?

regards

ML
Jeremy Noring
2010-03-18 23:50:57 UTC
Permalink
Post by M Lafferty
I am using IWMSyncReader to access a wmv file. The file is indexed.
When I use IWMSyncReader::SetRangeByFrame the method fails if the FrameNo is
within 11 frames of the end of the file.
The file is 662 frames long
SetRangeByFrame(650, 0) works OK
SetRangeByFrame(651, 0) fails, with result 0xC00D002B.
This is a problem, as my application regularly needs to seek to the end of
the file. I could seek to the last possible frame, then GetNextFrame to where
I want to be, but this is very inefficient and I have no way of knowing the
position of the last seekable frame.
Does your file have multiple streams (I see you omitted the first
argument in your posted code)? The documentation notes:

"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."

But if one of your streams doesn't have presentation times beyond
frame 650, then presumably this call would return some sort of error
(???).

Loading...