Clock components provide two basic services: they generate time information and schedule time-based callback events. QuickTime uses clock components to drive movie time bases. Applications can change the clock used for a movie’s time base. Applications may also use clock components to schedule application-defined callback events.
Clock Components and Movie Time Bases
Interrupts and Callbacks
A clock component provides realtime clock information derived from an external source, typically a hardware source.
Figure 2-1 shows the relationships between an application, the movie controller component, the Movie Toolbox, and a clock component.
Clock components are used by the Movie Toolbox for time bases. A time base defines a movie’s current time value and the rate at which time passes for the movie. The rate specifies the speed and direction in which time travels in a movie. A time base also contains a reference to a clock which provides timing for the time base. The clock component used to drive a movie’s time base is known as the movie master clock.
QuickTime chooses a default master clock, known as the default clock, depending on the movie media types. If you play a movie containing a sound track, QuickTime uses the sound clock by default. If the movie lacks a sound track, QuickTime uses the system clock as the default master clock.
You can obtain the clock component associated with a given media by calling MediaGetClock
. You can also change the master clock associated with a movie’s time base. For details, see Movie Clocks, Sound Clocks, and Video Output.
Your application can call any clock component function at interrupt time, except for the ClockNewCallBack
and ClockDisposeCallBack
functions. In addition, your application should not call the Component Manager’s open or close component functions, such as OpenComponent
, OpenAComponent
, OpenADefaultComponent
, or CloseComponent
, at interrupt time.
Clock components may also support time-based callback events. The Movie Toolbox’s time base functions allow applications and other programs to schedule functions to be called in specified circumstances. Since time bases derive their time information from clock components, ultimate responsibility for servicing these callback functions also falls to clock components.
The Movie Toolbox provides a set of support functions that clock component authors can use to manage callback events. These functions are described in Clock Component Functions.
A clock component is not required to support callback functions. Clock component authors can delegate this responsibility to another clock component. Component Capability Flags for Clocks describes how a clock component can tell the Component Manager that the clock component does not support callback functions.
© 2005, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-01-10)