Inside Macintosh Quicktime
Total Page:16
File Type:pdf, Size:1020Kb
INSIDE MACINTOSH QuickTime Addison-Wesley Publishing Company Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario Wokingham, England Amsterdam Bonn Sydney Singapore Tokyo Madrid San Juan Paris Seoul Milan Mexico City Taipei Apple Computer, Inc. LIMITED WARRANTY ON MEDIA AND © 1993, Apple Computer, Inc. REPLACEMENT All rights reserved. ALL IMPLIED WARRANTIES ON THIS No part of this publication may be MANUAL, INCLUDING IMPLIED reproduced, stored in a retrieval system, WARRANTIES OF MERCHANTABILITY or transmitted, in any form or by any AND FITNESS FOR A PARTICULAR means, mechanical, electronic, PURPOSE, ARE LIMITED IN DURATION photocopying, recording, or otherwise, TO NINETY (90) DAYS FROM THE DATE without prior written permission of OF THE ORIGINAL RETAIL PURCHASE Apple Computer, Inc. Printed in the OF THIS PRODUCT. United States of America. Even though Apple has reviewed this No licenses, express or implied, are manual, APPLE MAKES NO WARRANTY granted with respect to any of the OR REPRESENTATION, EITHER EXPRESS technology described in this book. OR IMPLIED, WITH RESPECT TO THIS Apple retains all intellectual property MANUAL, ITS QUALITY, ACCURACY, rights associated with the technology MERCHANTABILITY, OR FITNESS FOR A described in this book. This book is PARTICULAR PURPOSE. AS A RESULT, intended to assist application THIS MANUAL IS SOLD “AS IS,” AND developers to develop applications only YOU, THE PURCHASER, ARE ASSUMING for Apple Macintosh computers. THE ENTIRE RISK AS TO ITS QUALITY Apple Computer, Inc. AND ACCURACY. 20525 Mariani Avenue IN NO EVENT WILL APPLE BE LIABLE Cupertino, CA 95014 FOR DIRECT, INDIRECT, SPECIAL, 408-996-1010 INCIDENTAL, OR CONSEQUENTIAL Apple, the Apple logo, APDA, DAMAGES RESULTING FROM ANY AppleLink, LaserWriter, Macintosh, and DEFECT OR INACCURACY IN THIS MPW are trademarks of Apple MANUAL, even if advised of the possibility Computer, Inc., registered in the United of such damages. States and other countries. THE WARRANTY AND REMEDIES SET QuickDraw, QuickTime, and System 7 FORTH ABOVE ARE EXCLUSIVE AND IN are trademarks of Apple Computer, Inc. LIEU OF ALL OTHERS, ORAL OR Adobe Illustrator and PostScript are WRITTEN, EXPRESS OR IMPLIED. No trademarks of Adobe Systems Apple dealer, agent, or employee is Incorporated, which may be registered authorized to make any modification, in certain jurisdictions. extension, or addition to this warranty. AGFA is a trademark of Agfa-Gevaert. Some states do not allow the exclusion or America Online is a service mark of limitation of implied warranties or liability Quantum Computer Services, Inc. for incidental or consequential damages, so the above limitation or exclusion may not ISBN 0-201-62201-7 CompuServe is a registered service apply to you. This warranty gives you 1 2 3 4 5 6 7 8 9-MU-9796959493 mark of CompuServe, Inc. specific legal rights, and you may also have First Printing, March 1993 FrameMaker is a registered trademark other rights which vary from state to state. of Frame Technology Corporation. Helvetica and Palatino are registered trademarks of Linotype Company. 7 Internet is a trademark of Digital The paper used in this book meets the Equipment Corporation. EPA standards for recycled fiber. ITC Zapf Dingbats is a registered trademark of International Typeface Corporation. Windows is a trademark of Microsoft Corporation. Simultaneously published in the United States and Canada. Contents Figures, Tables, and Listings ix Preface About This Book xiii Format of a Typical Chapter xiv Conventions Used in This Book xv Special Fonts xv Types of Notes xv Development Environment xv Chapter 1 Introduction to QuickTime 1-17 QuickTime Concepts 1-19 Movies and Media Data Structures 1-19 Components 1-19 Image Compression 1-20 Time 1-20 The QuickTime Architecture 1-21 The Movie Toolbox 1-22 The Image Compression Manager 1-22 The Component Manager 1-22 QuickTime Components 1-23 Using QuickTime 1-24 Playing Movies 1-24 Creating and Editing Movies 1-26 Movie-Editing Applications 1-28 Movie-Creating Applications 1-29 Chapter 2 Movie Toolbox 2-31 Introduction to Movies 2-35 Time and the Movie Toolbox 2-35 Time Coordinate Systems 2-36 Time Bases 2-38 Movies 2-39 Tracks 2-42 Media Structures 2-43 About Movies 2-44 Movie Characteristics 2-45 Track Characteristics 2-47 iii Media Characteristics 2-48 Spatial Properties 2-50 The Transformation Matrix 2-56 Audio Properties 2-59 Sound Playback 2-59 Adding Sound to Video 2-60 Sound Data Formats 2-61 Data Interchange 2-62 Movies on the Clipboard 2-62 Movies in Files 2-62 Using the Movie Toolbox 2-62 Determining Whether the Movie Toolbox Is Installed 2-63 Getting Ready to Work With Movies 2-65 Getting a Movie From a File 2-65 Playing Movies With a Movie Controller 2-68 Playing a Movie 2-71 Movies and the Scrap 2-75 Creating a Movie 2-75 A Sample Program for Creating a Movie 2-76 A Sample Function for Creating and Opening a Movie File 2-77 A Sample Function for Creating a Video Track in a New Movie 2-78 A Sample Function for Adding Video Samples to a Media 2-80 A Sample Function for Creating Video Data for a Movie 2-82 A Sample Function for Creating a Sound Track 2-82 A Sample Function for Creating a Sound Description Structure 2-85 Parsing a Sound Resource 2-89 Saving Movies in Movie Files 2-91 Using Movies in Your Event Loop 2-92 The Movie Toolbox and System 6 2-93 The Alias Manager 2-94 The File Manager 2-94 Previewing Files 2-95 Previewing Files in System 6 Using Standard File Reply Structures 2-95 Customizing Your Interface in System 6 2-97 Previewing Files in System 7 Using Standard File Reply Structures 2-98 Customizing Your Interface in System 7 2-100 Using Application-Defined Functions 2-101 Working With Movie Spatial Characteristics 2-103 Movie Toolbox Reference 2-106 Data Types 2-106 Movie Identifiers 2-107 The Time Structure 2-107 The Fixed-Point and Fixed-Rectangle Structures 2-108 The Sound Description Structure 2-109 Functions for Getting and Playing Movies 2-111 iv Initializing the Movie Toolbox 2-112 Error Functions 2-114 Movie Functions 2-117 Saving Movies 2-130 Controlling Movie Playback 2-141 Movie Posters and Movie Previews 2-144 Movies and Your Event Loop 2-154 Preferred Movie Settings 2-160 Enhancing Movie Playback Performance 2-163 Disabling Movies and Tracks 2-175 Generating Pictures From Movies 2-177 Creating Tracks and Media Structures 2-180 Working With Progress and Cover Functions 2-184 Functions That Modify Movie Properties 2-186 Working With Movie Spatial Characteristics 2-187 Working With Sound Volume 2-210 Working with Movie Time 2-213 Working With Track Time 2-220 Working With Media Time 2-223 Finding Interesting Times 2-225 Locating a Movie’s Tracks and Media Structures 2-231 Working With Alternate Tracks 2-236 Working With Data References 2-244 Determining Movie Creation and Modification Time 2-248 Working With Media Samples 2-251 Working With Movie User Data 2-258 Functions for Editing Movies 2-271 Editing Movies 2-271 Undo for Movies 2-283 Low-Level Movie-Editing Functions 2-285 Editing Tracks 2-290 Undo for Tracks 2-297 Adding Samples to Media Structures 2-299 Media Functions 2-309 Selecting Media Handlers 2-310 Video Media Handler Functions 2-315 Sound Media Handler Functions 2-316 Text Media Handler Functions 2-318 Functions for Creating File Previews 2-329 Functions for Displaying File Previews 2-332 Time Base Functions 2-343 Creating and Disposing of Time Bases 2-343 Working With Time Base Values 2-350 Working With Times 2-360 Time Base Callback Functions 2-362 Matrix Functions 2-368 Application-Defined Functions 2-381 v Progress Functions 2-381 Cover Functions 2-384 Error-Notification Functions 2-385 Movie Callout Functions 2-385 File Filter Functions 2-386 Custom Dialog Functions 2-387 Modal-Dialog Filter Functions 2-388 Standard File Activation Functions 2-389 Callback Event Functions 2-390 Text Functions 2-391 Summary of Constants 2-391 Result Codes 2-395 Chapter 3 Image Compression Manager 3-397 Introduction to the Image Compression Manager 3-399 Data That Is Suitable for Compression 3-400 Storing Images 3-402 About Image Compression 3-402 Image-Compression Characteristics 3-402 Compression Ratio 3-402 Compression Speed 3-403 Image Quality 3-403 Compressors Supplied by Apple 3-403 The Photo Compressor 3-404 The Video Compressor 3-404 The Compact Video Compressor (Cinepak) 3-405 The Animation Compressor 3-405 The Graphics Compressor 3-405 The Raw Compressor 3-406 Types of Images Suitable for Different Compressors 3-407 Using the Image Compression Manager 3-422 Getting Information About Compressors and Compressed Data 3-422 Working With Pictures 3-422 Compressing Images 3-425 Decompressing Images 3-428 Compressing Sequences 3-429 Decompressing Sequences 3-431 Decompressing Still Images From a Sequence 3-432 Using Screen Buffers and Image Buffers 3-432 A Sample Program for Compressing and Decompressing a Sequence of Images 3-433 A Sample Function for Saving a Sequence of Images to a Disk File 3-434 A Sample Function for Creating, Compressing, and Drawing a Sequence of Images 3-436 vi A Sample Function for Decompressing and Playing Back a Sequence From a Disk File 3-440 Spooling Compressed Data 3-442 Banding and Extending Images 3-443 Defining Key Frame Rates 3-445 Fast Dithering 3-445 Understanding Compressor Components 3-446 Image Compression Manager Reference 3-447 Data Types 3-447 The Image Description Structure 3-447 The Compressor Information Structure 3-450 The Compressor Name Structure 3-453 The Compressor Name List Structure 3-454 Compression Quality Constants