fix for icon change. e1003c20ff

Signed-off-by: rattatwinko <seppmutterman@gmail.com>
This commit is contained in:
2026-02-02 12:31:02 +01:00
parent e1003c20ff
commit 701d95ab2d
3 changed files with 18 additions and 10 deletions

View File

@@ -25,7 +25,6 @@ public class SwingIFrame {
private boolean blackbg = false; private boolean blackbg = false;
private final Color bgcolor = Color.decode("#336B6A"); private final Color bgcolor = Color.decode("#336B6A");
private final Color defDesktopBg = Color.WHITE; private final Color defDesktopBg = Color.WHITE;
private final JPopupMenu popupMenu = new JPopupMenu(); private final JPopupMenu popupMenu = new JPopupMenu();
@@ -55,7 +54,8 @@ public class SwingIFrame {
desktopIconManager.addIcon( desktopIconManager.addIcon(
"Export Evidence", "Export Evidence",
IconSetter.getSaveIconAsImageIcon(), IconSetter.getSaveIconAsImageIcon(),
EvidenceExportFrame::showExport /* e1003c20ff00c637d963ce21fd685fed6460602a: Fix to icon, need to pass parent! Or Override method which is dumb */
() -> EvidenceExportFrame.showExport(mainFrame)
); );
} }

View File

@@ -1,5 +1,6 @@
package io.swtc.proccessing.ui.desktop.evidence; package io.swtc.proccessing.ui.desktop.evidence;
import io.swtc.proccessing.ui.IconSetter;
import io.swtc.proccessing.ui.ShowError; import io.swtc.proccessing.ui.ShowError;
import io.swtc.recording.evidence.USBExportManager; import io.swtc.recording.evidence.USBExportManager;
@@ -15,17 +16,25 @@ public class EvidenceExportFrame extends JFrame {
private final JLabel statusLabel; private final JLabel statusLabel;
private final JLabel detailLabel; private final JLabel detailLabel;
private final JButton actionBtn; private final JButton actionBtn;
private final JFrame parent; /* neccessary to get icon working, inheritance is a bitch */
private EvidenceExportFrame(Path sourceDir, Path usbTargetDir, JFrame parent) {
this.parent = parent;
private EvidenceExportFrame(Path sourceDir, Path usbTargetDir) {
setTitle("Export"); setTitle("Export");
setSize(400, 220); setSize(400, 220);
setLocationRelativeTo(null); setLocationRelativeTo(this.parent);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
JPanel contentPane = new JPanel(); JPanel contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
contentPane.setBorder(new EmptyBorder(25, 25, 25, 25)); contentPane.setBorder(new EmptyBorder(25, 25, 25, 25));
ImageIcon ico = IconSetter.getSaveIconAsImageIcon();
this.setIconImage(ico.getImage());
statusLabel = new JLabel("Starting export"); statusLabel = new JLabel("Starting export");
statusLabel.setAlignmentX(Component.LEFT_ALIGNMENT); statusLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
statusLabel.setFont(new Font(statusLabel.getFont().getName(), Font.BOLD, 14)); statusLabel.setFont(new Font(statusLabel.getFont().getName(), Font.BOLD, 14));
@@ -61,7 +70,7 @@ public class EvidenceExportFrame extends JFrame {
return; return;
} }
int confirm = JOptionPane.showConfirmDialog(this, int confirm = JOptionPane.showConfirmDialog(this.parent,
"Stop export?", "Confirm", JOptionPane.YES_NO_OPTION); "Stop export?", "Confirm", JOptionPane.YES_NO_OPTION);
if (confirm == JOptionPane.YES_OPTION) dispose(); if (confirm == JOptionPane.YES_OPTION) dispose();
} }
@@ -91,7 +100,7 @@ public class EvidenceExportFrame extends JFrame {
); );
} }
public static void showExport() { public static void showExport(JFrame parent) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
File videoDir = new File(System.getProperty("user.home"), "Videos/swtcctv-rec"); File videoDir = new File(System.getProperty("user.home"), "Videos/swtcctv-rec");
if (!videoDir.exists()) { if (!videoDir.exists()) {
@@ -101,9 +110,9 @@ public class EvidenceExportFrame extends JFrame {
JFileChooser chooser = new JFileChooser(); JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { if (chooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
Path target = chooser.getSelectedFile().toPath().resolve("swtcctv-rec_" + System.currentTimeMillis() / 1000); Path target = chooser.getSelectedFile().toPath().resolve("swtcctv-rec_" + System.currentTimeMillis() / 1000);
new EvidenceExportFrame(videoDir.toPath(), target); new EvidenceExportFrame(videoDir.toPath(), target, parent);
} }
}); });
} }

View File

@@ -18,7 +18,6 @@ public class MediaSink {
recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264); recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
recorder.setFormat("mp4"); recorder.setFormat("mp4");
recorder.setPixelFormat(avutil.AV_PIX_FMT_BGR24);
recorder.setFrameRate(config.fps()); recorder.setFrameRate(config.fps());
/* this is essentially just building FFmpeg? Would've used ProccessBuilder for this lol */ /* this is essentially just building FFmpeg? Would've used ProccessBuilder for this lol */
recorder.setVideoOption("pixel_format", "yuv420p"); recorder.setVideoOption("pixel_format", "yuv420p");
@@ -26,7 +25,7 @@ public class MediaSink {
recorder.setVideoOption("crf", String.valueOf(config.crf())); recorder.setVideoOption("crf", String.valueOf(config.crf()));
recorder.setVideoOption("tune", "zerolatency"); recorder.setVideoOption("tune", "zerolatency");
recorder.setVideoOption("x264opts", "keyint=40:min-keyint=20"); recorder.setVideoOption("x264opts", "keyint=40:min-keyint=20");
recorder.setVideoBitrate(0); // 0 tells the recorder to respect CRF strictly recorder.setVideoBitrate(0); // javacv respects bitrate already ; this is for my own safety
recorder.setGopSize(config.fps() * 2); recorder.setGopSize(config.fps() * 2);
recorder.start(); recorder.start();