comparison src/com/aurellem/capture/Capture.java @ 11:8a6b1684f536

refactored.
author Robert McIntyre <rlm@mit.edu>
date Thu, 27 Oct 2011 02:27:02 -0700
parents 4c5fc53778c1
children d10f4d4ff15a
comparison
equal deleted inserted replaced
10:4c5fc53778c1 11:8a6b1684f536
11 11
12 public class Capture { 12 public class Capture {
13 13
14 public static void SimpleCaptureVideo(Application app, File file) throws IOException{ 14 public static void SimpleCaptureVideo(Application app, File file) throws IOException{
15 app.getViewPort().setClearFlags(true, true, true); 15 app.getViewPort().setClearFlags(true, true, true);
16 // this prevents pixels from staying in the render buffer between frames
17 // and messing the video up. It's not a problem since Black is the default, and this
18 // can be overridden by user code.
16 app.getViewPort().setBackgroundColor(ColorRGBA.Black); 19 app.getViewPort().setBackgroundColor(ColorRGBA.Black);
17 20
18 // The XuggleVideoRecorder is better than the AVIVideoRecorder in every way 21 // The XuggleVideoRecorder is better than the AVIVideoRecorder in every way
19 // except for ease of installation. The excellent work by Werner Randelshofer 22 // 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 23 // is used as a fallback option. Please visit http://www.xuggle.com/ to learn
22 25
23 AbstractVideoRecorder videoRecorder; 26 AbstractVideoRecorder videoRecorder;
24 27
25 if (file.getCanonicalPath().endsWith(".avi")){ 28 if (file.getCanonicalPath().endsWith(".avi")){
26 videoRecorder = new AVIVideoRecorder(file);} 29 videoRecorder = new AVIVideoRecorder(file);}
27 else { videoRecorder = new XuggleVideoRecorder(file); } 30 else { videoRecorder = new XuggleVideoRecorder(file);}
28 31
29 app.getStateManager().attach(videoRecorder); 32 app.getStateManager().attach(videoRecorder);
30 app.getViewPort().addFinalProcessor(videoRecorder); 33 app.getViewPort().addFinalProcessor(videoRecorder);
31 } 34 }
32
33
34
35
36
37 } 35 }