Package quicktime

Source Code of quicktime.QTSession

/*      */ package quicktime;
/*      */
/*      */ import java.awt.Component;
/*      */ import java.awt.EventQueue;
/*      */ import java.awt.Frame;
/*      */ import java.awt.Toolkit;
/*      */ import java.io.InvalidObjectException;
/*      */ import java.io.ObjectStreamException;
/*      */ import java.io.PrintStream;
/*      */ import java.security.AccessController;
/*      */ import java.security.AllPermission;
/*      */ import java.security.PrivilegedAction;
/*      */ import java.util.Vector;
/*      */ import quicktime.app.time.TaskThread;
/*      */ import quicktime.jdirect.QTNative;
/*      */ import quicktime.qd.GDevice;
/*      */ import quicktime.qd.QDGraphics;
/*      */ import quicktime.qd.QDRect;
/*      */ import quicktime.qd3d.QD3DException;
/*      */ import quicktime.util.QTBuild;
/*      */ import quicktime.util.QTUtils;
/*      */ import sun.awt.DrawingSurface;
/*      */ import sun.awt.DrawingSurfaceInfo;
/*      */ import sun.awt.Win32DrawingSurface;
/*      */
/*      */ public final class QTSession
/*      */ {
/*   72 */   private static boolean apriori = apriori();
/*      */   private static Object linkage;
/*  205 */   private static boolean doneVMCheck = false;
/*      */
/*  208 */   private static boolean qtPresent = false;
/*  209 */   private static boolean gestaltDone = false;
/*  210 */   private static boolean vrinitialized = false;
/*  211 */   private static int initDone = 0;
/*  212 */   private static boolean threeDInitialised = false;
/*  213 */   private static boolean enterCalled = false;
/*      */   private static int version;
/*  217 */   private static int osConstant = 0;
/*      */   private static int jVersion;
/*  219 */   private static Class theClass = null;
/*      */
/*  221 */   private static Object qtSessionSecurityContext = null;
/*      */   public static final int kMacOS = 1;
/*      */   public static final int kWin32 = 2;
/*      */   public static final int kMacOSX = 4;
/*      */   public static final int kInitVR = 1;
/*      */   public static final int kInit3D = 2;
/*  486 */   private static boolean firstTime = true;
/*      */
/*  489 */   private static boolean qtjwiredDebug = false;
/*      */
/*  545 */   private static int wPort = 0;
/*  546 */   private static int hWnd = 0;
/*      */   private static Object dispatchFrame;
/*      */   private static Object macQuitter;
/*      */   static int sessionID;
/*  861 */   private static final Object termLock = new Object();
/*      */
/*  983 */   private static Vector canvases = new Vector();
/*      */
/*      */   public static boolean apriori()
/*      */   {
/*  154 */     return true;
/*      */   }
/*      */
/*      */   private void readObjectNoData() throws ObjectStreamException {
/*  158 */     throw new InvalidObjectException("This object cannot be deserialised with current security settings");
/*      */   }
/*      */
/*      */   private static void doVMCheck()
/*      */   {
/*  163 */     if (!doneVMCheck) {
/*  164 */       String str1 = System.getProperty("java.version");
/*  165 */       int i = 0;
/*  166 */       while (!Character.isDigit(str1.charAt(i))) {
/*  167 */         i++;
/*      */       }
/*  169 */       int j = Character.getNumericValue(str1.charAt(i));
/*  170 */       jVersion = j << 16;
/*      */
/*  172 */       int k = 0;
/*      */
/*  174 */       if (str1.length() > i + 1) {
/*  175 */         i++;
/*      */
/*  177 */         while ((str1.length() > i) && (!Character.isDigit(str1.charAt(i)))) {
/*  178 */           i++;
/*      */         }
/*  180 */         if (str1.length() > i) {
/*  181 */           k = Character.getNumericValue(str1.charAt(i));
/*      */         }
/*      */       }
/*      */
/*  185 */       jVersion |= k;
/*  186 */       if ((j < 1) || ((j == 1) && (k < 1))) {
/*  187 */         throw new QTRuntimeException("QTJava requires Java Version 1.1 or greater");
/*      */       }
/*      */
/*  190 */       String str2 = System.getProperty("java.vendor");
/*  191 */       String str3 = System.getProperty("os.name");
/*  192 */       if (isCurrentOS(2)) {
/*  193 */         if ((str2.startsWith("Netscape")) || (str2.startsWith("Microsoft"))) {
/*  194 */           throw new QTRuntimeException("QTJava requires Sun Java VM 1.1 or greater");
/*      */         }
/*      */       }
/*  197 */       else if (!str2.startsWith("Apple ")) {
/*  198 */         throw new QTRuntimeException("QTJava requires Apple Java VM 1.1 or greater");
/*      */       }
/*      */
/*  201 */       doneVMCheck = true;
/*      */     }
/*      */   }
/*      */
/*      */   public static int getJavaVersion()
/*      */   {
/*  242 */     if (jVersion == 0)
/*  243 */       doVMCheck();
/*  244 */     return jVersion;
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public static boolean isClassSigned()
/*      */   {
/*  257 */     if (theClass != null) {
/*  258 */       Object[] arrayOfObject = theClass.getSigners();
/*  259 */       return arrayOfObject != null;
/*      */     }
/*  261 */     return false;
/*      */   }
/*      */
/*      */   public static boolean hasSecurityRestrictions()
/*      */   {
/*  268 */     SecurityManager localSecurityManager = null;
/*  269 */     if ((localSecurityManager = System.getSecurityManager()) != null)
/*      */     {
/*      */       try
/*      */       {
/*  273 */         if (qtSessionSecurityContext == null)
/*  274 */           localSecurityManager.checkPermission(new AllPermission());
/*      */         else
/*  276 */           localSecurityManager.checkPermission(new AllPermission(), qtSessionSecurityContext);
/*      */       }
/*      */       catch (SecurityException localSecurityException)
/*      */       {
/*  280 */         return true;
/*      */       }
/*      */     }
/*      */
/*  284 */     return false;
/*      */   }
/*      */
/*      */   private static boolean willSandboxQTComponents()
/*      */   {
/*  291 */     if (isCurrentOS(2)) {
/*  292 */       return false;
/*      */     }
/*      */
/*  295 */     SecurityManager localSecurityManager = null;
/*  296 */     if ((localSecurityManager = System.getSecurityManager()) != null) {
/*      */       try
/*      */       {
/*  299 */         if (qtSessionSecurityContext == null)
/*  300 */           localSecurityManager.checkPermission(new AllPermission());
/*      */         else
/*  302 */           localSecurityManager.checkPermission(new AllPermission(), qtSessionSecurityContext);
/*      */       }
/*      */       catch (SecurityException localSecurityException)
/*      */       {
/*  306 */         QTJSetSandboxQTComponents(1);
/*  307 */         return true;
/*      */       }
/*      */     }
/*  310 */     return false;
/*      */   }
/*      */
/*      */   public static boolean canDoFullScreen()
/*      */   {
/*  317 */     if (System.getSecurityManager() != null) {
/*  318 */       return (!hasSecurityRestrictions()) || (System.getSecurityManager().checkTopLevelWindow(new Frame()));
/*      */     }
/*  320 */     return true;
/*      */   }
/*      */
/*      */   public static boolean isCurrentOS(int paramInt)
/*      */   {
/*  330 */     if (osConstant <= 0) {
/*  331 */       if (osConstant == -1) {
/*  332 */         return false;
/*      */       }
/*  334 */       String str = System.getProperty("os.name");
/*      */
/*  336 */       if ((str.regionMatches(false, 0, "Darwin", 0, 6)) || (str.regionMatches(false, 0, "Mac OS X", 0, 8)))
/*  337 */         osConstant = 4;
/*  338 */       else if (str.regionMatches(false, 0, "Mac", 0, 3))
/*  339 */         osConstant = 1;
/*  340 */       else if (str.regionMatches(false, 0, "Win", 0, 3))
/*  341 */         osConstant = 2;
/*      */       else {
/*  343 */         osConstant = -1;
/*      */       }
/*      */     }
/*  346 */     return (paramInt & osConstant) != 0;
/*      */   }
/*      */
/*      */   public static boolean isInitialized()
/*      */   {
/*  363 */     return initDone != 0;
/*      */   }
/*      */
/*      */   public static boolean isVRInitialized()
/*      */   {
/*  369 */     return vrinitialized;
/*      */   }
/*      */
/*      */   public static boolean is3DInitialized()
/*      */   {
/*  374 */     return threeDInitialised;
/*      */   }
/*      */
/*      */   public static void initialize(int paramInt)
/*      */     throws QTException
/*      */   {
/*  385 */     initialize(paramInt, null);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public static void initialize(int paramInt, Class paramClass)
/*      */     throws QTException
/*      */   {
/*  401 */     doVMCheck();
/*  402 */     synchronized (terminationLock()) {
/*  403 */       if (initDone == 0)
/*      */       {
/*  406 */         if (paramClass != null) {
/*  407 */           theClass = paramClass;
/*  408 */           if (!isClassSigned()) {
/*  409 */             throw new SecurityException(paramClass + ",is NOT SIGNED");
/*      */           }
/*      */         }
/*  412 */         if (isCurrentOS(2)) {
/*  413 */           int i = InitializeQTML(paramInt);
/*  414 */           QTException.checkError(i);
/*      */           try
/*      */           {
/*  418 */             Class.forName("java.awt.Frame");
/*  419 */             if (dispatchFrame == null) {
/*  420 */               QTFrame localQTFrame = new QTFrame();
/*  421 */               localQTFrame.setLayout(null);
/*  422 */               localQTFrame.pack();
/*  423 */               dispatchFrame = localQTFrame;
/*      */             }
/*      */           }
/*      */           catch (ClassNotFoundException localClassNotFoundException)
/*      */           {
/*      */           }
/*      */         }
/*  430 */         QTObject.qtIsNOTInitialized = false;
/*  431 */         initDone = 1;
/*  432 */         sessionID += 1;
/*      */
/*  435 */         if (!firstTime) {
/*  436 */           GDevice localGDevice = (GDevice)AccessController.doPrivileged(new PrivilegedAction() {
/*      */             public Object run() {
/*  438 */               return GDevice.getMain();
/*      */             }
/*      */           });
/*  442 */           QDGraphics.scratch = new QDGraphics(QDGraphics.kDefaultPixelFormat, new QDRect(1, 1), null, localGDevice, 2);
/*  443 */           QDGraphics.validScratch = new QDGraphics(QDGraphics.kDefaultPixelFormat, new QDRect(1, 1), null, localGDevice, 2);
/*      */         }
/*      */
/*  446 */         if ((isCurrentOS(1)) && (macQuitter == null))
/*  447 */           macQuitter = new MacDoQuit();
/*      */       } else {
/*  449 */         initDone += 1;
/*      */       }
/*      */     }
/*      */
/*  453 */     willSandboxQTComponents();
/*      */
/*  456 */     ??? = System.getSecurityManager();
/*  457 */     if (??? != null)
/*  458 */       qtSessionSecurityContext = ((SecurityManager)???).getSecurityContext();
/*      */   }
/*      */
/*      */   private static void JQTinitializeVR()
/*      */     throws QTException
/*      */   {
/*  498 */     vrinitialized = true;
/*      */   }
/*      */
/*      */   private static void JQTinitialize() throws QTException
/*      */   {
/*  503 */     doVMCheck();
/*  504 */     synchronized (terminationLock()) {
/*  505 */       if (qtjwiredDebug) System.out.println("JQTinitialize...");
/*  506 */       if (initDone == 0) {
/*  507 */         if (isCurrentOS(2))
/*      */         {
/*  509 */           hWnd = WinJNINative.GetHWND();
/*      */         }
/*      */
/*  512 */         int i = gestalt(1903454573);
/*  513 */         qtPresent = true;
/*  514 */         version = i;
/*  515 */         if ((getMajorVersion() < 4) || ((getMajorVersion() == 4) && (getMinorVersion() < 1))) {
/*  516 */           if (qtjwiredDebug) System.out.println("Version of QuickTime not found...");
/*  517 */           JQTterminate();
/*  518 */           throw new QTException("Version of QuickTime not found");
/*      */         }
/*      */
/*  521 */         QTObject.qtIsNOTInitialized = false;
/*  522 */         initDone = 1;
/*  523 */         sessionID += 1;
/*  524 */         if (qtjwiredDebug) System.out.println("scratch depth 0x" + Integer.toHexString(QDGraphics.kDefaultPixelFormat));
/*      */
/*  526 */         if (!firstTime)
/*      */         {
/*  528 */           GDevice localGDevice = (GDevice)AccessController.doPrivileged(new PrivilegedAction() {
/*      */             public Object run() {
/*  530 */               return GDevice.getMain();
/*      */             }
/*      */           });
/*  534 */           QDGraphics.scratch = new QDGraphics(QDGraphics.kDefaultPixelFormat, new QDRect(1, 1), null, localGDevice, 2);
/*  535 */           if (qtjwiredDebug) System.out.println("validScratch depth 0x" + Integer.toHexString(QDGraphics.kDefaultPixelFormat));
/*  536 */           QDGraphics.validScratch = new QDGraphics(QDGraphics.kDefaultPixelFormat, new QDRect(1, 1), null, localGDevice, 2);
/*      */         }
/*  538 */         if (qtjwiredDebug) System.out.println("JQTinitialized");
/*      */       }
/*  540 */       else { initDone += 1; }
/*      */
/*      */     }
/*      */   }
/*      */
/*      */   public static void initializeVR()
/*      */     throws QTException
/*      */   {
/*  556 */     if (!isInitialized())
/*  557 */       initialize(0);
/*  558 */     if (!vrinitialized) {
/*  559 */       JQTinitializeVR();
/*      */
/*  561 */       if (isCurrentOS(2)) {
/*  562 */         int i = InitializeQTVR();
/*  563 */         QTException.checkError(i);
/*      */       }
/*      */     }
/*      */   }
/*      */
/*      */   public static void initialize3D()
/*      */     throws QTException
/*      */   {
/*  575 */     if (!isInitialized())
/*  576 */       initialize(0);
/*  577 */     if (!threeDInitialised) {
/*  578 */       if (isCurrentOS(1)) {
/*  579 */         gestalt(1902392164);
/*      */       }
/*      */       else
/*      */       {
/*  588 */         throw new QTRuntimeException("Unsupported OS");
/*      */       }
/*  590 */       int i = Q3Initialize();
/*  591 */       if (i == 0) throw new QD3DException(-28487);
/*      */     }
/*  593 */     threeDInitialised = true;
/*      */   }
/*      */
/*      */   public static void open()
/*      */     throws QTException
/*      */   {
/*  606 */     open(3, 0, 0);
/*      */   }
/*      */
/*      */   public static void open(int paramInt)
/*      */     throws QTException
/*      */   {
/*  621 */     open(3, 0, paramInt);
/*      */   }
/*      */
/*      */   public static void open(int paramInt1, int paramInt2, int paramInt3)
/*      */     throws QTException
/*      */   {
/*  638 */     initialize(0);
/*  639 */     int i = gestalt(1903454573);
/*  640 */     qtPresent = true;
/*  641 */     version = i;
/*  642 */     if ((getMajorVersion() < paramInt1) || ((getMajorVersion() == paramInt1) && (getMinorVersion() < paramInt2)))
/*      */     {
/*  646 */       close();
/*  647 */       throw new QTException("Version of QuickTime not found");
/*      */     }
/*      */
/*  650 */     enterMovies();
/*  651 */     enterCalled = true;
/*  652 */     if ((0x1 & paramInt3) != 0) initializeVR();
/*  653 */     if (((0x2 & paramInt3) != 0) && (!isCurrentOS(4))) initialize3D();
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public static void open(Class paramClass)
/*      */     throws QTException
/*      */   {
/*  668 */     open(3, 0, 0, paramClass);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public static void open(int paramInt, Class paramClass)
/*      */     throws QTException
/*      */   {
/*  685 */     open(3, 0, paramInt, paramClass);
/*      */   }
/*      */
/*      */   public static void open(int paramInt1, int paramInt2, int paramInt3, Class paramClass)
/*      */     throws QTException
/*      */   {
/*  703 */     initialize(0, paramClass);
/*  704 */     int i = gestalt(1903454573);
/*  705 */     qtPresent = true;
/*  706 */     version = i;
/*  707 */     if ((getMajorVersion() < paramInt1) || ((getMajorVersion() == paramInt1) && (getMinorVersion() < paramInt2)))
/*      */     {
/*  711 */       close();
/*  712 */       throw new QTException("Version of QuickTime not found");
/*      */     }
/*  714 */     enterMovies();
/*  715 */     enterCalled = true;
/*  716 */     if ((0x1 & paramInt3) != 0) initializeVR();
/*  717 */     if (((0x2 & paramInt3) != 0) && (!isCurrentOS(4))) initialize3D();
/*      */   }
/*      */
/*      */   public static void close()
/*      */   {
/*  727 */     terminate();
/*      */   }
/*      */
/*      */   public static void terminate()
/*      */   {
/*  739 */     if (initDone > 1) { initDone -= 1; }
/*  741 */     else if (initDone == 1)
/*      */     {
/*  743 */       removeAllCanvases();
/*  744 */       TaskThread.killAllThreads();
/*  745 */       QTUtils.reclaimMemory();
/*      */
/*  747 */       synchronized (terminationLock())
/*      */       {
/*  751 */         QTObject.qtIsNOTInitialized = true;
/*  752 */         initDone = 0;
/*  753 */         synchronized (QTNative.globalsLock) {
/*  754 */           QTObjectManagement.removeAll();
/*      */         }
/*      */
/*  757 */         terminateVR();
/*  758 */         terminate3D();
/*  759 */         if (enterCalled) {
/*  760 */           exitMovies();
/*  761 */           enterCalled = false;
/*      */         }
/*      */
/*  765 */         if (!firstTime) {
/*  766 */           QDGraphics.scratch = null;
/*  767 */           QDGraphics.validScratch = null;
/*      */         } else {
/*  769 */           firstTime = false;
/*      */         }
/*  771 */         if (isCurrentOS(2)) {
/*  772 */           WinJNINative.DestroyPortAssociations();
/*  773 */           if ((dispatchFrame != null) && (wPort != 0))
/*      */           {
/*  775 */             DestroyPortAssociation(wPort);
/*  776 */             wPort = 0;
/*      */
/*  778 */             if (!EventQueue.isDispatchThread()) {
/*  779 */               ??? = new Runnable() {
/*      */                 public void run() {
/*  781 */                   ((Frame)QTSession.dispatchFrame).dispose();
/*  782 */                   QTSession.access$202(null);
/*      */                 }
/*      */               };
/*  785 */               EventQueue.invokeLater((Runnable)???);
/*      */             } else {
/*  787 */               ((Frame)dispatchFrame).dispose();
/*  788 */               dispatchFrame = null;
/*      */             }
/*      */
/*      */           }
/*      */
/*  796 */           TerminateQTML();
/*      */         }
/*      */
/*  799 */         theClass = null;
/*      */
/*  804 */         QTCallbackManagement.clearCallbacks();
/*      */       }
/*      */     }
/*      */   }
/*      */
/*      */   private static void JQTterminate()
/*      */   {
/*  813 */     if (initDone > 1) { initDone -= 1; }
/*  815 */     else if (initDone == 1) {
/*  816 */       if (qtjwiredDebug) System.out.println("Doing Terminate");
/*  817 */       removeAllCanvases();
/*  818 */       TaskThread.killAllThreads();
/*  819 */       QTUtils.reclaimMemory();
/*      */
/*  821 */       synchronized (terminationLock())
/*      */       {
/*  823 */         QTObject.qtIsNOTInitialized = true;
/*  824 */         initDone = 0;
/*      */
/*  826 */         QTObjectManagement.removeAll();
/*  827 */         if (qtjwiredDebug) System.out.println("After RemoveAll");
/*      */
/*  829 */         if (!firstTime) {
/*  830 */           QDGraphics.scratch = null;
/*  831 */           QDGraphics.validScratch = null;
/*      */         } else {
/*  833 */           firstTime = false;
/*      */         }
/*  835 */         if (isCurrentOS(2)) {
/*  836 */           WinJNINative.DestroyPortAssociations();
/*  837 */           if (hWnd != 0) {
/*  838 */             WinJNINative.DestroyHWnd(hWnd);
/*  839 */             hWnd = 0;
/*      */           }
/*      */
/*      */         }
/*      */
/*  844 */         theClass = null;
/*  845 */         vrinitialized = false;
/*      */       }
/*      */
/*  850 */       if (qtjwiredDebug) System.out.println(" JQTterminated");
/*      */     }
/*      */   }
/*      */
/*      */   public static Object terminationLock()
/*      */   {
/*  859 */     return termLock;
/*      */   }
/*      */
/*      */   public static void terminateVR()
/*      */   {
/*  869 */     if (vrinitialized) {
/*  870 */       QTUtils.reclaimMemory();
/*  871 */       if (isCurrentOS(2))
/*  872 */         TerminateQTVR();
/*  873 */       vrinitialized = false;
/*      */     }
/*      */   }
/*      */
/*      */   public static void terminate3D()
/*      */   {
/*  883 */     if (threeDInitialised) {
/*  884 */       QTUtils.reclaimMemory();
/*  885 */       int i = Q3Exit();
/*  886 */       threeDInitialised = false;
/*      */     }
/*      */   }
/*      */
/*      */   public static boolean isQD3DAvailable()
/*      */     throws QTException
/*      */   {
/*  895 */     if (!isCurrentOS(4)) {
/*      */       try {
/*  897 */         int i = gestalt(1902392164);
/*  898 */         return i == 1;
/*      */       }
/*      */       catch (QTException localQTException) {
/*  901 */         return false;
/*      */       }
/*      */     }
/*  904 */     return false;
/*      */   }
/*      */
/*      */   public static boolean isQTVRAvailable()
/*      */     throws QTException
/*      */   {
/*      */     try
/*      */     {
/*  915 */       int i = gestalt(1903457906);
/*  916 */       int j = i & 0x1;
/*  917 */       return j != 0;
/*      */     } catch (QTException localQTException) {
/*      */     }
/*  920 */     return false;
/*      */   }
/*      */
/*      */   public static final int gestalt(int paramInt)
/*      */     throws QTException
/*      */   {
/*  932 */     int[] arrayOfInt = { 0 };
/*  933 */     int i = Gestalt(paramInt, arrayOfInt);
/*  934 */     QTException.checkError(i);
/*  935 */     return arrayOfInt[0];
/*      */   }
/*      */
/*      */   public static final void enterMovies()
/*      */     throws QTException
/*      */   {
/*  943 */     doVMCheck();
/*  944 */     synchronized (QTNative.globalsLock)
/*      */     {
/*  946 */       if ((isCurrentOS(4)) && (getQTVersion() >= 104857600)) {
/*  947 */         setJavaThreadHook();
/*      */       }
/*  949 */       QTException.checkError(EnterMovies());
/*      */     }
/*      */   }
/*      */
/*      */   public static final void exitMovies()
/*      */   {
/*  958 */     ExitMovies();
/*      */   }
/*      */   public static final int getMajorVersion() {
/*  961 */     return (version & 0xF000000) >> 24;
/*      */   }
/*      */   public static final int getMinorVersion() {
/*  964 */     return (version & 0xF00000) >> 20;
/*      */   }
/*      */   public static final int getBugFixVersion() {
/*  967 */     return (version & 0xF0000) >> 16;
/*      */   }
/*      */   public static final int getDeveloperVersion() {
/*  970 */     return version & 0xFFFF;
/*      */   }
/*      */   public static int getQTVersion() {
/*  973 */     return version;
/*      */   }
/*      */   public static int getQTMajorVersion() {
/*  976 */     return (version & 0xFF000000) >>> 24;
/*      */   }
/*      */   public static int getQTMinorVersion() {
/*  979 */     return (version & 0xFF0000) >>> 16;
/*      */   }
/*      */
/*      */   static boolean isQTCanvas(Object paramObject)
/*      */   {
/*  987 */     Class localClass = paramObject.getClass();
/*  988 */     while ((localClass != null) && ((localClass.getName().equals("quicktime.app.view.QTJavaAWTCanvas")) || (localClass.getName().equals("quicktime.app.view.QTJavaCocoaCanvas")))) {
/*  989 */       localClass = localClass.getSuperclass();
/*      */     }
/*      */
/*  992 */     return localClass != null;
/*      */   }
/*      */
/*      */   public static void addActiveCanvas(Object paramObject)
/*      */   {
/* 1000 */     if (!isQTCanvas(paramObject)) return;
/* 1001 */     if (canvases.contains(paramObject)) return;
/* 1002 */     canvases.addElement(paramObject);
/*      */   }
/*      */
/*      */   public static void removeActiveCanvas(Object paramObject)
/*      */   {
/* 1010 */     canvases.removeElement(paramObject);
/*      */   }
/*      */
/*      */   private static void removeAllCanvases()
/*      */   {
/* 1019 */     while (canvases.size() > 0) {
/* 1020 */       Component localComponent = (Component)canvases.elementAt(0);
/*      */
/* 1022 */       removeActiveCanvas(localComponent);
/*      */     }
/*      */   }
/*      */
/*      */   static void setJavaThreadHook() {
/* 1027 */     SetJavaThreadCallbackProc();
/*      */   }
/*      */
/*      */   private static native void DestroyPortAssociation(int paramInt);
/*      */
/*      */   private static native int CreatePortAssociation(int paramInt1, int paramInt2, int paramInt3);
/*      */
/*      */   private static native short InitializeQTML(int paramInt);
/*      */
/*      */   private static native void TerminateQTML();
/*      */
/*      */   private static native short EnterMovies();
/*      */
/*      */   private static native void ExitMovies();
/*      */
/*      */   private static native short Gestalt(int paramInt, int[] paramArrayOfInt);
/*      */
/*      */   private static native int QTJSetSandboxQTComponents(int paramInt);
/*      */
/*      */   private static native short InitializeQTVR();
/*      */
/*      */   private static native short TerminateQTVR();
/*      */
/*      */   private static native int Q3Initialize();
/*      */
/*      */   private static native int Q3Exit();
/*      */
/*      */   private static native void SetJavaThreadCallbackProc();
/*      */
/*      */   static
/*      */   {
/*   78 */     if (hasSecurityRestrictions()) {
/*   79 */       throw new SecurityException("Applets that utilize QuickTime for Java must be signed.");
/*      */     }
/*      */
/*   83 */     if ((isCurrentOS(4)) && (getJavaVersion() >= 65540))
/*      */     {
/*   85 */       Toolkit.getDefaultToolkit();
/*      */     }
/*      */     try {
/*   88 */       if (EventQueue.isDispatchThread()) {
/*   89 */         System.loadLibrary("QTJNative");
/*      */       }
/*      */       else {
/*   92 */         EventQueue.invokeAndWait(new Runnable() {
/*      */           public void run() {
/*   94 */             System.loadLibrary("QTJNative");
/*      */           }
/*      */         });
/*      */       }
/*      */     }
/*      */     catch (Exception localException)
/*      */     {
/*  101 */       localException.printStackTrace();
/*      */     }
/*      */
/*  104 */     QTBuild.isValid();
/*      */
/*  109 */     if (isCurrentOS(2))
/*      */     {
/*  125 */       if (System.getSecurityManager() != null)
/*  126 */         if (getJavaVersion() == 65537) {
/*  127 */           if (WinJNINative.DoSecurityInit() != 0) {
/*  128 */             throw new SecurityException("quicktime.QTSession");
/*      */           }
/*      */
/*      */         }
/*      */         else
/*      */         {
/*  143 */           new Object()
/*      */           {
/*      */             void establish()
/*      */             {
/*  135 */               AccessController.doPrivileged(new PrivilegedAction() {
/*      */                 public Object run() {
/*  137 */                   System.setProperty("restrict.package.definition.quicktime", "true");
/*  138 */                   return null;
/*      */                 }
/*      */               });
/*      */             }
/*      */           }
/*  143 */           .establish();
/*      */         }
/*      */     }
/*      */   }
/*      */
/*      */   static class QTFrame extends Frame
/*      */   {
/*  463 */     int HWND = 0;
/*      */
/*  465 */     public void addNotify() { super.addNotify();
/*      */       Object localObject;
/*  467 */       if ((QTSession.isCurrentOS(2)) && (QTSession.getJavaVersion() >= 65540)) {
/*  468 */         localObject = new WinJNIDrawingSurface(this);
/*  469 */         ((WinJNIDrawingSurface)localObject).lock();
/*  470 */         this.HWND = ((WinJNIDrawingSurface)localObject).getHWnd();
/*  471 */         ((WinJNIDrawingSurface)localObject).unlock();
/*  472 */         QTSession.access$002(QTSession.CreatePortAssociation(this.HWND, 0, 258));
/*      */       }
/*  474 */       else if ((getPeer() instanceof DrawingSurface)) {
/*  475 */         localObject = ((DrawingSurface)getPeer()).getDrawingSurfaceInfo();
/*  476 */         ((DrawingSurfaceInfo)localObject).lock();
/*  477 */         this.HWND = ((Win32DrawingSurface)((DrawingSurfaceInfo)localObject).getSurface()).getHWnd();
/*  478 */         ((DrawingSurfaceInfo)localObject).unlock();
/*      */
/*  480 */         QTSession.access$002(QTSession.CreatePortAssociation(this.HWND, 0, 258));
/*      */       }
/*      */     }
/*      */   }
/*      */ }

/* Location:           Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name:     quicktime.QTSession
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.QTSession

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.