AVStream Clocks

AVStream filters support clocks on pins.

To indicate that an AVStream pin exposes a clock, set KSPIN_FLAG_IMPLEMENT_CLOCK in the Flags member of the first KSPIN_DESCRIPTOR_EX in the PinDescriptors member of KSFILTER_DESCRIPTOR.

Also provide a pointer to a KSCLOCK_DISPATCH structure in KSPIN_DISPATCH.

To make clock requests, use the methods defined on the IKsReferenceClock interface. You can acquire an IKsReferenceClock interface by calling KsPinGetReferenceClockInterface. The AVStream minidriver is responsible for releasing the interface when finished.

To obtain timer values to place in the PresentationTime field of KSSTREAM_HEADER, call IKsReferenceClock::GetCorrelatedTime.

Note that the clock never appears in GraphEdit, even if the clock has been selected.

To verify that the clock has been selected, verify that calls to IKsReferenceClock methods generate calls to dispatch routines specified in KSCLOCK_DISPATCH.

The filter graph manager selects a clock when a graph transitions into the pause state. Any filter that is a push source, for instance a capture filter, is given preference as a clock provider.