annotate src/com/aurellem/capture/video/FileVideoRecorder.java @ 71:2c50a0c99715

remove xuggle, since I will never use it.
author Robert McIntyre <rlm@mit.edu>
date Mon, 10 Mar 2014 18:54:35 -0400
parents 784a3f4e6202
children
rev   line source
rlm@39 1 package com.aurellem.capture.video;
rlm@39 2
rlm@39 3 import java.awt.image.BufferedImage;
rlm@39 4 import java.io.File;
rlm@39 5 import java.io.IOException;
rlm@39 6 import javax.imageio.ImageIO;
rlm@39 7
rlm@39 8 public class FileVideoRecorder extends AbstractVideoRecorder{
rlm@39 9 int current;
rlm@39 10 File outDir;
rlm@39 11 String formatName = "png";
rlm@39 12
rlm@39 13 public FileVideoRecorder(File output) throws IOException {
rlm@39 14 super(output);
rlm@39 15 if (output.exists()
rlm@39 16 && output.isDirectory()
rlm@39 17 && (0 == output.listFiles().length)){
rlm@39 18 // good
rlm@39 19 }
rlm@39 20 else if (!output.exists()){
rlm@39 21 output.mkdir();
rlm@39 22 }
rlm@39 23 else {
rlm@39 24 throw new IOException("argument must be either an empty " +
rlm@39 25 "directory or a nonexistent one.");
rlm@39 26 }
rlm@39 27 this.outDir = output;
rlm@39 28 }
rlm@39 29
rlm@39 30 public void record(BufferedImage rawFrame) {
rlm@39 31 String name = String.format("%07d.%s" , current++, formatName);
rlm@39 32 File target = new File(output, name);
rlm@39 33 try {ImageIO.write(rawFrame, formatName, target);}
rlm@39 34 catch (IOException e) {e.printStackTrace();}
rlm@39 35 }
rlm@39 36
rlm@39 37 public void finish() {}
rlm@39 38 }
rlm@39 39
rlm@39 40
rlm@39 41