Re: find time difference between audio renderer clock & system clock
- From: "Alessandro Angeli [MVP::DS/MF]" <nobody@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 13 Sep 2006 14:05:31 +0200
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
.
- Follow-Ups:
- References:
- Prev by Date: Re: How to copy source/data of LDIRECTSOUNDBUFFER to LDIRECTSOUNDBUFFER8 variable.
- Next by Date: Re: Build virtual audio driver with Directsound and use with Skype?
- Previous by thread: find time difference between audio renderer clock & system clock
- Next by thread: Re: find time difference between audio renderer clock & system clock
- Index(es):
Relevant Pages
|
Loading