📄 capturedevicemanager.java
字号:
package javax.media.cdm;import java.util.Vector;import javax.media.CaptureDeviceInfo;import javax.media.Format;import net.sf.fmj.utility.Registry;/** * * Coding complete. * TODO: commit. * @author Ken Larson * */public class CaptureDeviceManager extends javax.media.CaptureDeviceManager{ public CaptureDeviceManager() { super(); } public static synchronized CaptureDeviceInfo getDevice(String deviceName) { final Vector v = getDeviceList(); for (int i = 0; i < v.size(); ++i) { final CaptureDeviceInfo captureDeviceInfo = (CaptureDeviceInfo) v.get(i); if (captureDeviceInfo.getName().equals(deviceName)) return captureDeviceInfo; } return null; } public static synchronized Vector getDeviceList() // not in javax.media.CaptureDeviceManager { return Registry.getInstance().getDeviceList(); } public static synchronized Vector getDeviceList(Format format) { final Vector v = getDeviceList(); final Vector result = new Vector(); for (int i = 0; i < v.size(); ++i) { final CaptureDeviceInfo captureDeviceInfo = (CaptureDeviceInfo) v.get(i); if (format == null) { result.add(captureDeviceInfo); } else { final Format[] formats = captureDeviceInfo.getFormats(); for (int j = 0; j < formats.length; ++j) { if (format.matches(formats[j])) { result.add(captureDeviceInfo); break; } } } } return result; } public static synchronized boolean addDevice(CaptureDeviceInfo newDevice) { return Registry.getInstance().addDevice(newDevice); } public static synchronized boolean removeDevice(CaptureDeviceInfo device) { return Registry.getInstance().removeDevice(device); } public static synchronized void commit() throws java.io.IOException { Registry.getInstance().commit(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -