001: /*
002: * @(#)JMFSupportedVersion.java 1.0, 1 May 2000
003: *
004: * Copyright (c) 2000 Silvere Martin-Michiellot All Rights Reserved.
005: *
006: * Silvere Martin-Michiellot grants you ("Licensee") a non-exclusive,
007: * royalty free, license to use, modify and redistribute this
008: * software in source and binary code form,
009: * provided that i) this copyright notice and license appear on all copies of
010: * the software; and ii) Licensee does not utilize the software in a manner
011: * which is disparaging to Silvere Martin-Michiellot.
012: *
013: * This software is provided "AS IS," without a warranty of any kind. ALL
014: * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
015: * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
016: * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. Silvere Martin-Michiellot
017: * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
018: * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
019: * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
020: * Silvere Martin-Michiellot OR ITS LICENSORS BE LIABLE
021: * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
022: * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
023: * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
024: * OR INABILITY TO USE SOFTWARE, EVEN IF Silvere Martin-Michiellot HAS BEEN
025: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
026: *
027: * This software is not designed or intended for use in on-line control of
028: * aircraft, air traffic, aircraft navigation or aircraft communications; or in
029: * the design, construction, operation or maintenance of any nuclear
030: * facility. Licensee represents and warrants that it will not use or
031: * redistribute the Software for such purposes.
032: *
033: * @Author: Silvere Martin-Michiellot
034: *
035: */
036:
037: package com.db.media.diagnostics;
038:
039: // This code is repackaged after the code from the JMF samples
040: // Site http://java.sun.com/
041: // Email
042:
043: /**
044: * JMF class to get the supported version of the JMF framework
045: */
046: public class JMFSupportedVersion {
047:
048: public JMFSupportedVersion() {
049:
050: super ();
051:
052: }
053:
054: public final static float getVersion() {
055:
056: float version;
057: Class aClass;
058:
059: // Check for JDK.
060: try {
061: Class.forName("java.awt.event.ComponentAdapter");
062:
063: // Check for basic JMF classes.
064: try {
065: Class.forName("javax.media.Player");
066: aClass = null;
067:
068: // Identify the versions.
069: try {
070: Class.forName("com.sun.media.util.LoopThread");
071: // Identify the 2.0 minor versions.
072: try {
073: aClass = Class.forName("QueryJMF20");
074: version = 2.0f;
075: } catch (Throwable throwable4) {
076: // Check for v1.1
077: try {
078: aClass = Class.forName("QueryJMF11");
079: version = 1.1f;
080: } catch (Throwable throwable5) {
081: // Check for v1.0
082: try {
083: aClass = Class.forName("QueryJMF10");
084: version = 1.02f;
085: } catch (Throwable throwable6) {
086: //version too old
087: version = 0.0f;
088: }
089: }
090: }
091: } catch (Throwable throwable3) {
092: //version undentified
093: version = 0.0f;
094: }
095: } catch (Throwable throwable2) {
096: // Check for basic JMF classes.
097: version = -1.0f;
098: }
099: } catch (Throwable throwable1) {
100: // Check for JDK.
101: version = -2.0f;
102: }
103:
104: return version;
105:
106: }
107:
108: }
|