CBaseReferenceClock Class (Compact 2013)

3/26/2014

CCritSec Class

     IReferenceClock Interface

          CBaseReferenceClock Class

This base class implements the IReferenceClock interface.

The CBaseReferenceClock class provides a full implementation of IReferenceClock. It uses CCritSec locking support and CAMSchedule scheduler support.

Each advise call defines a point in time when the caller wants to be notified. A periodic advise is a regular series of such events.

A list of these advise requests is maintained by the reference clock. The clock calculates the delay until the first requested advise, and signals an event at the due time.

Clients are not advised through callbacks. One-shot clients have an event set, while periodic clients have a semaphore released for each event notification.

A semaphore allows a client to know exactly how many events were triggered, because multiple time periods might elapse before the client code executes.

During class construction, a worker thread is created. This thread executes a series of Win32 WaitForSingleObject calls, waking up when a command is given to the thread or the next wake-up point is reached.

The wake-up points are determined by clients making advise calls.

Protected Data Members

Member

Description

m_pSchedule

Pointer to the CAMSchedule object associated with this CBaseReferenceClock object.

Member Functions

Member function

Description

CBaseReferenceClock

Constructs a CBaseReferenceClock object.

GetSchedule

Returns the CAMSchedule pointer stored in the m_pSchedule data member.

SetTimeDelta

Adjusts the values returned from CBaseReferenceClock::GetPrivateTime by the amount specified in this member function.

TriggerThread

Triggers the advise thread's event.

If you override CBaseReferenceClock::GetPrivateTime, reuse or abandon this method.

Implemented IReferenceClock Methods

Method

Description

AdvisePeriodic

Requests an asynchronous periodic notification that a time has elapsed.

AdviseTime

Requests an asynchronous notification that a time has elapsed.

GetTime

Returns a reference time.

Unadvise

Removes a previously established advise link.

Overrideable Member Functions

Member function

Description

GetPrivateTime

Gets the current time from the real clock.

To implement your own clock, override this member function.

Implemented INonDelegatingUnknown Methods

Method

Description

NonDelegatingQueryInterface

Returns a pointer to interfaces supported, that is, IReferenceClock.

Requirements

Header

dshow.h,
Streams.h

Library

ole32.lib,
Ole32auth.lib,
Strmbase.lib,
Strmiids.lib,
uuid.lib

See Also

Reference

DirectShow Classes