Re: find time difference between audio renderer clock & system clock



IUnknown wrote:

Regarding a past post "I wound up getting the reference
clock using IMediaFilter::GetSyncSource() to get an
IReferenceClock pointer then I call
IReferenceClock::GetTime()."

How do you go about querying the renderer's
IReferenceClock from within an intermediate filter?

For instance, if I would want to query the audio
renderer's clock for IReferenceClock inside of my filter,
can I do this in:

HRESULT CTeeInputPin::Receive(IMediaSample *pSample)

If so, what would the code look like, to specifcy that
I'm querying the renderer filter? Does this entail going
through the audio output pin in my filter? I would then
get the system's reference clock and compare the
difference between the two.

For some reason I'm not following how another filter's
reference clock (such as the audio renderer) interface
can be specified/queried inside of another filter (such
as inftee or a transform filter). I can and have seen it
done in DirectShow applications, but not in a filter
itself!

Once your filter has been added to the graph, it has a
reference to the enclosing graph, which you can query for
IMediaFilter in order to get a reference to the graph's
clock (you should get a new one each time you run and
release it when stopped or, if your using the BaseClasses,
just use CBaseFilter::m_pClock).

The graph's clock can be anything, including nothing (NULL).
By default, the stock graph builder will try to use one of
the filters' clock as graph clock, typically the audio
renderer's, and fall back to the system clock if no filter
provides one (more specifically, it falls back to using
CLSID_SystemClock which internally queries the multimedia
timer, that is timeGetTime(), and not the system timer).

If, for some reason, you know your graph contains a given
filter that provides a given clock and you want to use that
one instead of the graph's clock, you can use your reference
to the graph (e.g. CBaseFilter::m_pGraph) to enum the
filters and get a reference to the filter you want, so that
you can ask it for its clock.


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// a dot angeli at psynet dot net
// http://www.riseoftheants.com/mmx/faq.htm


.



Relevant Pages

  • Re: Controlling DataFlow upstream of a Smart Tee.
    ... > Source Filter instead of Device Capture Filter). ... The graph I made works ... If you take the file and render it in GraphEdit, ... clock) but an async file reader. ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: XilinxSystemGenerator and Simulink
    ... When I run the simulation I never get past the 0ps point and I get the ... Yesterday by editing the config.m file for the filter I eventually got ... the 200KHz clock that the same indeterminate Boolean value error occurred!. ... I've been working on a simulink model built using the Xilinx Blockset ...
    (comp.arch.fpga)
  • Re: frequency adjusting only
    ... The clock filter, which I call a minimum filter, selects from the last eight samples the one with minimum delay. ... Since the reference clock delay is always zero, the algorithm selects the most recent sample and the filter is effectively out of the loop. ... When you come right down to it and scrape the barnacles away, both NTP and PTP use the same four-timestamp protocol, although NTP is symmetric ...
    (comp.protocols.time.ntp)
  • Re: destroying graph
    ... > reference to them, ... > graph has the filter references, ... Actually, when a filter is in a graph, there is a circular ... // a dot angeli at psynet dot net ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: XilinxSystemGenerator and Simulink
    ... I've been working on a simulink model built using the Xilinx Blockset to ... try to verify the function of an interplation filter made from the MacFir ... The Modelsim simulation of the whole VHDL coded system seems to be ... The system clock in the "real" VHDL system is ...
    (comp.arch.fpga)

Loading