i am having my java project on eye blinking software in which eye blinks are traced in order to work as a mouse. so i need to make use of JMF to connect my webcam to the program. So could anyone please help me to configure this JMF thing...thanks in advance...
the code for device finder is along given....

import javax.media.*;
import javax.media.protocol.*;
import javax.media.control.FormatControl;
import javax.media.format.VideoFormat;
import java.awt.*;
import java.util.Vector;
import javax.swing.JOptionPane;

/*
This class opens a video capture device and reads frames in the given format.

*/

public class DevicesFinder implements BufferTransferHandler
{
public DevicesFinder(){}

public PushBufferDataSource findDevices(Frame frame)
{
PushBufferDataSource pbds = null;
// Preferred capture format parameters
String prefEncoding = "RGB";
float prefFPS = 30.0f;
Dimension prefSize = new Dimension(320, 240);

VideoFormat prefFormat = new VideoFormat(prefEncoding,prefSize,Format.NOT_SPECI FIED,null,prefFPS);
Vector devices = CaptureDeviceManager.getDeviceList(prefFormat);

if (devices.size() < 1)
{
JOptionPane.showMessageDialog(frame,
"No capture devices found, or devices does not support given format\n" +
prefFormat.toString(), null,
JOptionPane.ERROR_MESSAGE);
System.exit(-1);
}

CaptureDeviceInfo cdi = (CaptureDeviceInfo)devices.elementAt(0);
frame.cdi = cdi;

try
{
DataSource ds = Manager.createDataSource(cdi.getLocator());
if (ds instanceof CaptureDevice)
{
FormatControl[] fcs = ( (CaptureDevice) ds).getFormatControls();

for (int i = 0; i < cdi.getFormats().length; i++)
{
VideoFormat vf = (VideoFormat) cdi.getFormats()[i];
if (vf.matches(prefFormat))
{
prefFormat = (VideoFormat) vf.intersects(prefFormat);
fcs[0].setFormat(prefFormat);
break;
}
}
}
ds.connect();
pbds = (PushBufferDataSource) ds;
pbds.getStreams()[0].setTransferHandler(this);
pbds.start();
return pbds;
}
catch (Exception e)
{
JOptionPane.showMessageDialog(frame,"Could not connect to capture device, please check your webcam",null,JOptionPane.ERROR_MESSAGE);
System.exit(-1);
return null;
}
}

public void transferData(PushBufferStream pbs) {
}


}