|Microsoft DirectShow 9.0|
This topic applies only to Windows XP Service Pack 1 or later.
The IStreamBufferMediaSeeking interface controls seeking in a stream buffer source graph. The Stream Buffer Source filter exposes this interface.
The methods in this interface have exactly the same names and parameters as those in the IMediaSeeking interface. To seek within a stream buffer file, use this interface directly on the source filter instead of calling IMediaSeeking methods on the filter graph.
When the Stream Buffer Source plays a recording created by the Recording object or the RecComp object, it can seek anywhere within the file. When it plays a live stream from the Stream Buffer Sink, it can seek anywhere within the sink filter's buffer. This might include recorded content or temporary backing files. Transitions across files are seamless.
Live content from the Stream Buffer Sink grows on one end, as new content is recorded, and shrinks on the other end, as stale backing files are deleted. Therefore, the positioning information for this interface differs somewhat from the regular IMediaSeeking interface. The following definitions are used.
|Content start||The time of the earliest available content. For live content, the value starts at zero and increases whenever the Stream Buffer Engine deletes an old file.
For example, if there are six backing files, each 15 minutes long, then after 60 minutes the content start jumps to 15 minutes, as the first file is deleted.
|Content stop||The time of the latest available content. For live content, this value starts at zero and increases continuously.|
|Segment stop||The time when the Stream Buffer Source filter will stop playback. This value starts at positive infinity, but it can be set to arbitrary times by the application.
The segment stop time can be later than the content stop time, so it may not be possible to seek to this position. If playback reaches the end of the content before reaching the segment stop time, the graph sends an end-of-stream (EOS) event.
|Stream position||The current playback position, relative to the content start.
For example, if the source graph runs for 15 seconds and pauses for 10 seconds, the stream position remains at 15 seconds until the source graph runs again.
Given these definition, the following IStreamBufferMediaSeeking methods have special behaviors:
- GetAvailable: Returns content start and content stop.
- GetCurrentPosition: Returns stream position.
- GetDuration: Returns (content start – content stop).
- GetPositions: Returns stream position and segment stop.
- GetStopPosition: Returns segment stop.
- SetPosition: Sets stream position and segment stop.
The only time format supported by this interface is reference time (TIME_FORMAT_MEDIA_TIME). The Stream Buffer Engine does not support frame-accurate seeking.
For rate changes, the playback speed must be greater than 0.1 or less than -0.1. Negative rates indicate reverse playback. If the capture source is an MPEG-2 source, the MPEG-2 Video Analyzer filter is required to support playback faster than 4x or reverse playback. For more information, see Creating Stream Buffer Graphs.
The IStreamBufferMediaSeeking::SetRate method may return VFW_E_DVD_WRONG_SPEED if the requested rate is too high for very short content. This error is caused when the Stream Buffer Engine cannot get I frames for the available content at the requested rate.
The SetRate method may also return E_NOTIMPL. This error code can happen if several decoders are registered on the user's system. If so, use the standard IMediaSeeking::SetRate method on the source graph to set the playback rate. The IMediaSeeking version of SetRate may return VFW_E_UNSUPPORTED_AUDIO, which indicates that the audio decoder does not support trick mode. It is safe to ignore this error code.
The IStreamBufferMediaSeeking version of SetRate may also fail if the decoder does not support rates other than 1x speed.
Header: Include Sbe.h.