Methods Summary |
---|
public static boolean | addDevice(javax.media.CaptureDeviceInfo newDevice)Adds a CaptureDeviceInfo object for a new capture device
to the list of devices maintained by the
CaptureDeviceManager . This information is not
stored permanently in any registry unless commit is called.
if (cdm != null && mAddDevice != null) {
Object params[] = new Object[1];
params[0] = newDevice;
Object result = runMethod(mAddDevice, params);
if (result != null)
return ((Boolean)result).booleanValue();
else
return false;
} else
return false;
|
public static void | commit()Permanently stores information about the list of devices in the registry.
Commit must be called to save changes made to the device list by calling
addDevice or removeDevice .
if (cdm != null && mCommit != null) {
runMethod(mCommit, null);
}
|
public static javax.media.CaptureDeviceInfo | getDevice(java.lang.String deviceName)Gets a CaptureDeviceInfo object that corresponds to the specified device.
if (cdm != null && mGetDevice != null) {
Object params[] = new Object[1];
params[0] = deviceName;
return (CaptureDeviceInfo) runMethod(mGetDevice, params);
} else
return null;
|
public static java.util.Vector | getDeviceList(javax.media.Format format)Gets a list of CaptureDeviceInfo objects that correspond to devices
that can capture data in the specified Format .
If no Format is specified, this method returns a list of
CaptureDeviceInfo objects for all of the available capture devices.
if (cdm != null && mGetDeviceList != null) {
Object params[] = new Object[1];
params[0] = format;
Vector returnVal = (Vector) runMethod(mGetDeviceList, params);
if (returnVal == null)
return new Vector(1);
else
return returnVal;
} else
return new Vector(1);
|
public static boolean | removeDevice(javax.media.CaptureDeviceInfo device)Removes a CaptureDeviceInfo object from the list of devices maintained by the
CaptureDeviceManager . The change is not
stored permanently in any registry unless commit is called.
if (cdm != null && mRemoveDevice != null) {
Object params[] = new Object[1];
params[0] = device;
Object result = runMethod(mRemoveDevice, params);
if (result != null)
return ((Boolean)result).booleanValue();
else
return false;
} else
return false;
|
private static java.lang.Object | runMethod(java.lang.reflect.Method m, java.lang.Object[] params)
// Look for javax.media.cdm.CaptureDeviceManager
try {
Class classCDM = Class.forName("javax.media.cdm.CaptureDeviceManager");
if (classCDM != null) {
Object tryCDM = classCDM.newInstance();
if (tryCDM instanceof CaptureDeviceManager) {
cdm = (CaptureDeviceManager) tryCDM;
mGetDeviceList =
PackageManager.getDeclaredMethod(classCDM,
"getDeviceList",
new Class[] {Format.class});
mGetDevice =
PackageManager.getDeclaredMethod(classCDM,
"getDevice",
new Class[] {String.class});
mCommit =
PackageManager.getDeclaredMethod(classCDM,
"commit", null);
mAddDevice =
PackageManager.getDeclaredMethod(classCDM,
"addDevice",
new Class[] {CaptureDeviceInfo.class});
mRemoveDevice =
PackageManager.getDeclaredMethod(classCDM,
"removeDevice",
new Class[] {CaptureDeviceInfo.class});
}
}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe);
} catch (InstantiationException ie) {
System.err.println(ie);
} catch (IllegalAccessException iae) {
System.err.println(iae);
} catch (SecurityException se) {
System.err.println(se);
} catch (NoSuchMethodException e) {
System.err.println(e);
}
try {
return m.invoke(null, params);
} catch (IllegalAccessException iae) {
System.err.println(iae);
} catch (IllegalArgumentException iare) {
System.err.println(iare);
} catch (InvocationTargetException ite) {
System.err.println(ite);
}
return null;
|