FileDocCategorySizeDatePackage
VFWManual.javaAPI DocJMF 2.1.1e6058Mon May 12 12:20:34 BST 2003None

VFWManual

public class VFWManual extends Frame

Fields Summary
CaptureDeviceInfo[]
devices
int
currentID
Constructors Summary
public VFWManual()

    
      
	super("Register VFW Caputure Devices");

	setLayout(new FlowLayout());
	int nDevices = 0;

	removeCurrentDevices();
	for (int i = 0; i < 10; i++) {
	    String name = VFWCapture.capGetDriverDescriptionName(i);
	    if (name != null && name.length() > 1) {
		Button device = new Button(name);
		add(device);
		device.addActionListener( new DBListener(i) );
		nDevices++;
	    }
	}
 
	devices = new CaptureDeviceInfo[nDevices];
	
	pack();
	addWindowListener( new WindowAdapter() {
	    public void windowClosing(WindowEvent we) {
		if (currentID != -1) {
		    System.err.println("Need to close other window first");
		    return;
		}
		dispose();
		System.exit(0);
	    }
	} );
    
Methods Summary
public voidcreateDialog(int id)

	if (currentID == id)
	    return;
	currentID = id;
	Thread t = new Thread( new Runnable() {
	    public void run() {
		FormatsDialog fd = new FormatsDialog(currentID);
		fd.setVisible(true);
		CaptureDeviceInfo cdi = fd.getDeviceInfo();
		if (cdi != null) {
		    System.err.println("CaptureDeviceInfo = " + cdi.getName() + " " +
				       cdi.getLocator());
		}
		
		currentID = -1;
	    }
	} );
	t.start();
	// Create a CaptureDeviceInfo....
    
public static voidmain(java.lang.String[] args)

	VFWManual m = new VFWManual();
	m.setVisible(true);
    
private voidremoveCurrentDevices()

        Vector deviceList = (Vector) CaptureDeviceManager.getDeviceList(null).clone();
	Enumeration enum = deviceList.elements();
	while (enum.hasMoreElements()) {
	    CaptureDeviceInfo cdi = (CaptureDeviceInfo) enum.nextElement();
	    String name = cdi.getName();
	    if (name.startsWith("vfw:"))
		CaptureDeviceManager.removeDevice(cdi);
	}