Hi,
I am trying to write a simple application that grabs a frame from an
iSight and then saves it as a Pict. at a given time interval. The
application crashes after grabbing the first picture.
I found that changing the offscreenDepth flag to other than 0 but not
more than 8 works fine. but, of course, then the image quality is not
that good.
I have done lots of java programming but I am new to the quicktime
api... am I missing something here?
here is the code that sets up the SequenceGrabber:
========================================
QTSession.open();
if(!QTSession.isInitialized()) {
JOptionPane.showMessageDialog(this.parent, "Could not initialize
QTSession", "Error", JOptionPane.ERROR_MESSAGE);
QTSession.close();
}
else {
bounds = new QDRect(width, height);
QDGraphics graphics = new QDGraphics(bounds);
grabber = new SequenceGrabber();
grabber.setGWorld(graphics, null);
channel = new SGVideoChannel(grabber);
channel.setBounds(bounds);
channel.settingsDialog();
channel.setUsage(StdQTConstants.seqGrabPreview);
grabber.prepare(true, false);
}
here is the code that grabs the image:
=============================
//**************** application quits here: *********************
Pict p = Pict.fromSequenceGrabber(grabber, bounds, 0, 1);
p.writeToFile(new File(fileName));
p.close();