Microsoft DirectX 8.1 (C++) |
One function of the Filter Graph Manager is to synchronize the filters in the graph. To accomplish this, the Filter Graph Manager and the filters all rely on a single clock, called the reference clock. Any object that exposes the IReferenceClock interface can act as a reference clock. For example, it might be a filter with access to a hardware timer. (The audio renderer is an example of a filter that provides a clock.) As a fallback, the Filter Graph Manager can use the system time.
Reference clocks measure time in 100-nanosecond intervals. To retrieve a clock's current time, call the IReferenceClock::GetTime method. A clock's baselinethe time from which it starts countingdepends on the clock's implementation, so the particular time value it returns is not inherently meaningful. What matters is that it returns monotonically increasing values at a rate of one per 100 nanoseconds.
Selecting a Reference Clock
The Filter Graph Manager automatically selects a reference clock at run time. It uses the following logic to select a clock:
An application can override the Filter Graph Manager's default choice by calling the IMediaFilter::SetSyncSource method on the Filter Graph Manager. You should do this only if you have a particular reason to prefer another clock. You can instruct the Filter Graph Manager not to use a reference clock by calling SetSyncSource with the value NULL. For example, you might do this to process samples as quickly as possible. To restore the default reference clock, call the IFilterGraph::SetDefaultSyncSource method on the Filter Graph Manager.
Whenever the reference clock changes, the Filter Graph Manager notifies each filter by calling its IMediaFilter::SetSyncSource method.