1 package kaka.cakelight;
5 public class FrameGrabber {
6 private Configuration config;
8 private int bytesPerFrame;
9 private InputStream fileStream;
11 private FrameGrabber() {
14 public static FrameGrabber from(Configuration config) {
15 FrameGrabber fg = new FrameGrabber();
17 fg.file = new File(config.video.device);
18 fg.bytesPerFrame = config.video.width * config.video.height * config.video.bpp;
22 public boolean prepare() {
24 fileStream = new FileInputStream(file);
26 } catch (FileNotFoundException e) {
32 public Frame grabFrame() {
34 byte[] data = new byte[bytesPerFrame];
35 int count = fileStream.read(data);
36 System.out.println("count = " + count);
37 return Frame.of(data, config);
38 } catch (IOException e) {
48 } catch (IOException e) {