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