IAMPushSource Interface

 
Microsoft DirectShow 9.0

IAMPushSource Interface

The IAMPushSource interface synchronizes a filter graph that renders a live source. A live source is a source that streams data in real time, such as a capture device or a network broadcast.

Source filters that stream live data should expose this interface on their output pins. Generally, applications should not call the methods on this interface; instead, use the IAMGraphStreams interface.

In addition to the methods inherited from IAMLatency, the IAMGraphStreams interface exposes the following methods.

Method Description
GetMaxStreamOffset Retrieves the maximum stream offset the filter can support.
GetPushSourceFlags Retrieves a combination of flags describing the behavior of the filter.
GetStreamOffset Retrieves the offset that the filter uses when generating time stamps.
SetMaxStreamOffset Reference time specifying the maximum stream offset.
SetPushSourceFlags Sets flags that specify the behavior of the filter.
SetStreamOffset Sets the offset for time stamps generated by this filter.

Remarks

The Filter Graph Manager uses the methods on this interface to address two problems that commonly occur when rendering live sources:

  • Latency: When a filter graph includes more than one live source, the sources often have different latencies, which can cause them to be out of sync. For example, if audio capture has a longer latency time than video capture, the audio will lag behind the video unless the graph compensates for the difference.
  • Rate Matching: When a renderer filter is connected to a live source, it must adjust its data consumption rate to match the source filter's production rate. Otherwise, there might be gaps in the data (if the renderer runs faster than the source) or data might get dropped (if the source runs faster).

To correct for latency, the filter graph callsIAMLatency::GetLatency on each output pin that exposes the IAMPushSource interface, and determines the maximum latency in the graph. It then calls IAMPushSource::SetStreamOffset on any filters with less than the maximum latency, so that they will adjust the time stamps they generate by the correct offset.

To perform rate matching, the filter graph needs to determine whether the renderer filter can match clock rates with the source filter. The IAMPushSource::GetPushSourceFlags method returns a set of flags indicating whether it is safe for the renderer to match rates with the source.

These issues do not affect capturing to a file. The File Writer filter relies on time stamps on the incoming samples to write the file correctly; the streams are then synchronized during playback. As for rate matching, the data is always written to the file as fast as possible.

Requirements

Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.