Mercurial > jmeCapture
view src/com/aurellem/capture/video/FileVideoRecorder.java @ 62:f5e52169f056
updated to work with new jme changes
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 14 Dec 2011 17:43:52 -0700 |
parents | 784a3f4e6202 |
children |
line wrap: on
line source
1 package com.aurellem.capture.video;3 import java.awt.image.BufferedImage;4 import java.io.File;5 import java.io.IOException;6 import javax.imageio.ImageIO;8 public class FileVideoRecorder extends AbstractVideoRecorder{9 int current;10 File outDir;11 String formatName = "png";13 public FileVideoRecorder(File output) throws IOException {14 super(output);15 if (output.exists()16 && output.isDirectory()17 && (0 == output.listFiles().length)){18 // good19 }20 else if (!output.exists()){21 output.mkdir();22 }23 else {24 throw new IOException("argument must be either an empty " +25 "directory or a nonexistent one.");26 }27 this.outDir = output;28 }30 public void record(BufferedImage rawFrame) {31 String name = String.format("%07d.%s" , current++, formatName);32 File target = new File(output, name);33 try {ImageIO.write(rawFrame, formatName, target);}34 catch (IOException e) {e.printStackTrace();}35 }37 public void finish() {}38 }