Retired Document
Important: Apple recommends that developers explore QTKit and Core Video for new development in this technology area. See QTKit Framework Reference and Core Video Programming Guide for more information.
Appendix A
This appendix contains a list of file types that QuickTime can open as movies and a list of functions that your application can use to control QuickTime movies without using a movie controller component.
File Types that QuickTime Can Open as Movies
QuickTime can open a number of different file types as movies. You can call a NewMovieFrom...
function with a reference to one of these files and get back a playable movie. The list of file types is extensible by adding movie importer components (component type 'eat '
).
QuickTime can of course open QuickTime movie files (file extension .mov
, MIME type video/quicktime
) and QuickTime media link files (file extension .qtl
or .mov
, MIME type application/x-quicktimeplayer
or video/quicktime
). For more about QuickTime media link files, see HTML Scripting Guide for QuickTime.
QuickTime can also open any file type for which it has an installed importer. QuickTime ships with importers for dozens of file types, including:
3GPP
3GPP2
AIFF
AMC
AMR
Animated GIF
AU
AVI
BMP
DLS
DV
FlashPix
FLC
GIF
GSM
JPEG 2000 (Mac OS X)
JPEG/JFIF
Karaoke
MacPaint
Macromedia Flash 5
MIDI
MPEG-1
MP3 (MPEG-1 Layer 3)
M3U (MP3 Playlist files)
MPEG-4
M4A
M4B
M4P (iTunes 4 audio)
PDF (Mac OS X)
Photoshop
PICS
PICT
PLS
PNG
QCP
QuickTime Image File
SD2 (SoundDesigner 2)
SDP
SDV
SGI
SMIL
System 7 Sound (Mac OS 9)
Targa
Text
TIFF
TIFF Fax
VDU (Sony Video Disk Unit)
Wave
Additional import components, such as MPEG-2, can be purchased separately from Apple or are available from third parties.
Note that some file formats, such as MPEG-1, include a compression format. Other formats, such as AIFF, WAVE, and AVI, may contain data compressed using various schemes. QuickTime can open files that support multiple compression formats, but the file may not be playable unless QuickTime also has a compatible decompressor for the media. For example, an .avi
file with MPEG-1 compressed video might open and play in QuickTime, while another .avi
file compressed using WM9 compression would not play unless the user installed a WM9 decompressor component for QuickTime.
Playing a Movie Using Low-Level Commands
Just as the movie controller API sits below the Control Manager and HIMovieView
API, a still lower-level API lets you control the movie directly. You can use these low-level Movie Toolbox calls in addition to, or instead of, a movie controller component.
As a rule, you should not play movies without a movie controller. Most of the operations that act directly on movies can also be performed using a movie controller by calling the MCDoAction
function with the appropriate action selector. Do not play movies directly unless you have a compelling reason to do so; use a movie controller instead, or better yet, use a higher-level object that includes a movie controller, such as an HIMovieView
.
If you play a movie without a movie controller component, your application is responsible for updating the movie, handling all user input, and handling events such as resizing or covering and uncovering the window. Your application starts the movie playing by calling StartMovie
, then runs a loop until IsMovieDone
returns TRUE
. Inside the loop, your application calls MoviesTask
and handles any resize, drag, cover/uncover, and UI events. An example of this kind of loop is shown in Listing 1-6.
Listing 6-1 Movie playing loop
#define doTheRightThing 5000 |
void PlayMyMovie (movie, aMovie) |
{ |
WindowPtr aWindow; |
Rect windowRect; |
Rect movieBox; |
Movie aMovie; |
Boolean done = false; |
OSErr err; |
EventRecord theEvent; |
WindowPtr whichWindow; |
short part; |
err = EnterMovies (); |
if (err) return; |
SetRect (&windowRect, 100, 100, 200, 200); |
aWindow = NewCWindow (nil, &windowRect, "\pMovie", |
false, noGrowDocProc, (WindowPtr)-1, |
true, 0); |
GetMovieBox (aMovie, &movieBox); |
OffsetRect (&movieBox, -movieBox.left, -movieBox.top); |
SetMovieBox (aMovie, &movieBox); |
SizeWindow (aWindow, movieBox.right, movieBox.bottom, true); |
ShowWindow (aWindow); |
SetMovieGWorld (aMovie, (CGrafPtr)aWindow, nil); |
StartMovie (aMovie); |
while ( !IsMovieDone(aMovie) ) |
{ |
// Handle resize and update events... |
// Handle drag events |
MoviesTask (aMovie, DoTheRightThing); |
} |
DisposeMovie (aMovie); |
DisposeWindow (aWindow); |
} |
The Movie Toolbox commands for operating directly on movies are listed below. See the documentation on individual functions in QuickTimeAPIReference for more information.
StartMovie
StopMovie
GoToBeginningOfMovie
GoToEndOfMovie
MoviesTask
IsMovieDone
UpdateMovie
PtInMovie
PtInTrack
GetMovieStatus
GetTrackStatus
SetMovieActive
GetMovieActive
SetMovieGWorld
GetMovieGWorld
SetMovieBox
GetMovieBox
GetMovieDisplayBoundsRgn
GetMovieSegmentDisplayBoundsRgn
SetMovieDisplayClipRgn
GetMovieDisplayClipRgn
GetTrackDisplayBoundsRgn
GetTrackSegmentDisplayBoundsRgn
GetMovieDuration
SetMovieTimeValue
SetMovieTime
GetMovieTime
SetMovieRate
GetMovieRate
Copyright © 2005, 2009 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2009-06-01