/**
* Query for the particular version of JMF.
*/
public interface QueryJMF
{
public static final String NATIVE = "Native Libraries Found\n";
public static final String NONATIVE = "Native Libraries Not Found\n";
public abstract String getVersion();
public abstract String getDetails();
}
/**
* Check for version JMF 1.0.
*/
public class QueryJMF10 implements QueryJMF
{
public String getVersion()
{
return "1.0.2";
}
public String getDetails()
{
String string = "";
try
{
Class.forName("com.sun.media.blitter.xlib.Blitter");
string = new StringBuffer(String.valueOf(string)).append("Solaris Build\n").toString();
}
catch (Throwable throwable1)
{
}
try
{
Class.forName("com.sun.media.blitter.directx.Blitter");
string = new StringBuffer(String.valueOf(string)).append("Win32 Build\n").toString();
}
catch (Throwable throwable2)
{
}
try
{
//JMFSecurity.loadLibrary("jmindeo");
string = new StringBuffer(String.valueOf(string)).append("Native Libraries Found\n").toString();
}
catch (UnsatisfiedLinkError e)
{
string = new StringBuffer(String.valueOf(string)).append("Native Libraries Not Found\n").toString();
}
return string;
}
public QueryJMF10()
{
}
static
{
try
{
Class.forName("com.sun.media.renderer.video.VideoRenderer$CC");
}
catch (Throwable throwable)
{
throw new RuntimeException("Not JMF 1.0.2");
}
}
}
/**
* Check for version JMF 1.1.
*/
public class QueryJMF11 implements QueryJMF
{
public String getVersion()
{
return "1.1";
}
public String getDetails()
{
String string = "";
try
{
Class.forName("com.sun.media.blitter.xlib.Blitter");
string = new StringBuffer(String.valueOf(string)).append("Solaris Build\n").toString();
}
catch (Throwable throwable1)
{
}
try
{
Class.forName("com.sun.media.blitter.directx.Blitter");
string = new StringBuffer(String.valueOf(string)).append("Win32 Build\n").toString();
}
catch (Throwable throwable2)
{
}
try
{
//JMFSecurity.loadLibrary("jmindeo");
string = new StringBuffer(String.valueOf(string)).append("Native Libraries Found\n").toString();
}
catch (UnsatisfiedLinkError e)
{
string = new StringBuffer(String.valueOf(string)).append("Native Libraries Not Found\n").toString();
}
return string;
}
public QueryJMF11()
{
}
static
{
try
{
Class.forName("com.sun.media.codec.video.h263.H263Decoder");
}
catch (Throwable throwable)
{
throw new RuntimeException("Not JMF 1.1");
}
}
}
import com.sun.media.JMFSecurityManager;
import javax.media.Manager;
/**
* Check for version JMF 2.0.
*/
public class QueryJMF20 implements QueryJMF
{
public String getVersion()
{
return Manager.getVersion();
}
public String getDetails()
{
String string = "";
try
{
Class.forName("com.sun.media.renderer.video.XILRenderer");
string = new StringBuffer(String.valueOf(string)).append("Solaris Build\n").toString();
}
catch (Throwable throwable2)
{
try
{
Class.forName("com.sun.media.protocol.vfw.DataSource");
string = new StringBuffer(String.valueOf(string)).append("Win32 Build\n").toString();
}
catch (Throwable throwable1)
{
string = new StringBuffer(String.valueOf(string)).append("All Java Build\n").toString();
}
}
try
{
JMFSecurityManager.loadLibrary("jmutil");
string = new StringBuffer(String.valueOf(string)).append("Native Libraries Found\n").toString();
}
catch (UnsatisfiedLinkError e)
{
string = new StringBuffer(String.valueOf(string)).append("Native Libraries Not Found\n").toString();
}
return string;
}
public QueryJMF20()
{
}
static
{
try
{
Class.forName("javax.media.Codec");
}
catch (Throwable throwable)
{
throw new RuntimeException("Not JMF 2.0");
}
}
}
本文转自Phinecos(洞庭散人)博客园博客,原文链接:http://www.cnblogs.com/phinecos/archive/2007/09/22/902846.html,如需转载请自行联系原作者