Next Page > Hide TOC

QTMedia Class Reference

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

Overview

The QTMedia class represents a QuickTime media (of type Media). QTMedia objects are associated with QTTrack objects and support methods for getting and setting the media properties. If necessary, you can retrieve the media identifier associated with a QTMedia object by calling its quickTimeMedia method.

Tasks

Creating a QTMedia Object

Initializing a QTMedia Object

Accessing Media Properties

Accessing QuickTime Media Data

Class Methods

mediaWithQuickTimeMedia:error:

Creates a new QTMedia object with QuickTime media data.

+ (id)mediaWithQuickTimeMedia:(Media)media error:(NSError **)errorPtr

Parameters
media

The QuickTime media data with which to initialize the media object.

errorPtr

On return, if the media object could not be created, a pointer to an error indicating the reason for the failure.

Return Value

The newly created media object.

Availability
Declared In
QTMedia.h

Instance Methods

attributeForKey:

Returns the value of the specified media attribute.

- (id)attributeForKey:(NSString *)attributeKey

Parameters
attributeKey

The key for the desired attribute. Possible attribute keys are listed in “Media Attributes.”

Return Value

The value of the specified attribute.

Availability
See Also
Related Sample Code
Declared In
QTMedia.h

hasCharacteristic:

Returns whether the media has the specified characteristic.

- (BOOL)hasCharacteristic:(NSString *)characteristic

Parameters
characteristic

The characteristic being tested. Possible characteristics are listed in “Media Characteristics.”

Return Value

YES if the media has the specified characteristic, NO otherwise.

Availability
Declared In
QTMedia.h

initWithQuickTimeMedia:error:

Initializes a new QTMedia object with QuickTime media data.

- (id)initWithQuickTimeMedia:(Media)media error:(NSError **)errorPtr

Parameters
media

The QuickTime media data with which to initialize the media object.

errorPtr

On return, if the media object could not be created, a pointer to an error indicating the reason for the failure.

Return Value

The newly initialized media object.

Availability
Declared In
QTMedia.h

mediaAttributes

Returns a dictionary containing all of the media’s attributes.

- (NSDictionary *)mediaAttributes

Return Value

A dictionary containing all of the media’s attributes.

Discussion

Possible attribute keys are listed in “Media Attributes.”

Availability
See Also
Declared In
QTMedia.h

quickTimeMedia

Returns the QuickTime media associated with the media object.

- (Media)quickTimeMedia

Return Value

The QuickTime media associated with the media object.

Availability
Declared In
QTMedia.h

setAttribute:forKey:

Sets the value of the specified media attribute.

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

Parameters
value

The new value for the specified attribute.

attributeKey

The key for the attribute to set. Possible attribute keys are listed in “Media Attributes.”

Availability
See Also
Declared In
QTMedia.h

setMediaAttributes:

Sets the media’s attributes using the values from the supplied dictionary.

- (void)setMediaAttributes:(NSDictionary *)attributes

Parameters
attributes

A dictionary containing the new attribute keys and values.

Discussion

Possible attribute keys are listed in “Media Attributes.”

Availability
See Also
Declared In
QTMedia.h

track

Returns the QTTrack object that contains the media.

- (QTTrack *)track

Return Value

The QTTrack object that contains the media.

Availability
Declared In
QTMedia.h

Constants

Media Types

Constants for different media types. Compare these constants with the value associated with the QTMediaTypeAttribute key.

NSString * const QTMediaTypeVideo;
NSString * const QTMediaTypeSound;
NSString * const QTMediaTypeText;
NSString * const QTMediaTypeBase;
NSString * const QTMediaTypeMPEG;
NSString * const QTMediaTypeMusic;
NSString * const QTMediaTypeTimeCode;
NSString * const QTMediaTypeSprite;
NSString * const QTMediaTypeFlash;
NSString * const QTMediaTypeMovie;
NSString * const QTMediaTypeTween;
NSString * const QTMediaType3D;
NSString * const QTMediaTypeSkin;
NSString * const QTMediaTypeQTVR;
NSString * const QTMediaTypeHint;
NSString * const QTMediaTypeStream;
NSString * const QTMediaTypeMuxed;
NSString * const QTMediaTypeQuartzComposer;

Constants
QTMediaTypeVideo

Video media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeSound

Sound media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeText

Text media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeBase

Base media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeMPEG

MPEG media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeMusic

Music media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeTimeCode

Timecode media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeSprite

Sprite media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeFlash

Flash media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeMovie

Movie media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeTween

Tween media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaType3D

3D media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeSkin

Skin media

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeQTVR

QuickTime VR media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeHint

Hint media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeStream

Stream media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeMuxed

Multiplexed audio and video media.

Available in Mac OS X v10.5 and later.

Declared in QTMedia.h.

QTMediaTypeQuartzComposer

Quartz Composer media.

Available in Mac OS X v10.5 and later.

Declared in QTMedia.h.

Media Characteristics

Characteristics of a given media. You can query for these characteristics using the hasCharacteristic: method.

NSString * const QTMediaCharacteristicVisual;
NSString * const QTMediaCharacteristicAudio;
NSString * const QTMediaCharacteristicCanSendVideo;
NSString * const QTMediaCharacteristicProvidesActions;
NSString * const QTMediaCharacteristicNonLinear;
NSString * const QTMediaCharacteristicCanStep;
NSString * const QTMediaCharacteristicHasNoDuration;
NSString * const QTMediaCharacteristicHasSkinData;
NSString * const QTMediaCharacteristicProvidesKeyFocus;
NSString * const QTMediaCharacteristicHasVideoFrameRate;

Constants
QTMediaCharacteristicVisual

The media has video data.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaCharacteristicAudio

The media has audio data.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaCharacteristicCanSendVideo

The media can send visual data to another track.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaCharacteristicProvidesActions

The media has actions.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaCharacteristicNonLinear

The media is non-linear.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaCharacteristicCanStep

The media can step.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaCharacteristicHasNoDuration

The media has no duration.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaCharacteristicHasSkinData

The media has skin data.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaCharacteristicProvidesKeyFocus

Key events can be focused at the media.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaCharacteristicHasVideoFrameRate

The media has a video frame rate.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

Media Attributes

The following constants are keys for the media attributes that you can get and set using the mediaAttributes and setMediaAttributes: methods. To get or set a single attribute, use attributeForKey: or setAttribute:forKey:.

NSString * const QTMediaCreationTimeAttribute;
NSString * const QTMediaDurationAttribute;
NSString * const QTMediaModificationTimeAttribute;
NSString * const QTMediaSampleCountAttribute;
NSString * const QTMediaQualityAttribute;
NSString * const QTMediaTimeScaleAttribute;
NSString * const QTMediaTypeAttribute;

Constants
QTMediaCreationTimeAttribute

The creation time. The value for this key is of type NSDate.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaDurationAttribute

The duration. The value for this key is of type NSValue, interpreted as a QTTime.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaModificationTimeAttribute

The modification time. The value for this key is of type NSDate.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaSampleCountAttribute

The media sample count. The value for this key is of type NSNumber, interpreted as a long.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaQualityAttribute

The media quality. The value for this key is of type NSNumber, interpreted as a short.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTimeScaleAttribute

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

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.

QTMediaTypeAttribute

The media type. The value for this key is of type NSString. See “Media Types” for the values this attribute can return.

Available in Mac OS X v10.3 and later.

Declared in QTMedia.h.



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.