@@ -87,6 +87,13 @@ public progressUpdater(Process clipper) {
8787 splitList = new ArrayList <>();
8888 }
8989
90+ /**
91+ * Updates the window with the state of the video conversion.
92+ * @param now
93+ * The timestamp of the current frame given in nanoseconds. This
94+ * value will be the same for all {@code AnimationTimers} called
95+ * during one frame.
96+ */
9097 @ Override
9198 public void handle (long now ) {
9299 String line = null ;
@@ -128,6 +135,10 @@ public void handle(long now) {
128135 }
129136 }
130137
138+ /**
139+ * Checks for the availability of hardware acceleration and selects the best one.
140+ * If none are available, it will use CPU encoding.
141+ */
131142 @ SuppressWarnings ("unchecked" )
132143 private void checkHWACCEL () {
133144 ArrayList <VideoChecks .Encoders > encoders = VideoChecks .getEncoders ();
@@ -157,8 +168,13 @@ protected double calcFrameRate(String ffprobeOutput) {
157168 return (double ) Integer .parseInt (sections [0 ]) / (double ) Integer .parseInt (sections [1 ]);
158169 }
159170
171+ /**
172+ * Converts the video to a h264 mp4 file so that it can be displayed in the embedded player.
173+ * @throws IOException if the file cannot be found
174+ * @throws InterruptedException if the process is interrupted
175+ */
160176 public void convertIt () throws IOException , InterruptedException {
161- if (clipping ){
177+ if (clipping ) {
162178 FFmpegWrapper .killProcess (clipper );
163179 clipping =false ;
164180 updater .stop ();
@@ -170,7 +186,8 @@ public void convertIt() throws IOException, InterruptedException {
170186 String fileSaveName = nameBox .getText ();
171187
172188 ffmpegOutput .appendText ("Starting conversion...\n Calculating duration and framerate...\n " );
173- String probe_command = "ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate \" " + fileName + "\" " ;
189+ String probe_command = "ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1" +
190+ " -show_entries stream=r_frame_rate \" " + fileName + "\" " ;
174191 fps = (float ) calcFrameRate (StreamedCommand .getCommandOutput (probe_command ));
175192 ffmpegOutput .appendText ("Calculated framerate: " + fps + "\n " );
176193 probe_command = "ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 \" " + fileName + "\" " ;
@@ -189,6 +206,12 @@ public void convertIt() throws IOException, InterruptedException {
189206 }
190207
191208
209+ /**
210+ * Called when the conversion is finished. Checks if the file exists and if it does it will
211+ * mark it for deletion on exit and close the window.
212+ * @note The temp file *will* be deleted on exit, so if needed it should be copied to a new location.
213+ * @throws IOException if the file cannot be found
214+ */
192215 private void finish () throws IOException {
193216 clipping = false ;
194217 progressBar .setProgress (1 );
0 commit comments