rlm@71: // package com.aurellem.capture.video; rlm@9: rlm@71: // // import java.awt.image.BufferedImage; rlm@71: // // import java.io.File; rlm@71: // // import java.io.IOException; rlm@71: // // import java.util.concurrent.TimeUnit; rlm@10: rlm@71: // // import com.xuggle.mediatool.IMediaWriter; rlm@71: // // import com.xuggle.mediatool.ToolFactory; rlm@71: // // import com.xuggle.xuggler.IRational; rlm@10: rlm@9: rlm@71: // /** rlm@71: // * Handles writing video files using Xuggle. rlm@71: // * rlm@71: // * @author Robert McIntyre rlm@71: // * rlm@71: // */ rlm@10: rlm@71: // public class XuggleVideoRecorder extends AbstractVideoRecorder{ rlm@9: rlm@68: rlm@71: // // IMediaWriter writer; rlm@71: // // BufferedImage frame; rlm@71: // // int videoChannel = 0; rlm@71: // // long currentTimeStamp = 0; rlm@71: // // boolean videoReady = false; rlm@68: rlm@9: rlm@71: // public XuggleVideoRecorder(File output) rlm@71: // throws IOException {super(output);} rlm@9: rlm@71: // // public void initVideo(){ rlm@71: // // this.frame = new BufferedImage( rlm@71: // // width, height, rlm@71: // // BufferedImage.TYPE_3BYTE_BGR); rlm@71: // // this.writer = ToolFactory.makeWriter(this.targetFileName); rlm@71: // // writer.addVideoStream(videoChannel, rlm@71: // // 0, IRational.make(fps), rlm@71: // // width, height); rlm@71: // // this.videoReady = true; rlm@71: // // } rlm@9: rlm@71: // // public void record(BufferedImage rawFrame) { rlm@71: // // if (!this.videoReady){initVideo();} rlm@71: // // // convert the Image into the form that Xuggle likes. rlm@71: // // this.frame.getGraphics().drawImage(rawFrame, 0, 0, null); rlm@71: // // writer.encodeVideo(videoChannel, rlm@71: // // frame, rlm@71: // // currentTimeStamp, TimeUnit.NANOSECONDS); rlm@9: rlm@71: // // currentTimeStamp += (long) (1000000000.0 / fps); rlm@71: // // } rlm@9: rlm@71: // // public void finish() { rlm@71: // // writer.close(); rlm@71: // // } rlm@68: rlm@9: rlm@71: // } rlm@9: rlm@10: