My Project
Clock Framework

The MMAL clock framework provides scheduling facilities to the rest of MMAL.

The framework consists mainly of clock ports and a clock module. Client applications and components interact directly with clock ports, while the clock module is only used internally by clock ports.

Clock ports ensure that the local media-time for each component is synchronised across all components. This is done by passing buffers between clock ports which contain clock-specific data.

One clock port will normally act as the reference clock for the rest of the system. This is usually chosen to be the clock port of the audio render component, but is configurable by the client and could potentially be any other clock port (or even the client application itself).

Components that are responsible for timed delivery of frames, do so by registering callback requests for a particular time-stamp with the clock port. These requests are scheduled using the clock module which maintains an internal media-time.

The clock framework also provides the ability to perform playback at different speeds. This is achieved with a clock scale factor which determines the speed at which the media-time advances relative to real-time, with: scale = 1.0 -> normal playback speed scale = 0 -> playback paused scale > 1.0 -> fast-forward scale < 1.0 -> slow motion