< Previous PageNext Page > Hide TOC

Movie Toolbox Access Keys

Access keys make it possible to protect data. They allow an application that supplies data to register a password for the data with QuickTime and allows a user to enter the password to gain access to the data. For example, a codec can protect data it compresses with a password, so that it is available only to someone with the password. Similarly, the creator of a movie can require a password to view the movie.

In order to gain access to protected data, the user enters the access key in the QuickTime Settings control panel.

In this section:

System and Application Access Keys
Access Key Types
Using Access Keys


System and Application Access Keys

There are two kinds of access keys:

System access keys are useful for data that needs to be used by more than one application. When a system access key is registered for data, applications do not have to perform any additional registration to unlock the data. In contrast, application access keys are normally registered by the application in which the data is available, and each application registers the application access keys it uses. For example, a CD-ROM vendor can register the same application access key for all the data on the CD-ROM, which makes the data available to the application on the CD-ROM (such as a game) and inaccessible to all other applications. This prevents browsing of the data by users.

Access Key Types

Access keys are grouped by type. For example, there could be an access key type defined specifically for the Cinepak codec. Grouping access keys lets a QuickTime caller request only those keys that apply to it. This speeds operations involving large numbers of keys which might otherwise interfere with the performance of real-time operations. The functions for using access keys all require an access type.

Using Access Keys

This section illustrates how to use access keys.

Registering an Access Key

Listing 6-1 illustrates how to register an application access key.

Listing 6-1  Registering an application access key

OSErr myErr = 0;
Str255 keyType = doomCDKeyType;
long flags = AccessKeySystemFlag;
handle keyHdl;
keyHdl = NewHandle (sizeof("keykeykey")-1);
/* put key in handle */
myErr = QTRegisterAccessKey (keyType, flags, keyHdl);

Listing 6-2 illustrates how to register a system access key.

Listing 6-2  Registering a system access key

OSErr myErr = 0;
Str255 keyType = doomCDKeyType;
long flags = 0;
handle keyHdl;
keyHdl = NewHandle (sizeof("keykeykey")-1);
/* put key in handle */
myErr = QTRegisterAccessKey (keyType, flags, keyHdl);

Getting Access Keys

Listing 6-3 illustrates how to get application access keys of a particular type.

Listing 6-3  Getting access keys

OSErr myErr = 0;
Str255 keyType = doomCDKeyType;
long flags = 0;
handle keyHdl;
/* handle initialization here */
myErr = QTGetAccessKeys (keyType, flags, keyHdl);

Unregistering an Access Key

Listing 6-4 illustrates how to unregister a system access key.

Listing 6-4  Unregistering an access key

OSErr myErr = 0;
Str255 keyType = doomCDKeyType;
long flags = AccessKeySystemFlag;
handle keyHdl;
keyHdl = NewHandle (sizeof("keykeykey")-1);
/* put key in handle */
myErr = QTUnRegisterAccessKey (keyType, flags, keyHdl);


< Previous PageNext Page > Hide TOC


© 2005, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-01-10)


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.