quicktime
Class QTSession

java.lang.Object
  |
  +--quicktime.QTSession
All Implemented Interfaces:
quicktime.jdirect.InterfaceLib, quicktime.jdirect.PrimitivesLib, quicktime.jdirect.QuickDraw3DLib, quicktime.jdirect.QuickTimeLib, quicktime.jdirect.QuickTimeVRLib, quicktime.jdirect.SharedLibrary, com.apple.jdirect.SharedLibrary

public final class QTSession
extends java.lang.Object
implements quicktime.jdirect.QuickTimeLib, quicktime.jdirect.QuickTimeVRLib, quicktime.jdirect.QuickDraw3DLib

This class will check if QT is present and provides calls for enterMovies. This essentially does any initialisation that QT requires.

QTSession.open will intialize QuickTime, do a gestalt check and call enterMovies. Calls to the initialize routine are accumulative - thus if your code calls QTSession.open (which calls QTSession.initialize) and/or QTSession.initialize, the current session of QuickTime will only be closed down when it gets the same number of calls to QTSession.close (which calls QTSession.terminate) and/or QTSession.terminate.

A typical usage of QTSession calls by an application, applet or bean is: (this gives the applet version)

public class MyApplet extends Applet {
public void init () {
try {
QTSession.open();
...
} catch (QTException e) {
}
}


public void destroy () {
QTSession.close();
}
}
Thus the applet initializes the QTSession in its init method and closes it down in its destroy method. This ensures that if you have other applets (or beans, etc) that are running in the same process that the QuickTime session will only be terminated when all of the current Java QTSessions in that process have been destroyed.


Field Summary
static int kInit3D
          Flags that can be passed in to the open call to also initialise these environments.
static int kInitVR
          Flags that can be passed in to the open call to also initialise these environments.
static int kMacOS
          The list of currently supported operating systems for QTJava.
static int kMacOSX
          The list of currently supported operating systems for QTJava.
static int kWin32
          The list of currently supported operating systems for QTJava.
 
Fields inherited from interface quicktime.jdirect.QuickTimeLib
JDirect_MacOSX, libraryInstance, name
 
Fields inherited from interface quicktime.jdirect.QuickTimeVRLib
JDirect_MacOSX, libraryInstance
 
Fields inherited from interface quicktime.jdirect.QuickDraw3DLib
libraryInstance
 
Method Summary
static void addActiveCanvas(java.lang.Object c)
          Adds a canvas to a registry of active canvases.
static boolean canDoFullScreen()
           
static void close()
          This call will close down the QTML environment.
static void enterMovies()
          Before you call any Movie Toolbox functions, you must initialize the toolbox

QuickTime::EnterMovies()

static void exitMovies()
          QuickTime calls the ExitMovies function automatically when your application quits - you only need to call thi function if you finish with the Movie Toolbox long before your application is ready to quit.
static int gestalt(int selector)
          This call will do a gestalt check.
static int getBugFixVersion()
          This returns the sub version of QuickTime that is currently present
static int getDeveloperVersion()
          This returns the sub version of QuickTime that is currently present
static int getJavaVersion()
          Return the Java version in the format of:0xVVVVSSSS.
static int getMajorVersion()
          This contains the version of QuickTime that is currently present
static int getMinorVersion()
          This returns the sub version of QuickTime that is currently present
static int getQTMajorVersion()
          This returns the major version of QuickTime
static int getQTMinorVersion()
          This returns the minor version of QuickTime
static int getQTVersion()
          This returns the complete version number of QuickTime
static boolean hasSecurityRestrictions()
           
static void initialize(int flag)
          This call will open a QTSession and perform any initialisations of the QT environment.
static void initialize(int flag, java.lang.Class signedClass)
          This call will open a QTSession and perform any initialisations of the QT environment.
static void initialize3D()
           
static void initializeVR()
          This call will initialize QTVR.
static boolean is3DInitialized()
          This call will return true if the QuickTime Session has been initialized, otherwise false.
static boolean isClassSigned()
          To check if the class has been registered and is signed.
static boolean isCurrentOS(int osName)
          This method returns true if the passed in OS name is the OS upon which the current session of QuickTime is running.
static boolean isInitialized()
          This call will return true if the QuickTime Session has been initialized, otherwise false.
static boolean isQD3DAvailable()
          Determine whether it is safe to call a QuickDraw 3D API.
static boolean isQTVRAvailable()
          Determine whether it is safe to call a QuickTime VR API.
static boolean isVRInitialized()
          This call will return true if the QuickTime Session has been initialized, otherwise false.
static void open()
          This call will open a QTSession and perform any initialisations of the QTML environment.
static void open(java.lang.Class signedClass)
          This call will open a QTSession and perform any initialisations of the QTML environment.
static void open(int initFlag)
          This call will open a QTSession and perform any initialisations of the QTML environment.
static void open(int initFlag, java.lang.Class signedClass)
          This call will open a QTSession and perform any initialisations of the QTML environment.
static void open(int majorVersion, int minorVersion, int initFlag)
          This call will open a QTSession and perform any initialisations of the QTML environment.
static void open(int majorVersion, int minorVersion, int initFlag, java.lang.Class signedClass)
          This call will open a QTSession and perform any initialisations of the QTML environment.
static void removeActiveCanvas(java.lang.Object c)
          Removes a canvas from a registry of active canvases.
static void terminate()
          This call will close down the QTML environment, VR and QD3D.
static void terminate3D()
          This call will terminate QuickDraw3D.
static void terminateVR()
          This call will terminate QTVR.
static java.lang.Object terminationLock()
          This returns an object that can be synchronized against for termination checking.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kMacOS

public static final int kMacOS
The list of currently supported operating systems for QTJava.

kWin32

public static final int kWin32
The list of currently supported operating systems for QTJava.

kMacOSX

public static final int kMacOSX
The list of currently supported operating systems for QTJava.

kInitVR

public static final int kInitVR
Flags that can be passed in to the open call to also initialise these environments.

kInit3D

public static final int kInit3D
Flags that can be passed in to the open call to also initialise these environments.
Method Detail

getJavaVersion

public static int getJavaVersion()
Return the Java version in the format of:0xVVVVSSSS.
Returns:
an int

isClassSigned

public static boolean isClassSigned()
To check if the class has been registered and is signed.
Returns:
true if applet is signed and registered. Returns false if a signedClass has not been registered with the QTSession.initialize or open methods.

hasSecurityRestrictions

public static boolean hasSecurityRestrictions()

canDoFullScreen

public static boolean canDoFullScreen()
Returns:
true if program is able to run in FullScreen mode.

isCurrentOS

public static boolean isCurrentOS(int osName)
This method returns true if the passed in OS name is the OS upon which the current session of QuickTime is running.
Parameters:
osName - the osName of the system that you want to find out if you are running on.
Returns:
true if the current OS is the one as passed in or false if not.

isInitialized

public static boolean isInitialized()
This call will return true if the QuickTime Session has been initialized, otherwise false. An application should acquire the termination lock if it is possible that the QTSession has been terminated or could be terminated whilst this query is being processed.
 	synchronized (QTSession.terminationLock()) {
		if (QTSession.isInitialized()) {
			//...
		}
	}
 
Returns:
true if still initialized

isVRInitialized

public static boolean isVRInitialized()
This call will return true if the QuickTime Session has been initialized, otherwise false.

is3DInitialized

public static boolean is3DInitialized()
This call will return true if the QuickTime Session has been initialized, otherwise false.

initialize

public static void initialize(int flag)
                       throws QTException
This call will open a QTSession and perform any initialisations of the QT environment. If you use this call (and not the open calls) then you should also ensure that you check that QT is present through the gestalt call and call enterMovies to initialize the movie toolbox.

QuickTime::InitializeQTML()

Parameters:
flag - flag that are valid for this call.

initialize

public static void initialize(int flag,
                              java.lang.Class signedClass)
                       throws QTException
This call will open a QTSession and perform any initialisations of the QT environment. If you use this call (and not the open calls) then you should also ensure that you check that QT is present through the gestalt call and call enterMovies to initialize the movie toolbox.

QuickTime::InitializeQTML()

Parameters:
flag - flag that are valid for this call.
signedClass - the Class object which is signed

initializeVR

public static void initializeVR()
                         throws QTException
This call will initialize QTVR. It must be called before any of the QTVR API calls are made.

QuickTime::InitializeQTVR()


initialize3D

public static void initialize3D()
                         throws QTException

open

public static void open()
                 throws QTException
This call will open a QTSession and perform any initialisations of the QTML environment. This will ensure that any required initialisations are performed, and that the required version of QuickTime is present. The minimal version of QT that is required is version 3. This will also call EnterMovies.

QuickTime::InitializeQTML()



QuickTime::Gestalt()



QuickTime::EnterMovies()


open

public static void open(int initFlag)
                 throws QTException
This call will open a QTSession and perform any initialisations of the QTML environment. This will ensure that any required initialisations are performed, and that the required version of QuickTime is present. The minimal version of QT that is required is version 3. You can set the initialisation options to also have this call initialise QuickTimeVR and/or QuickDraw3D.
Parameters:
initFlag - can also initialise VR or 3D. This will also call EnterMovies.

QuickTime::InitializeQTML()



QuickTime::Gestalt()



QuickTime::EnterMovies()


open

public static void open(int majorVersion,
                        int minorVersion,
                        int initFlag)
                 throws QTException
This call will open a QTSession and perform any initialisations of the QTML environment. You can optionally open a session where the specified minimal version and minorVersion of QT must be present or an exception will be thrown. This will also call EnterMovies for you.

QuickTime::InitializeQTML()



QuickTime::Gestalt()



QuickTime::EnterMovies()

Parameters:
version - the minimal version of QT that must be present
minorVersion - the minimal minorVersion of QT that must be present
initFlag - can also initialise VR or 3D.

open

public static void open(java.lang.Class signedClass)
                 throws QTException
This call will open a QTSession and perform any initialisations of the QTML environment. This will ensure that any required initialisations are performed, and that the required version of QuickTime is present. The minimal version of QT that is required is version 3. This will also call EnterMovies.

QuickTime::InitializeQTML()



QuickTime::Gestalt()



QuickTime::EnterMovies()

Parameters:
theClass - the Class object which is signed

open

public static void open(int initFlag,
                        java.lang.Class signedClass)
                 throws QTException
This call will open a QTSession and perform any initialisations of the QTML environment. This will ensure that any required initialisations are performed, and that the required version of QuickTime is present. The minimal version of QT that is required is version 3. You can set the initialisation options to also have this call initialise QuickTimeVR and/or QuickDraw3D.
Parameters:
initFlag - can also initialise VR or 3D.
theClass - the Class object which is signed This will also call EnterMovies.

QuickTime::InitializeQTML()



QuickTime::Gestalt()



QuickTime::EnterMovies()


open

public static void open(int majorVersion,
                        int minorVersion,
                        int initFlag,
                        java.lang.Class signedClass)
                 throws QTException
This call will open a QTSession and perform any initialisations of the QTML environment. You can optionally open a session where the specified minimal version and minorVersion of QT must be present or an exception will be thrown. This will also call EnterMovies for you.

QuickTime::InitializeQTML()



QuickTime::Gestalt()



QuickTime::EnterMovies()

Parameters:
version - the minimal version of QT that must be present
minorVersion - the minimal minorVersion of QT that must be present
initFlag - can also initialise VR or 3D.
signedClass - the Class object which is signed

close

public static void close()
This call will close down the QTML environment. This call should not be called from one of the quicktime.app.time.TaskThread objects as a side effect of this call is stopping all thread that belong to the TaskThread group.
See Also:
terminate

terminate

public static void terminate()
This call will close down the QTML environment, VR and QD3D. This will mean that the QTML environment will need to be reinitialised before it can be used again. This call should not be called from one of the quicktime.app.time.TaskThread objects as a side effect of this call is stopping all thread that belong to the TaskThread group.

QuickTime::TerminateQTML()


terminationLock

public static java.lang.Object terminationLock()
This returns an object that can be synchronized against for termination checking.
See Also:
isInitialised

terminateVR

public static void terminateVR()
This call will terminate QTVR. You cannot call QTVR API's after you make this call unless you reinitialize QTVR first. QTSession.close will terminate VR if it has been initialized.

QuickTime::TerminateQTVR()


terminate3D

public static void terminate3D()
This call will terminate QuickDraw3D. You cannot call QD3D API's after you make this call unless you reinitialize QD3D first. QTSession.close will terminate 3D if it has been initialized.

QuickTime::Q3Exit()


isQD3DAvailable

public static boolean isQD3DAvailable()
                               throws QTException
Determine whether it is safe to call a QuickDraw 3D API.

QuickTime::Gestalt(gestaltQD3D,result)


isQTVRAvailable

public static boolean isQTVRAvailable()
                               throws QTException
Determine whether it is safe to call a QuickTime VR API.

QuickTime::Gestalt(gestaltQTVRMgrAttr,result)


gestalt

public static final int gestalt(int selector)
                         throws QTException
This call will do a gestalt check. If you are on a non-Macintosh machine this call will also initialise QTML if that has not already been done. It will return the result value if the gestalt check is successful,

QuickTime::Gestalt()

Parameters:
selector - the selector code for the information you need.

enterMovies

public static final void enterMovies()
                              throws QTException
Before you call any Movie Toolbox functions, you must initialize the toolbox

QuickTime::EnterMovies()


exitMovies

public static final void exitMovies()
QuickTime calls the ExitMovies function automatically when your application quits - you only need to call thi function if you finish with the Movie Toolbox long before your application is ready to quit.

QuickTime::ExitMovies()


getMajorVersion

public static final int getMajorVersion()
This contains the version of QuickTime that is currently present

getMinorVersion

public static final int getMinorVersion()
This returns the sub version of QuickTime that is currently present

getBugFixVersion

public static final int getBugFixVersion()
This returns the sub version of QuickTime that is currently present

getDeveloperVersion

public static final int getDeveloperVersion()
This returns the sub version of QuickTime that is currently present

getQTVersion

public static int getQTVersion()
This returns the complete version number of QuickTime

getQTMajorVersion

public static int getQTMajorVersion()
This returns the major version of QuickTime

getQTMinorVersion

public static int getQTMinorVersion()
This returns the minor version of QuickTime

addActiveCanvas

public static void addActiveCanvas(java.lang.Object c)
Adds a canvas to a registry of active canvases. You should not need to call this method.

removeActiveCanvas

public static void removeActiveCanvas(java.lang.Object c)
Removes a canvas from a registry of active canvases. You should not need to call this method.