From 0088b65d20b595c5ed08737b72c13dc216587d9b Mon Sep 17 00:00:00 2001 From: leprinco Date: Mon, 18 Nov 2024 19:35:40 +0100 Subject: [PATCH] When recording playfield for PBX/PBY, record them inverted --- .../frontend/FrontendPlayerDisplay.java | 15 +++++++++++++++ .../frontend/pinballx/PinballXConnector.java | 1 + .../frontend/pinbally/PinballYConnector.java | 3 +++ .../vpin/server/recorder/ScreenRecorder.java | 5 +++++ 4 files changed, 24 insertions(+) diff --git a/vpin-studio-rest-client/src/main/java/de/mephisto/vpin/restclient/frontend/FrontendPlayerDisplay.java b/vpin-studio-rest-client/src/main/java/de/mephisto/vpin/restclient/frontend/FrontendPlayerDisplay.java index 4675603e0..82cc19e86 100644 --- a/vpin-studio-rest-client/src/main/java/de/mephisto/vpin/restclient/frontend/FrontendPlayerDisplay.java +++ b/vpin-studio-rest-client/src/main/java/de/mephisto/vpin/restclient/frontend/FrontendPlayerDisplay.java @@ -11,6 +11,11 @@ public class FrontendPlayerDisplay { private int width; private int height; private int rotation; + /** + * For pinballX, playfield videos are inverted + * TODO check how much this is redundant with rotation=270 + */ + private boolean inverted; public int getMonitor() { return monitor; @@ -76,6 +81,15 @@ public void setRotation(int rotation) { this.rotation = rotation; } + public boolean isInverted() { + return inverted; + } + + public void setInverted(boolean inverted) { + this.inverted = inverted; + } + + @Override public boolean equals(Object o) { if (this == o) return true; @@ -93,4 +107,5 @@ public int hashCode() { public String toString() { return name + " [" + x + "/" + y + " - " + width + "x" + height + "]"; } + } diff --git a/vpin-studio-server/src/main/java/de/mephisto/vpin/server/frontend/pinballx/PinballXConnector.java b/vpin-studio-server/src/main/java/de/mephisto/vpin/server/frontend/pinballx/PinballXConnector.java index 4d900bf9a..09a5c8c34 100644 --- a/vpin-studio-server/src/main/java/de/mephisto/vpin/server/frontend/pinballx/PinballXConnector.java +++ b/vpin-studio-server/src/main/java/de/mephisto/vpin/server/frontend/pinballx/PinballXConnector.java @@ -371,6 +371,7 @@ private void createPlayfieldDisplay(INIConfiguration iniConfiguration, List players, Properties displ String position = display.getProperty(sectionName + ".Position"); String[] positions = StringUtils.split(position, ","); String rotation = StringUtils.defaultString(display.getProperty(sectionName + ".Rotation"), "0"); + if (VPinScreen.PlayField.equals(screen)) { + player.setInverted(true); + } boolean fullScreen = "1".equals(display.getProperty(sectionName + ".FullScreen")); diff --git a/vpin-studio-server/src/main/java/de/mephisto/vpin/server/recorder/ScreenRecorder.java b/vpin-studio-server/src/main/java/de/mephisto/vpin/server/recorder/ScreenRecorder.java index 8c9f831b3..56d25992f 100644 --- a/vpin-studio-server/src/main/java/de/mephisto/vpin/server/recorder/ScreenRecorder.java +++ b/vpin-studio-server/src/main/java/de/mephisto/vpin/server/recorder/ScreenRecorder.java @@ -1,6 +1,7 @@ package de.mephisto.vpin.server.recorder; import de.mephisto.vpin.commons.SystemInfo; +import de.mephisto.vpin.restclient.frontend.VPinScreen; import de.mephisto.vpin.restclient.recorder.RecordingScreen; import de.mephisto.vpin.restclient.recorder.RecordingScreenOptions; import de.mephisto.vpin.restclient.util.SystemCommandExecutor; @@ -106,6 +107,10 @@ public RecordingResult record(@NonNull RecordingScreenOptions options) { commandList.add("25"); commandList.add("-pix_fmt"); commandList.add("yuv420p"); + if (VPinScreen.PlayField.equals(recordingScreen.getScreen()) && recordingScreen.getDisplay().isInverted()) { + commandList.add("-vf"); + commandList.add("\"transpose=2,transpose=2\""); + } commandList.add(target.getAbsolutePath()); executor = new SystemCommandExecutor(commandList);