Skip to content

Commit 390b4a4

Browse files
Totally up to date
Signed-off-by: JayFromProgramming <ajsweene@mtu.edu>
1 parent 66f2e1f commit 390b4a4

7 files changed

Lines changed: 67 additions & 10 deletions

File tree

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javaFX-resources/com/example/clippyfx/hello-view.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
</buttons>
4040
</ButtonBar>
4141
<Slider fx:id="clipStart" disable="true" focusTraversable="false" layoutX="234.0" layoutY="566.0" prefHeight="24.0" prefWidth="495.0" showTickMarks="true" />
42-
<Slider fx:id="clipEnd" disable="true" focusTraversable="false" layoutX="234.0" layoutY="609.0" prefHeight="24.0" prefWidth="495.0" showTickMarks="true" />
42+
<Slider fx:id="clipEnd" disable="true" focusTraversable="false" layoutX="234.0" layoutY="611.0" prefHeight="24.0" prefWidth="495.0" showTickMarks="true" />
4343
<Slider fx:id="scrubBar" disable="true" focusTraversable="false" layoutX="234.0" layoutY="589.0" onMouseClicked="#barScrubbed" onMousePressed="#scrubPressed" onMouseReleased="#scrubReleased" prefHeight="24.0" prefWidth="495.0" showTickMarks="true" />
4444
<Button fx:id="clipItButton" disable="true" focusTraversable="false" layoutX="858.0" layoutY="583.0" mnemonicParsing="false" onMouseClicked="#clipIt" text="Clip It!" />
4545
<Text fx:id="clipStartText" layoutX="729.0" layoutY="578.0" strokeType="OUTSIDE" strokeWidth="0.0" text="00:00:00.00" />
4646
<Text fx:id="scrubBarText" layoutX="729.0" layoutY="600.0" strokeType="OUTSIDE" strokeWidth="0.0" text="00:00:00.00" />
47-
<Text fx:id="clipEndText" layoutX="729.0" layoutY="621.0" strokeType="OUTSIDE" strokeWidth="0.0" text="00:00:00.00" />
47+
<Text fx:id="clipEndText" layoutX="729.0" layoutY="622.0" strokeType="OUTSIDE" strokeWidth="0.0" text="00:00:00.00" />
4848
<ButtonBar layoutX="44.0" layoutY="558.0" prefHeight="40.0" prefWidth="171.0">
4949
<buttons>
5050
<Button fx:id="playPauseButton" disable="true" focusTraversable="false" mnemonicParsing="false" onMouseClicked="#playPauseVideo" text="Pause" />
2.12 KB
Binary file not shown.

src/main/java/HelperMethods/VideoChecks.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public static void checkEncoders() {
129129
try {
130130
// System.out.println("Checking for h264_nvenc...");
131131
Process hwaccel = StreamedCommand.runCommand("ffmpeg -i resources/videoResources/enCheck.webm -c:v h264_nvenc -frames 1 -f null NUL");
132-
String result = StreamedCommand.returnErrorString(hwaccel, 1);
132+
String result = StreamedCommand.returnErrorString(hwaccel, 2);
133133
if (result.equals("")) {
134134
AVAILABLE_ENCODERS.add(Encoders.h264_nvenc);
135135
System.out.println("Found h264_nvenc");
@@ -138,7 +138,7 @@ public static void checkEncoders() {
138138
}
139139
// System.out.println("Checking for h264_amf...");
140140
hwaccel = StreamedCommand.runCommand("ffmpeg -i resources/videoResources/enCheck.webm -c:v h264_amf -frames 1 -f null NUL");
141-
result = StreamedCommand.returnErrorString(hwaccel, 1);
141+
result = StreamedCommand.returnErrorString(hwaccel, 2);
142142
if (result.equals("")) {
143143
AVAILABLE_ENCODERS.add(Encoders.h264_amf);
144144
System.out.println("Found h264_amf");
@@ -147,7 +147,7 @@ public static void checkEncoders() {
147147
}
148148
// System.out.println("Checking for h264_qsv...");
149149
hwaccel = StreamedCommand.runCommand("ffmpeg -i resources/videoResources/enCheck.webm -c:v h264_qsv -frames 1 -f null NUL");
150-
result = StreamedCommand.returnErrorString(hwaccel, 1);
150+
result = StreamedCommand.returnErrorString(hwaccel, 2);
151151
if (result.equals("")) {
152152
AVAILABLE_ENCODERS.add(Encoders.h264_qsv);
153153
System.out.println("Found h264_qsv");

src/main/java/com/example/clippyfx/HelloApplication.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public void start(Stage stage) throws IOException, InterruptedException {
3838
controller.Pain.getScene().getWindow().addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, controller::onClose);
3939
controller.Pain.setOnDragOver(controller::onDragOver);
4040
controller.Pain.setOnDragDropped(controller::onDragNDrop);
41+
controller.startAnimations();
4142
Thread.setDefaultUncaughtExceptionHandler(controller::onUncaughtException);
43+
Runtime runtime = Runtime.getRuntime();
44+
runtime.gc();
4245
}
4346

4447
public static void main(String[] args) throws IOException {

src/main/java/com/example/clippyfx/MainController.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,31 @@ public void onClose(WindowEvent event) {
8686
}
8787
}
8888

89+
public void startAnimations(){
90+
timer = new AnimationTimer() {
91+
@Override
92+
public void handle(long now) {
93+
94+
if (popOuts.removeIf(popOut -> !popOut.isAlive())) runtime.gc();
95+
96+
String title = "ClippyFX: Mem: (" + (Math.round(runtime.freeMemory() / 1.049e+6))
97+
+ "MB / " + Math.round((runtime.totalMemory() / 1.049e+6)) + " MB)";
98+
if (mediaPlayer != null) {
99+
title = title +" - " + mediaPlayer.getStatus().toString();
100+
} else {
101+
title = title + " - No Media";
102+
}
103+
104+
if (scrubbing) title += " | Scrubbing";
105+
for (PopOut popOut : popOuts) {
106+
title += " | " + popOut.getType() + " Open";
107+
}
108+
((Stage) Pain.getScene().getWindow()).setTitle(title);
109+
}
110+
};
111+
timer.start();
112+
}
113+
89114
protected void onDragOver(DragEvent event) {
90115
if (event.getDragboard().hasFiles()) {
91116
File file = event.getDragboard().getFiles().get(0);
@@ -172,9 +197,6 @@ public void handle(long now) {
172197
clipStartText.setText(timeFormatter(clipStart.getValue() / 100 * mediaPlayer.getTotalDuration().toSeconds()));
173198
scrubBarText.setText(timeFormatter(scrubBar.getValue() / 100 * mediaPlayer.getTotalDuration().toSeconds()));
174199
clipEndText.setText(timeFormatter(clipEnd.getValue() / 100 * mediaPlayer.getTotalDuration().toSeconds()));
175-
((Stage) Pain.getScene().getWindow()).setTitle("ClippyFX: Mem: ("
176-
+ (Math.round(runtime.freeMemory() / 1.049e+6)) + "MB / " +
177-
Math.round((runtime.totalMemory() / 1.049e+6)) + " MB) FPS: ??");
178200
}
179201
};
180202
timer.start();
@@ -213,6 +235,7 @@ public void ejectMedia(MouseEvent mouseEvent) {
213235
setEnabledUI(false);
214236
LoadPane.setVisible(true);
215237
VideoURI.clear();
238+
mediaPlayer = null;
216239
runtime.gc(); // Force garbage collection
217240
}
218241

src/main/java/com/example/clippyfx/SettingsView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ public void onSavePressed(MouseEvent mouseEvent) {
232232
}
233233
}
234234
SettingsWrapper.saveSettings();
235-
// options.clear();
236-
// build();
235+
options.clear();
236+
build();
237237
}
238238

239239
public void onResetPressed(MouseEvent mouseEvent) throws IOException {

0 commit comments

Comments
 (0)