Next Page > Hide TOC

QTTrack Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/QTKit.framework
Availability
Available in Mac OS X v10.4 and later.
Declared in
QTTrack.h
Related sample code

Overview

The QTTrack class represents a QuickTime track (of type Track). QTTrack objects are associated with QTMovie objects and support methods for getting and setting the track properties. If necessary, you can retrieve the track identifier associated with a QTTrack object by calling its quickTimeTrack: method. Note that a movie can have multiple tracks. A track has a single media.

Tasks

Creating a QTTrack

Initializing a QTTrack

Initializes a newly created QTTrack object with data from the QuickTime track track.

Getting Track Properties

Setting Track Properties

Editing Track Properties

Getting QTTrack Primitives

Getting and Setting Aperture Mode Dimensions

Class Methods

trackWithQuickTimeTrack:error:

Creates a QTTrack object with data from the QuickTime track track.

+ (id)trackWithQuickTimeTrack:(Track)track error:(NSError **)errorPtr

Discussion

If a QTTrack object cannot be created, an NSError object is returned in the location pointed to by errorPtr. Pass NIL if you do not want an NSError object returned.

Availability
Declared In
QTTrack.h

Instance Methods

addImage:forDuration:withAttributes:

Adds an image for the specified duration to the receiver, using attributes specified in the attributes dictionary.

- (void)addImage:(NSImage *)image forDuration:(QTTime)duration withAttributes:(NSDictionary *)attributes

Discussion

Keys in the dictionary can be QTAddImageCodecType to select a codec type and QTAddImageCodecQuality to select a quality. Qualities are expected to be specified as NSNumbers, using the codec values like codecNormalQuality. (See ImageCompression.h for the complete list.)

Availability
Declared In
QTTrack.h

apertureModeDimensionsForMode:

Returns an NSSize value that indicates the dimensions of the target track for the specified movie aperture mode.

- (NSSize)apertureModeDimensionsForMode:(NSString *)mode

Discussion

For instance, passing a mode of QTMovieApertureModeClean would cause apertureModeDimensionsForMode: to return the track dimensions to use in clean aperture mode.

Availability
Declared In
QTTrack.h

attributeForKey:

Returns the current value of the track attribute attributeKey.

-(id)attributeForKey:(NSString *)attributeKey

Discussion

A list of supported track attributes and their acceptable values can be found in the “Constants” section.

Availability
Related Sample Code
Declared In
QTTrack.h

deleteSegment:

Deletes from a QTTrack the segment delimited by segment.

- (void)deleteSegment:(QTTimeRange)segment

Discussion

If the track is not editable, this method raises an exception.

Availability
Declared In
QTTrack.h

generateApertureModeDimensions

Adds information to a QTTrack needed to support aperture modes for tracks created with applications and/or versions of QuickTime that did not support aperture mode dimensions.

- (void)generateApertureModeDimensions

Discussion

If the image descriptions in the track lack tags describing clean aperture and pixel aspect ratio information, the media data is scanned to see if the correct values can be divined and attached. Then the aperture mode dimensions are calculated and set. Afterwards, the QTTrackHasApertureModeDimensionsAttribute property will be set to YES for this track. Tracks that do not support aperture modes are not changed.

Availability
Declared In
QTTrack.h

initWithQuickTimeTrack:error:

If a QTTrack object cannot be created, an NSError object is returned in the location pointed to by errorPtr.

- (id)initWithQuickTimeTrack:(Track)track error:(NSError **)errorPtr

Discussion

Pass NIL if you do not want an NSError object returned.

Availability
Declared In
QTTrack.h

insertEmptySegmentAt:

Inserts into a QTTrack an empty segment delimited by the range range.

- (void)insertEmptySegmentAt:(QTTimeRange)range

Discussion

If the track is not editable, this method raises an exception.

Availability
Declared In
QTTrack.h

insertSegmentOfTrack:fromRange:scaledToRange:

Inserts the specified segment from the track into the receiver, scaled to the range dstRange.

- (void)insertSegmentOfTrack:(QTTrack *)track fromRange:(QTTimeRange)srcRange scaledToRange:(QTTimeRange)dstRange

Discussion

This is essentially an Add Scaled operation on a track. If the track is not editable, this method raises an exception.

Availability
Declared In
QTTrack.h

insertSegmentOfTrack:timeRange:atTime:

Inserts into a QTTrack at time time the selection in movie delimited by the time range range.

- (void)insertSegmentOfTrack:(QTTrack *)track timeRange:(QTTimeRange)range atTime:(QTTime)time

Discussion

If the track is not editable, this method raises an exception.

Availability
Declared In
QTTrack.h

isEnabled

Returns YES if the QTTrack object is currently enabled, NO otherwise.

- (BOOL)isEnabled

Availability
Declared In
QTTrack.h

media

Returns the media associated with a QTTrack object.

- (QTMedia *)media

Availability
Related Sample Code
Declared In
QTTrack.h

movie

Returns the movie that contains a QTTrack object.

- (QTMovie *)movie

Availability
Declared In
QTTrack.h

quickTimeTrack

Returns the QuickTime track associated with a QTTrack object.

-(Track)quickTimeTrack

Availability
Related Sample Code
Declared In
QTTrack.h

removeApertureModeDimensions

Removes aperture mode dimension information from the target track.

- (void)removeApertureModeDimensions

Discussion

It does not attempt to modify sample descriptions, so it may not completely reverse the effects of generateApertureModeDimensions. It sets the QTTrackHasApertureModeDimensionsAttribute property to NO.

Availability
Declared In
QTTrack.h

scaleSegment:newDuration:

Scales the QTTrack segment delimited by the segment segment so that it will have the new duration newDuration.

- (void)scaleSegment:(QTTimeRange)segment newDuration:(QTTime)newDuration

Discussion

If the track is not editable, this method raises an exception.

Availability
Declared In
QTTrack.h

setApertureModeDimensions:forMode:

Sets the dimensions of the target track for the specified movie aperture mode.

- (void)setApertureModeDimensions:(NSSize)dimensions forMode:(NSString *)mode

Availability
Declared In
QTTrack.h

setAttribute:forKey:

Set the track attribute attributeKey to the value specified by the value parameter.

-(void)setAttribute:(id)value forKey:(NSString *)attributeKey

Discussion

A list of supported track attributes and their acceptable values can be found in the “Constants” section.

Availability
Declared In
QTTrack.h

setEnabled:

Sets the enabled state of a QTTrack to enabled.

- (void)setEnabled:(BOOL)enabled

Availability
Related Sample Code
Declared In
QTTrack.h

setTrackAttributes:

Set the track attributes using the key-value pairs specified in the dictionary attributes.

-(void)setTrackAttributes:(NSDictionary *)attributes

Discussion

A list of supported track attributes and their acceptable values can be found in the “Constants” section.

Availability
Declared In
QTTrack.h

setVolume:

Sets the volume of a QTTrack to volume.

-(void)setVolume:(float)volume

Discussion

The valid range is 0.0 to 1.0.

Availability
Declared In
QTTrack.h

trackAttributes

Returns a dictionary containing the current values of all defined track attributes.

-(NSDictionary *)trackAttributes

Discussion

A list of supported track attributes and their acceptable values can be found in the “Constants” section.

Availability
Declared In
QTTrack.h

volume

Returns the volume of a QTTrack object.

-(float)volume

Discussion

The valid range is 0.0 to 1.0.

Availability
Declared In
QTTrack.h

Constants

The following constants specify the track attributes that you can get and set using the trackAttributes and setTrackAttributes methods. To get or set a single attribute, use attributeForKey or setAttribute.

Constant

Description

QTTrackBoundsAttribute

The bounding rectangle of a QTTrack object; the value for this key is of type NSValue, interpreted as an NSRect.

QTTrackCreationTimeAttribute

The creation time of a QTTrack object; the value for this key is of type NSDate.

QTTrackDimensionsAttribute

The dimensions of a QTTrack object; the value for this key is of type NSValue, interpreted as an NSSize.

QTTrackDisplayNameAttribute

The display name of a QTTrack object; the value for this key is of type NSString.

QTTrackEnabledAttribute

The track enabled state of a QTTrack object; the value for this key is of type NSNumber, interpreted as a BOOL.

QTTrackFormatSummaryAttribute

An NSString that is a localized, human-readable string that summarizes a track’s format; for example, “16-bit Integer (Big Endian), Stereo (L R), 48.000 kHz”. This attribute is gettable but not settable.

Mac OS X v10.5 and later.

QTTrackHasApertureModeDimensionsAttribute

The value to determine whether aperture mode dimensions have been set on a track, even if they are all identical to the classic dimensions (as is the case for content with square pixels and no edge-processing region).

QTTrackIDAttribute

The track ID of a QTTrack object; the value for this key is of type NSNumber, interpreted as a long.

QTTrackLayerAttribute

The track layer of a QTTrack object; the value for this key is of type NSNumber, interpreted as a short.

QTTrackMediaTypeAttribute

The media type of a QTTrack object; the value for this key is of type NSString.

QTTrackModificationTimeAttribute

The modification time of a QTTrack object; the value for this key is of type NSDate.

QTTrackRangeAttribute

The range of time this track occupies; the value for this key is of type NSValue, interpreted as a QTTimeRange.

QTTrackTimeScaleAttribute

The track time scale; the value for this key is of type NSNumber, interpreted as a long.

QTTrackUsageInMovieAttribute

The movie usage setting; the value for this key is of type NSNumber, interpreted as a BOOL.

QTTrackUsageInPosterAttribute

The poster usage setting; the value for this key is of type NSNumber, interpreted as a BOOL.

QTTrackUsageInPreviewAttribute

The preview usage setting; the value for this key is of type NSNumber, interpreted as a BOOL.

QTTrackVolumeAttribute

The volume of a QTTrack object; the value for this key is of type NSNumber, interpreted as a float.



Next Page > Hide TOC


© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-03-04)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.