IMediaPosition Interface

It is recommended that the IMediaSeeking interface be used instead of IMediaPosition. This depreciated interface is no longer fully supported.

Applications communicating with the filter graph can call methods on the IMediaPosition interface to set or retrieve properties such as the duration of the stream, the start and stop times, the preroll time, the rate, and the current position. The filter graph uses these properties on seekable filters to control the playback of streams within the graph; where there are multiple streams, the filter graph sets them all to play in parallel, beginning at the same position, and will report the duration as being the duration of the longest stream. The REFTIME parameters used in this interface are double value, representing a fractional number of seconds. Internally, filters will store time to an accuracy of 100 nanoseconds.

When to Implement

The filter graph manager exposes the IMediaPosition interface if any of the filters within the graph are seekable (can seek to an arbitrary position in the stream). This normally means a seekable file source filter. Filters, such as a file source filter, will expose IMediaPosition if they can seek their data or if their output pin represents a seekable stream. The renderer filter should also expose this interface. Output pins of transform filters expose this interface to pass the positioning information upstream from the renderer through each intermediate filter to the seekable filter.

Use the CMediaPosition class to help implement this interface on a filter. Use the CPosPassThru base class to implement this interface on output pins of transform filters used to pass media positioning information upstream. This is enabled by default in the pin base classes.

When to Use

Applications can use this interface to set or retrieve media positioning properties. Most commonly, an application will use the methods on this interface to play a media stream for some duration starting at some set position in the stream (for example, 10 seconds from the start).

Methods in Vtable Order

The following tables show the methods that appear in the Vtable beneath the standard COM methods inherited from IUnknown.

IDispatch method Description
GetTypeInfoCount Determines whether there is type information available for this dispinterface.
GetTypeInfo Retrieves the type information for this dispinterface if GetTypeInfoCount returned successfully.
GetIDsOfNames Converts text names of properties and methods (including arguments) to their corresponding DISPIDs.
Invoke Calls a method or accesses a property in this dispinterface if given a DISPID and any other necessary parameters.
IMediaPosition method Description
get_Duration Retrieves the total duration of the media stream.
put_CurrentPosition Sets the time that the media stream begins.
get_CurrentPosition Retrieves the current position in terms of the total length of the media stream.
get_StopTime Retrieves the position within the media stream at which playback should stop.
put_StopTime Sets the position within the media stream at which playback should stop.
get_PrerollTime Retrieves the time prior to the start position that the filter graph begins any nonrandom access device rolling.
put_PrerollTime Sets the time prior to the start position that the filter graph begins any nonrandom access device rolling.
put_Rate Sets the playback rate, relative to normal playback of the media stream.
get_Rate Retrieves the playback rate, relative to normal playback of the media stream.
CanSeekForward Determines if the current position can be moved forward in the media stream.
CanSeekBackward Determines if the current position can be moved backward in the media stream.

Requirements

DirectShow applications and DirectShow filters have different include file and link library requirements. See Setting Up the Build Environment for more information.

OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.

See Also

DirectShow Interfaces

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.