The QuickTime programming architecture is a combination of flexible tool sets and plug-in components.
Tool Sets
Components
Examples
Output
To support the complete spectrum of multimedia tasks, the QuickTime API contains a collection of toolsets, such as the Movie Toolbox, the Image Compression Manager, the sequence grabber, and the QuickTime streaming API.
The Movie Toolbox is used to initialize QuickTime; open, play, edit, and save movies; and manipulate time-based media.
The Image Compression Manager is a device-independent and driver-independent means of compressing and decompressing image data.
The sequence grabber is a framework for components that capture and record samples from real-time sources, such as video cards or audio inputs.
The streaming API allows you to send and receive real-time streams using standard protocols such as RTP and RTSP.
There are several other tool sets, including QuickTime VR, the sprite toolbox, and the wired movies API, but you don’t need to use them all or even know them all. These tool sets work together, allowing you to focus on the task at hand, without needing to learn the entire QuickTime API. The different tool sets often share data types and programming paradigms, making it relatively easy to extend your knowledge of QuickTime as you go.
Many tool sets are useful when you need direct access to things that QuickTime usually deals with automatically. For example, when you use the Movie Toolbox to play a movie, it may open a stream of real-time data and decompress a series of images, without requiring you to interact with the streaming API or the Image Compression Manager. But if you need to check for streaming packet loss or be notified each time an image is decompressed, you can use the appropriate tool set from your application.
The QuickTime architecture makes extensive use of components, making it modular, flexible, and extensible. A QuickTime component is a shared code resource with a defined API. It is possible to add a new component to QuickTime and have existing applications automatically find it and use it when needed, largely because it responds to the same API as existing components of that general type.
For example, QuickTime works with a number of media types: sound, video, text, sprites, Flash, 3D models, photographic virtual reality, and others. Each media type is supported by a media handler component. The number and types of supported media are continually growing. You can add a new media type to QuickTime yourself by creating a new media handler component.
There are also component types for controlling and playing movies, importing and exporting media, compressing and decompressing images or sound, accessing data (from file systems, network servers, or blocks of memory), capturing sequences of digitized sample data, and so on. Here is a partial list:
Movie controller components are used to play movies and can provide a standard user interface.
Media handler components handle a particular type of media data, such as video, sound, Flash, or text.
Data handler components access data from a particular kind of data source, such as local files, URLs, or handles.
Image compressor components compress or decompress image data.
Image compression dialog components let the user specify the parameters for compression operations.
Video digitizer components are used to control video digitization by external devices such as video capture cards.
Movie data-exchange components (also known as movie import and movie export components) move data between QuickTime and other formats. QuickTime can play any type of media file for which it has an importer or create any type for which it has an exporter.
Video output components convert the visual output of QuickTime movies into video streams for devices other than displays.
Graphics import and export components provide a single API that lets you work with a wide variety of image file formats.
Music components process and synthesize MIDI-like music tracks in QuickTime movies.
Effects and transitions components implement visual filters, effects, and transitions. (Effects components are implemented as a special type of image compressor component.)
As with tool sets, you don’t need to work with, or even know about, every type of component. Most components are used automatically as needed, but most also support an API that you can work with directly when you want to.
Each component has a type, a subtype, and a manufacturer code, each represented by a four-character code. A four-character code is a 32-bit value that is usually best interpreted as four ASCII characters. For example, an image decompressor component has a type of 'imdc'.
QuickTime often has multiple components of a given type. For example, QuickTime has many decompressor components. They all have the same type: 'imdc'. Each 'imdc' component has a subtype that specifies the kind of compression it understands, such as JPEG, and a manufacturer code that distinguishes among components of the same subtype. For example, the image decompressor for JPEG supplied by Apple has the type, subtype, and manufacturer codes of 'imdc', 'jpeg', 'aapl' .
Important: There are no “three-character” codes. Some of the four-character codes, such as 'eat ', include an ASCII blank space (0x020). The space character is an important part of the code, and cannot be omitted.
QuickTime ships with a number of components and has the ability to download others when needed (provided there is an Internet connection and user consent). Third-party components installed locally can, in many cases, be recognized and used by existing applications without modification.
QuickTime finds, selects, loads, and unloads components as needed. This is often transparent to the applications programmer. For example, when you tell QuickTime to open a movie, QuickTime automatically finds and loads the correct media handlers and decompressors for the movie. An error is returned if these operations fail, but otherwise they are transparent to the application.
Nearly all QuickTime programmers need to deal directly with components from time to time, however. For example, to play a QuickTime movie, applications may work directly with a movie controller component.
Selecting and working with components is documented in Component Manager for QuickTime This is a subset of the Component Manager Reference for the Mac OS (Carbon); it describes the parts of the Component Manager that QuickTime programmers are likely to use, and that are included in QuickTime for Windows.
Specific QuickTime components are discussed in the QuickTime documentation for the topic relevant to that component. For example, movie controller components are described in QuickTime Movie Playback Programming Guide and compressor components are described in Compression and Decompression.
Note that the primary QuickTime documentation describes the interface to components from the perspective of an application calling the component. There is an additional set of documents that describe writing new components (see Creating QuickTime Components). If you are writing a QuickTime component, you need to read the primary documentation for that component, the generic documentation for creating QuickTime components, and any additional documentation for creating that particular kind of component in order to understand how the component is used, what API you need to support, and how best to implement it.
Let’s look at two examples of the QuickTime architecture in action: getting a movie from a file and playing a movie using a movie controller.
Your application tells the Movie Toolbox to get a movie, in this case from a file.
A data handler component is used to access the file; a different component would be used to get a movie from a local file, a URL, or a stream. QuickTime chooses the appropriate component based on the data source.
If the file is not a QuickTime movie file, a movie importer component is used to create a movie from the file; a different component would be used to import from an MP3 file or a JPEG file. QuickTime chooses the appropriate importer based on the file type, file extension, or MIME type.
The Movie Toolbox passes a movie to your application.
Your application attaches a movie controller to the movie and the user presses the “Play” button on the control bar.
A media handler component is used to work with each type of media used in the movie; different components are used for sound, video, Flash, and so on. QuickTime chooses the appropriate media handlers based on the media types.
Media handlers makes calls to data handlers to access their media samples, which may come from a different data sources. For example, a movie on a local disk might point to media samples on a local disk, a remote file server, and an Internet stream. QuickTime chooses the appropriate data handler for each data source.
A media handler typically makes calls to a decompressor component to decompress the media samples; different components are used for different media types, such as sound and video, and for different compression schemes, such as MP3 or MP4 audio, JPEG or GIF images. QuickTime chooses a decompressor based on the media type and compression scheme.
A media handler may then pass its output directly to a low-level service, such as the Sound Manager, for final disposal, or to another component, such as a video output component, for further processing.
QuickTime can provide various kinds of output during playback. The output is typically sound and video, with a visible controller, but it can be simply sound, with no display or visible controller, or even a silent and invisible DV stream to a FireWire port.
The actual output is handled by a lower-level technology, such as Core Image, OpenGL, Core Audio, DirectX, or the Sound Manager. QuickTime shields you from having to deal with these details in most cases. When you play a movie, QuickTime selects and configures the default devices for playback on your platform.
If you need to work with QuickTime at a lower level, to modify individual video frames during playback, for example, or to add a filter to the sound output, you need to work with the underlying technology that QuickTime relies on for output. This will vary depending on your platform and software revision.
For example, QuickTime 7 for Mac OS X uses Core Audio for audio output. To work with QuickTime audio at the low level, you should use the Core Audio API. Older versions of QuickTime send audio output to the Sound Manager (included in QuickTime for Windows). To work with low level audio on these systems, you need to use the Sound Manager API.
By default the visual output from QuickTime 7 for Mac OS X goes to a graphics context managed by Quartz, while visual output on QuickTime for Windows and older versions of QuickTime for the Mac OS goes to a graphics port associated with a window, represented by an offscreen buffer called a GWorld. QuickTime handles decompression and visual rendering automatically.
QuickTime can be specifically directed to send its visual output to any device that has an installed video output component.
In addition, in QuickTime 7 and later you can create a visual context to specify a particular output format, such as Core Image pixel buffers or OpenGL textures. If you do this, however, you become responsible for rendering the decompressed frames to the screen. You can render the images using one of the underlying graphics Mac OS APIs, such as Core Video and Core Image, OpenGL, or QuickDraw. On Windows, you might use native Windows video APIs, OpenGL, or the parts of QuickDraw included in QuickTime for Windows.
Note: QuickTime programmers working on Windows OS or versions of the Mac OS prior to 10.4 need to learn a little about graphics worlds and QuickDraw to learn how to properly set up a graphics world, associate it with a graphics port, and work with the common QuickDraw data types, such as a rect. (See Color QuickDraw, Graphic Devices and QuickDraw Reference.)
Audio output goes to your system’s default audio device by default, but QuickTime 7 and later support an audio context that allows you to specify any output device. QuickTime 7 and later also include some functions for working with audio, such as setting track volume, balance, and channel layout, and monitoring frequency levels during playback. To do sound processing or filtering, however, you need to use a lower-level technology such as Core Audio or DirectSound.
Last updated: 2005-08-11