Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

API to Determine Whether QuickTime Can Open a File

QuickTime 5 includes the addition of two new functions –– CanQuickTimeOpenFile and CanQuickTimeOpenDataRef, discussed in this section. The CanQuickTimeOpenFile call determines whether QuickTime can open a given file or, in general, files of a given type. The CanQuickTimeOpenDataRef call is similar to CanQuickTimeOpenFile except that it uses a data reference instead of a file.

The input flags for CanQuickTimeOpenFile and CanQuickTimeOpenFileDataRef are defined as follows:

enum {
    kQTDontUseDataToFindImporter = 1L << 0,
    kQTDontLookForMovieImporterIfGraphicsImporterFound = 1L << 1,
    kQTAllowOpeningStillImagesAsMovies = 1L << 2,
    kQTAllowImportersThatWouldCreateNewFile = 1L << 3,
    kQTAllowAggressiveImporters = 1L << 4
};

CanQuickTimeOpenFile

Determines whether the file could be opened using a graphics importer or opened in place as a movie.

CanQuickTimeOpenFile  (FSSpecPtr     fileSpec,
   OSType        fileType,
   OSType        fileNameExtension,
   Boolean *     outCanOpenWithGraphicsImporter,
   Boolean *     outCanOpenAsMovie,
   Boolean *     outPreferGraphicsImporter,
   UInt32        inFlags);

Parameters
fileSpec

Points to an FSSpec identifying the file in question. If you just want to ask about a particular file type and/or file name suffix in general, pass NULL.

fileType

Contains the file type if already known, or 0 if not known. If fileSpec is provided and fileType is 0, QuickTime will call the File Manager to determine the file type. If you pass NULL in fileSpec and 0 in fileNameExtension, you must pass a file type here.

fileNameExtension

Contains the file name suffix if already known, or 0 if not known. The file name suffix should be encoded as an uppercase four-character-code with trailing spaces; for instance, the suffix ".png" should be encoded as 'PNG', or 0x504e4720. If fileSpec is provided and fileNameExtension is 0, QuickTime will examine fileSpec to determine the file name suffix. If you pass NULL in fileSpec and 0 in fileType, you must pass a file name suffix here.

outCanOpenWithGraphicsImporter

Points to a boolean which will be set to true if the file can be opened using a graphics importer and false otherwise. If you do not want this information, pass NULL.

outCanOpenAsMovie

Points to a boolean which will be set to true if the file can be opened as a movie and false otherwise. If you do not want this information, pass NULL.

outPreferGraphicsImporter

Points to a boolean which will be set to true if the file can be opened using a graphics importer and opened as a movie, but, all other things being equal, QuickTime recommends using a graphics importer. For example, QuickTime would recommend using a graphics importer for single-frame GIF files and opening as a movie for multiple-frame GIF files.

If you do not want this information, pass NULL.

Passing a non-NULL pointer disables the kQTDontUseDataToFindImporter and kQTDontLookForMovieImporterIfGraphicsImporterFound flags, if set.

inFlags

Specifies flags which modify search behavior. Pass 0 for default behavior.

Flags available are:

kQTDontUseDataToFindImporter

Tells QuickTime not to use the data in the file to help in the search. This will speed up the search, especially in cases where a negative result is returned, but it will cause QuickTime to report that it can not open files which aren’t identified by a recognized file type or file name suffix.

kQTDontLookForMovieImporterIfGraphicsImporterFound

Tells QuickTime to short-circuit its search as soon as it finds one way to open the file. Pass this flag if you want to know whether a file can be opened with a graphics importer or as a movie, but you don’t care which.

kQTAllowOpeningStillImagesAsMovies

Tells QuickTime to consider opening still images as movies. If this flag is set, if a file can be opened using a graphics importer QuickTime will automatically say it can be opened as a movie.

kQTAllowImportersThatWouldCreateNewFile

Tells QuickTime to include importers which would create new files. If this flag is clear, QuickTime only includes importers which can import in place without needing to create new files.

kQTAllowAggressiveImporters

Tells QuickTime to include movie importers for file types like PICT and TEXT which aren’t traditionally thought of as movies.

If this flag is clear, QuickTime excludes these movie importers.

Return Value

The possible error codes are paramErr and memFullErr.

Discussion

CanQuickTimeOpenFile determines whether QuickTime can open a given file or, in general, files of a given type.

You should pass NULL in parameters that do not interest you, since that will allow QuickTime to perform a faster search.

Availability
Declared In
Movies.h

CanQuickTimeOpenDataRef

Determines whether the data reference could be opened using a graphics importer or opened in place as a movie.

CanQuickTimeOpenDataRef (Handle      dataRef,
   OSType      dataRefType,
   Boolean *   outCanOpenWithGraphicsImporter,
   Boolean *   outCanOpenAsMovie,
   Boolean *   outPreferGraphicsImporter,
   UInt32      inFlags);

Discussion

Similar to CanQuickTimeOpenFile except that it uses a data reference instead of a file.

Availability
Declared In
Movies.h

< Previous PageNext Page > Hide TOC


Last updated: 2001-10-01




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.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice