Media atoms describe and define a track’s media type and sample data. The media atom contains information that specifies the media type, such as sound or video, the media handler component used to interpret the sample data, the media timescale and track duration, and media-and-track-specific information such as sound volume or graphics mode. It also contains the media data references, which typically specify the file where the sample data is stored, and the sample table atoms, which specify the sample description, duration, and byte offset from the data reference for each media sample.
The media atom has an atom type of 'mdia'. It must contain a media header atom ('mdhd'), and it can contain a handler reference ('hdlr') atom, media information ('minf') atom, and user data ('udta') atom.
Note: Do not confuse the media atom ('mdia') with the media data atom ('mdat'). The media atom contains only references to media data; the media data atom contains the actual media samples.
Figure 2-15 shows the layout of a media atom.
Media atoms contain the following data elements.
A 32-bit integer that specifies the number of bytes in this media atom.
A 32-bit integer that identifies the atom type; this field must be set to 'mdia'.
This atom contains the standard media information. See “Media Header Atoms.”
This atom identifies the media handler component that is to be used to interpret the media data. See “Handler Reference Atoms” for more information.
Note that the handler reference atom tells you the kind of media this media atom contains—for example, video or sound. The layout of the media information atom is specific to the media handler that is to interpret the media. “Media Information Atoms” discusses how data may be stored in a media, using the video media format defined by Apple as an example.
This atom contains data specific to the media type for use by the media handler component. See “Media Information Atoms.”
The media header atom specifies the characteristics of a media, including time scale and duration. The media header atom has an atom type of 'mdhd'.
Figure 2-16 shows the layout of the media header atom.
Media header atoms contain the following data elements.
A 32-bit integer that specifies the number of bytes in this media header atom.
A 32-bit integer that identifies the atom type; this field must be set to 'mdhd'.
One byte that specifies the version of this header atom.
Three bytes of space for media header flags. Set this field to 0.
A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the media atom was created. It is strongly recommended that this value should be specified using coordinated universal time (UTC).
A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the media atom was changed. It is strongly recommended that this value should be specified using coordinated universal time (UTC).
A time value that indicates the time scale for this media—that is, the number of time units that pass per second in its time coordinate system.
The duration of this media in units of its time scale.
A 16-bit integer that specifies the language code for this media. See “Language Code Values” for valid language codes.
A 16-bit integer that specifies the media’s playback quality—that is, its suitability for playback in a given environment.
The handler reference atom specifies the media handler component that is to be used to interpret the media’s data. The handler reference atom has an atom type value of 'hdlr'.
Historically, the handler reference atom was also used for data references. However, this use may now be ignored.
The handler atom within a media atom declares the process by which the media data in the stream may be presented, and thus, the nature of the media in a stream. For example, a video handler would handle a video track.
Figure 2-17 shows the layout of a handler reference atom.
Handler reference atoms contain the following data elements.
A 32-bit integer that specifies the number of bytes in this handler reference atom.
A 32-bit integer that identifies the atom type; this field must be set to 'hdlr'.
A 1-byte specification of the version of this handler information.
A 3-byte space for handler information flags. Set this field to 0.
A four-character code that identifies the type of the handler. Only two values are valid for this field: 'mhlr' for media handlers and 'dhlr' for data handlers.
A four-character code that identifies the type of the media handler or data handler. For media handlers, this field defines the type of data—for example, 'vide' for video data or 'soun' for sound data.
For data handlers, this field defines the data reference type—for example, a component subtype value of 'alis' identifies a file alias.
Reserved. Set to 0.
Reserved. Set to 0.
Reserved. Set to 0.
A (counted) string that specifies the name of the component—that is, the media handler used when this media was created. This field may contain a zero-length (empty) string.
Media information atoms (defined by the 'minf' atom type) store handler-specific information for a track’s media data. The media handler uses this information to map from media time to media data and to process the media data.
These atoms contain information that is specific to the type of data defined by the media. Further, the format and content of media information atoms are dictated by the media handler that is responsible for interpreting the media data stream. Another media handler would not know how to interpret this information.
This section describes the atoms that store media information for the video ('vmhd'), sound ('smhd'), and base ('gmhd') portions of QuickTime movies.
Note: “Using Sample Atoms” discusses how the video media handler locates samples in a video media.
Video media information atoms are the highest-level atoms in video media. These atoms contain a number of other atoms that define specific characteristics of the video media data. Figure 2-18 shows the layout of a video media information atom.
The video media information atom contains the following data elements.
A 32-bit integer that specifies the number of bytes in this video media information atom.
A 32-bit integer that identifies the atom type; this field must be set to 'minf'.
Video media information header atoms define specific color and graphics mode information.
Figure 2-19 shows the structure of a video media information header atom.
The video media information header atom contains the following data elements.
A 32-bit integer that specifies the number of bytes in this video media information header atom.
A 32-bit integer that identifies the atom type; this field must be set to 'vmhd'.
A 1-byte specification of the version of this video media information header atom.
A 3-byte space for video media information flags. There is one defined flag.
No lean ahead
This is a compatibility flag that allows QuickTime to distinguish between movies created with QuickTime 1.0 and newer movies. You should always set this flag to 1, unless you are creating a movie intended for playback using version 1.0 of QuickTime. This flag’s value is 0x0001.
A 16-bit integer that specifies the transfer mode. The transfer mode specifies which Boolean operation QuickDraw should perform when drawing or transferring an image from one location to another. See “Graphics Modes” for a list of graphics modes supported by QuickTime.
Three 16-bit values that specify the red, green, and blue colors for the transfer mode operation indicated in the graphics mode field.
Sound media information atoms are the highest-level atoms in sound media. These atoms contain a number of other atoms that define specific characteristics of the sound media data. Figure 2-20 shows the layout of a sound media information atom.
The sound media information atom contains the following data elements.
A 32-bit integer that specifies the number of bytes in this sound media information atom.
A 32-bit integer that identifies the atom type; this field must be set to 'minf'.
The sound media information header atom (shown in Figure 2-21) stores the sound media’s control information, such as balance.
The sound media information header atom contains the following data elements.
A 32-bit integer that specifies the number of bytes in this sound media information header atom.
A 32-bit integer that identifies the atom type; this field must be set to 'smhd'.
A 1-byte specification of the version of this sound media information header atom.
A 3-byte space for sound media information flags. Set this field to 0.
A 16-bit integer that specifies the sound balance of this sound media. Sound balance is the setting that controls the mix of sound between the two speakers of a computer. This field is normally set to 0. See “Balance” for more information about balance values.
Reserved for use by Apple. Set this field to 0.
The base media information atom (shown in Figure 2-22) stores the media information for media types such as text, MPEG, time code, and music.
Media types that are derived from the base media handler may add other atoms within the base media information atom, as appropriate. At present, the only media type that defines any additional atoms is the timecode media. See “Timecode Media Information Atom” for more information about timecode media.
The base media information atom contains the following data elements.
A 32-bit integer that specifies the number of bytes in this base media information atom.
A 32-bit integer that identifies the atom type; this field must be set to 'minf'.
The base media information header atom indicates that this media information atom pertains to a base media.
The base media information header atom contains the following data elements.
A 32-bit integer that specifies the number of bytes in this base media information header atom.
A 32-bit integer that identifies the atom type; this field must be set to 'gmhd'.
The base media info atom, contained in the base media information atom, defines the media’s control information, including graphics mode and balance information.
Figure 2-23 shows the layout of the base media info atom.
The base media info atom contains the following data elements.
A 32-bit integer that specifies the number of bytes in this base media info atom.
A 32-bit integer that identifies the atom type; this field must be set to 'gmin'.
A 1-byte specification of the version of this base media information header atom.
A 3-byte space for base media information flags. Set this field to 0.
A 16-bit integer that specifies the transfer mode. The transfer mode specifies which Boolean operation QuickDraw should perform when drawing or transferring an image from one location to another. See “Graphics Modes” for more information about graphics modes supported by QuickTime.
Three 16-bit values that specify the red, green, and blue colors for the transfer mode operation indicated in the graphics mode field.
A 16-bit integer that specifies the sound balance of this media. Sound balance is the setting that controls the mix of sound between the two speakers of a computer. This field is normally set to 0. See “Balance” for more information about balance values.
Reserved for use by Apple. Set this field to 0.
The handler reference atom (described in “Handler Reference Atoms”) contains information specifying the data handler component that provides access to the media data. The data handler component uses the data information atom to interpret the media’s data. Data information atoms have an atom type value of 'dinf'.
Figure 2-24 shows the layout of the data information atom.
The data information atom contains the following data elements.
A 32-bit integer that specifies the number of bytes in this data information atom.
A 32-bit integer that identifies the atom type; this field must be set to 'dinf'.
Data reference atoms contain tabular data that instructs the data handler component how to access the media’s data. Figure 2-24 shows the data reference atom.
The data reference atom contains the following data elements.
A 32-bit integer that specifies the number of bytes in this data reference atom.
A 32-bit integer that identifies the atom type; this field must be set to 'dref'.
A 1-byte specification of the version of this data reference atom.
A 3-byte space for data reference flags. Set this field to 0.
A 32-bit integer containing the count of data references that follow.
An array of data references.
Each data reference is formatted like an atom and contains the following data elements.
A 32-bit integer that specifies the number of bytes in the data reference.
A 32-bit integer that specifies the type of the data in the data reference. Table 2-4 lists valid type values.
A 1-byte specification of the version of the data reference.
A 3-byte space for data reference flags. There is one defined flag.
Self reference
This flag indicates that the media’s data is in the same file as the movie atom. On the Macintosh, and other file systems with multifork files, set this flag to 1 even if the data resides in a different fork from the movie atom. This flag’s value is 0x0001.
The data reference information.
Table 2-4 shows the currently defined data reference types that may be stored in a header atom.
Data reference type |
Description |
|---|---|
Data reference is a Macintosh alias. An alias contains information about the file, including its full path name. |
|
Data reference is a Macintosh alias. Appended to the end of the alias is the resource type (stored as a 32-bit integer) and ID (stored as a 16-bit signed integer) to use within the specified file. |
|
A C string that specifies a URL. There may be additional data after the C string. |
Last updated: 2007-09-04