Inside Macintosh: QuickTime Reference
| Previous | Chapter Contents | Chapter Top | Next |
The track class
QuickTime stores data separately in tracks. Tracks indicate what kind of data a movie contains. Examples of track types include video, audio, and text. The track class provides access to useful information about a track, such as name, kind, start time and duration. Some properties can be set, such as name, and enabled (which determines whether a specific track plays when the entire movie plays).
Class track: A track in a QuickTime movie.
Plural form:
tracks
Properties:
class type class [r/o]
-- the class
name international text [r/o]
-- the name of the track
start time integer
-- the time delay before this track starts playing
duration integer [r/o]
-- The duration of the track
kind string [r/o]
-- the kind of media in the track
dimensions point
-- the current dimensions of the track
natural dimensions point [r/o]
-- the dimensions the track has when it is not scaled
enabled boolean
-- should this track be used when the movie is playing?
id integer [r/o]
-- the unique identifier for this track
layer small integer
-- the layer of the track
language international text
-- the language of the track
visual characteristic boolean [r/o]
-- can the track be seen?
audio characteristic boolean [r/o]
-- can the track be heard?
sound volume small integer
-- the volume of the track [0..255], where 256 is 100 percent
sound balance small integer
-- the balance of the track [-127..128], where negative is left, 0 is center, and positive is right
Some examples of how you would use various properties of the track class:
-- set track name --
set name of track 1 of movie 1 to "hip cats"
-- set enabled of track --
set enabled of track 1 of first movie to false
-- get enabled state of all tracks --
get enabled of tracks of movie 1
-- set track dimensions --
set dimensions of track 1 of movie 1 to {320, 240}
-- get the track data size --
get the track data size of track 1 of movie 1
get the track data size of tracks of movie 1
-- get name of tracks --
get name of tracks of movie 1
-- get natural dimensions of track--
get the natural dimensions of track 1 of movie 1
-- get id of track --
get the id of track 2 of movie 1
-- get layer of track --
get the layer of track 2 of movie 1
-- get visual characteristic of track (is it visible)--
get the visual characteristic of track 2 of first movie
-- get audio characteristic of track (is it audible)--
get the audio characteristic of track 2 of first movie
-- if audio track, get balance
if audio characteristic of track 2 of movie 1 is true then get
the volume of track 2 of movie 1
-- set start time of track --
set start time of track 1 of movie 1 to 600
-- get track kind --
get track kind of track 2 of movie 1
-- get track duration (as seconds if time scale is 600)
set x to duration of track 2 of movie 1
set result to x / (time scale of movie 1)
Note that if you use (time scale of movie 1), then this becomes the generalized expression for time in seconds.
© 2000 Apple Computer, Inc.
Inside Macintosh: QuickTime Reference
| Previous | Chapter Contents | Chapter Top | Next |