view src/com/aurellem/capture/video/FileVideoRecorder.java @ 43:2f129118e2d6

removed old files and moved natives unpacking to the AudioRenderer
author Robert McIntyre <rlm@mit.edu>
date Wed, 30 Nov 2011 06:32:36 -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 // good
19 }
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 }