Mercurial > jmeCapture
comparison src/com/aurellem/capture/Capture.java @ 10:4c5fc53778c1
moved randelshofer stuff to rightfull place, enabled XuggleVideoRecorder
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 26 Oct 2011 09:38:27 -0700 |
parents | 5dfc9e768816 |
children | 8a6b1684f536 |
comparison
equal
deleted
inserted
replaced
9:5dfc9e768816 | 10:4c5fc53778c1 |
---|---|
2 | 2 |
3 import java.io.File; | 3 import java.io.File; |
4 import java.io.IOException; | 4 import java.io.IOException; |
5 | 5 |
6 import com.aurellem.capture.video.AVIVideoRecorder; | 6 import com.aurellem.capture.video.AVIVideoRecorder; |
7 import com.aurellem.capture.video.AbstractVideoRecorder; | |
8 import com.aurellem.capture.video.XuggleVideoRecorder; | |
7 import com.jme3.app.Application; | 9 import com.jme3.app.Application; |
8 import com.jme3.math.ColorRGBA; | 10 import com.jme3.math.ColorRGBA; |
9 | 11 |
10 public class Capture { | 12 public class Capture { |
11 | 13 |
12 public static void SimpleCaptureVideo(Application app, File file) throws IOException{ | 14 public static void SimpleCaptureVideo(Application app, File file) throws IOException{ |
13 app.getViewPort().setClearFlags(true, true, true); | 15 app.getViewPort().setClearFlags(true, true, true); |
14 app.getViewPort().setBackgroundColor(ColorRGBA.Black); | 16 app.getViewPort().setBackgroundColor(ColorRGBA.Black); |
15 AVIVideoRecorder videoRecorder = new AVIVideoRecorder(file); | 17 |
18 // The XuggleVideoRecorder is better than the AVIVideoRecorder in every way | |
19 // except for ease of installation. The excellent work by Werner Randelshofer | |
20 // is used as a fallback option. Please visit http://www.xuggle.com/ to learn | |
21 // how to set up the XuggleVideoRecorder. | |
22 | |
23 AbstractVideoRecorder videoRecorder; | |
24 | |
25 if (file.getCanonicalPath().endsWith(".avi")){ | |
26 videoRecorder = new AVIVideoRecorder(file);} | |
27 else { videoRecorder = new XuggleVideoRecorder(file); } | |
28 | |
16 app.getStateManager().attach(videoRecorder); | 29 app.getStateManager().attach(videoRecorder); |
17 app.getViewPort().addFinalProcessor(videoRecorder); | 30 app.getViewPort().addFinalProcessor(videoRecorder); |
18 } | 31 } |
19 | 32 |
20 | 33 |