annotate src/com/aurellem/capture/video/XuggleVideoRecorder.java @ 73:877ae4b2993c tip

merge laptop changes.
author Robert McIntyre <rlm@mit.edu>
date Mon, 10 Mar 2014 18:58:08 -0400
parents 2c50a0c99715
children
rev   line source
rlm@71 1 // package com.aurellem.capture.video;
rlm@9 2
rlm@71 3 // // import java.awt.image.BufferedImage;
rlm@71 4 // // import java.io.File;
rlm@71 5 // // import java.io.IOException;
rlm@71 6 // // import java.util.concurrent.TimeUnit;
rlm@10 7
rlm@71 8 // // import com.xuggle.mediatool.IMediaWriter;
rlm@71 9 // // import com.xuggle.mediatool.ToolFactory;
rlm@71 10 // // import com.xuggle.xuggler.IRational;
rlm@10 11
rlm@9 12
rlm@71 13 // /**
rlm@71 14 // * Handles writing video files using Xuggle.
rlm@71 15 // *
rlm@71 16 // * @author Robert McIntyre
rlm@71 17 // *
rlm@71 18 // */
rlm@10 19
rlm@71 20 // public class XuggleVideoRecorder extends AbstractVideoRecorder{
rlm@9 21
rlm@68 22
rlm@71 23 // // IMediaWriter writer;
rlm@71 24 // // BufferedImage frame;
rlm@71 25 // // int videoChannel = 0;
rlm@71 26 // // long currentTimeStamp = 0;
rlm@71 27 // // boolean videoReady = false;
rlm@68 28
rlm@9 29
rlm@71 30 // public XuggleVideoRecorder(File output)
rlm@71 31 // throws IOException {super(output);}
rlm@9 32
rlm@71 33 // // public void initVideo(){
rlm@71 34 // // this.frame = new BufferedImage(
rlm@71 35 // // width, height,
rlm@71 36 // // BufferedImage.TYPE_3BYTE_BGR);
rlm@71 37 // // this.writer = ToolFactory.makeWriter(this.targetFileName);
rlm@71 38 // // writer.addVideoStream(videoChannel,
rlm@71 39 // // 0, IRational.make(fps),
rlm@71 40 // // width, height);
rlm@71 41 // // this.videoReady = true;
rlm@71 42 // // }
rlm@9 43
rlm@71 44 // // public void record(BufferedImage rawFrame) {
rlm@71 45 // // if (!this.videoReady){initVideo();}
rlm@71 46 // // // convert the Image into the form that Xuggle likes.
rlm@71 47 // // this.frame.getGraphics().drawImage(rawFrame, 0, 0, null);
rlm@71 48 // // writer.encodeVideo(videoChannel,
rlm@71 49 // // frame,
rlm@71 50 // // currentTimeStamp, TimeUnit.NANOSECONDS);
rlm@9 51
rlm@71 52 // // currentTimeStamp += (long) (1000000000.0 / fps);
rlm@71 53 // // }
rlm@9 54
rlm@71 55 // // public void finish() {
rlm@71 56 // // writer.close();
rlm@71 57 // // }
rlm@68 58
rlm@9 59
rlm@71 60 // }
rlm@9 61
rlm@10 62