Share via


Media Control and Positioning Classes (Compact 2013)

3/26/2014

Media control interfaces pass commands such as Run, Stop, or Pause from an application through the filter graph manager to the individual filters.

From the filter's perspective, the only control interface that is necessary is IMediaFilter. This interface exposes methods to accept and implement these commands. The CBaseFilter class implements this interface. All other interfaces that expose media control methods are handled by the filter graph manager and are therefore already implemented.

Although a CMediaControl class exists and implements the IMediaControl interface, it is not often used because the filter graph manager is responsible for this functionality.

The following illustration shows the relationship between these classes and interfaces.

Ee494801.7f273607-bc9e-4a3a-9390-c134c7ea787f(en-us,WinEmbedded.80).gif

Media positioning interfaces start the media stream at a specified position, play the stream for a specified period of time, or change the rate of the media stream.

The IMediaPosition interface is the primary interface supporting this functionality. The CMediaPosition class implements this interface and serves as a base class for two other classes: CPosPassThru and CSourcePosition.

Typically, the filter graph manager calls the IMediaPosition interface on the renderer filters when it wants to position the media stream.

The renderer acknowledges the sample times that it will be expected to display and then passes the media positioning data upstream, destined for a seekable filter, such as a source file filter, that can provide the properly positioned source stream.

To pass that information upstream, output pins must be able to receive the positioning information.

The CPosPassThru class implements the IMediaPosition interface and the IMediaSeeking interface on the output pins of filters and, for the most part, does nothing but call the corresponding interface on the output pin of the next upstream filter, thereby passing through the positioning data.

IMediaSeeking is different than IMediaPosition in that it allows the media stream to be searched based on units other than time, such as frames, samples, or indexed fields in an MPEG format.

The CRendererPosPassThru class, implemented on a video renderer, sets the start and end reference times on individual samples, so that samples can be queried at any time for this information. This is helpful when dealing with seeking by using IMediaSeeking.

IMediaSeeking seeks to media time, and does not keep track of the sample's reference time.

The reason for serially informing every filter in the graph of the new position is to allow filters that might be concerned with media positioning to be prepared for the new position.

For example, certain stream splitters might be splitting off streams with media positions relative to the main media stream. This is why the filter graph manager does not simply call the source filter's IMediaPosition or IMediaSeeking interface directly.

CSourcePosition is the class that helps the source filter implement its IMediaPosition interface.

The CSourceSeeking class helps the source filter implement its IMediaSeeking interface. This class enables a source filter to handle calls that change the start and stop positions in the media stream, and the playback rate.

The CBaseStreamControl class helps the source filter implement its IAMStreamControl interface. This class is used primarily by capture filters.

The following illustration shows the relationship between CBaseStreamControl and the interfaces from which it inherits.

Ee494801.6e84577c-92be-4a0b-accf-40ed094f279f(en-us,WinEmbedded.80).gif

See Also

Reference

Base Classes that Implement Interfaces