Microsoft DirectX 9.0

IMediaFilter::SetSyncSource

The SetSyncSource method sets the reference clock.

Syntax

HRESULT SetSyncSource(
  IReferenceClock *pClock
);

Parameters

pClock

[in] Pointer to the clock's IReferenceClock interface, or NULL.

Return Value

Returns S_OK if successful, or an HRESULT value indicating the cause of the error.

Remarks

All the filters in the filter graph share the same reference clock, in order to stay synchronized. Stream time is calculated from the reference clock. Renderer filters use the reference clock to schedule when they render samples. If there is no reference clock, a renderer filter renders every sample as soon as it arrives.

This method is implemented by all DirectShow filters, and also by the Filter Graph Manager.

Filter Implementation

When the graph runs, the Filter Graph manager calls this method on every filter in the graph, to notify them of the graph reference clock. Use this method to store the IReferenceClock pointer. Increment the reference count on the stored pointer. Before the filter is removed from the graph, the Filter Graph Manager calls SetSyncSource again with the value NULL. Release the stored pointer and set it to NULL.

The CBaseFilter class implements this method; see CBaseFilter::SetSyncSource.

Note that filters cannot use this method to select the graph clock. In filters, the only function of this method is to inform the filter of the clock that the graph is using. A filter can provide a reference clock by exposing the IReferenceClock interface. For more information, see Time and Clocks in DirectShow.

Application Use

An application can override the default clock by calling SetSyncSource on the Filter Graph Manager. Do not do this unless you have a particular reason to prefer another clock. You can also set the graph not to use any reference clock, by calling SetSyncSource with the value NULL. You might do this to process samples as quickly as possible. For more information, see Setting the Graph Clock.

Applications should never call this method on filters.

See Also