Hi folks,
Just a quick post to see if someone can clarify my understanding of kernel
streaming clocks.- I think I've got the basics, but there are a few loose
ends...
I've got a multimedia card with separate audio and video capture drivers
written under the stream class driver. At the moment, the captured audio &
video has a habit of drifting out of sync, so I need to put clock support
into the drivers. Additionally, the hardware has 27 MHz counter that can be
queried to give me a very accurate clock source.
As I currently understand it:
a) I need to get both audio and video capture drivers to support being a
master clock.
b) I need to get the drivers to be able to timestamp samples based on the
master clock for the graph (which might be themselves, or might be from
somewhere else).
Here's where I have a few questions...
Q'n 1. It seems that there seem to be several ways of doing "a)" and "b)"
- MSDN seems to indicate that I can do a) by including information in my
HW_STREAM_OBJECT indicating that I can act as a master clock, by including
appropriate clock support flags, and a callback routine (HW_CLOCK_OBJECT).
- If I do that, then my clock support is going via the stream class driver.
It then seems the the "similar" way of implementing b) is to use the
"StreamClassQueryMasterClock" routine, using the clock handle passed to my
driver via SRB_INDICATE_MASTER_CLOCK.
Make sense so far?
If so, then why is there also a whole load of KS Property stuff, which
provide similar functionality? It seems that if I want to provide a master
clock source via the KsProperty route,. then I'll have to implement
KSPROPSETID_Clock, and also KS_PROPERTY_STREAM_MASTERCLOCK.
Do I have to do both of these, or is it an either/or proposition, with the
stream class driver doing some behind the scenes work for me in the first
case?
Qn 2: If I have the two filters running, and both can provide a master
clock, then the audio capture driver will provide the master clock of the
graph - so I need to get the other driver to timestamp samples based on the
audio driver. StreamClassQueryMasterClock would seem to do the job if I want
to use stream.sys, however, it's asynchronous, and it doesn't seem sensible
to try and perform such a query every time a get a media sample. Any
suggestions on strategies for getting the drivers to query the master clock
at intervals and then interpolate? How is this normally done?
Qn3: If I was to use the property set approach, instead of
StreamClassQueryMasterClock, it seems that I need to get on driver to get
hold of the direct call interface (KSPROPERTY_CLOCK_FUNCTIONTABLE)
advertised by the other driver... how do I do that?
thanks in advance,
Martin Harvey.