Skip to content

Commit

Permalink
Snap support
Browse files Browse the repository at this point in the history
  • Loading branch information
berry120 committed Dec 18, 2023
1 parent 47e4d05 commit 390fa3c
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Quelea/src/main/java/org/quelea/services/utils/GStreamerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
import com.sun.jna.platform.win32.Kernel32;

import java.io.File;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;

public class GStreamerUtils {

private static final Logger LOGGER = LoggerUtils.getLogger();

private GStreamerUtils() {
}

Expand Down Expand Up @@ -41,7 +46,21 @@ public static void configurePaths() {
System.setProperty("jna.library.path", jnaPath + File.pathSeparator + gstPath);
}
}

} else if(Platform.isLinux()) {
LOGGER.log(Level.INFO, "Detected Linux");
String gstPath = System.getProperty("gstreamer.path",
"/usr/lib/x86_64-linux-gnu/gstreamer-1.0/");
LOGGER.log(Level.INFO, "GStreamer path is: " + System.getProperty("gstreamer.path"));
LOGGER.log(Level.INFO, "GStreamer path with default is: " + gstPath);
if (!gstPath.isEmpty()) {
String jnaPath = System.getProperty("jna.library.path", "").trim();
if (jnaPath.isEmpty()) {
System.setProperty("jna.library.path", gstPath);
} else {
System.setProperty("jna.library.path", jnaPath + File.pathSeparator + gstPath);
}
}
LOGGER.log(Level.INFO, "jna.library.path is: " + System.getProperty("jna.library.path"));
}
}

Expand All @@ -58,7 +77,7 @@ static String findWindowsLocation() {
"GSTREAMER_1_0_ROOT_MINGW_X86_64",
"GSTREAMER_1_0_ROOT_X86_64")
.map(System::getenv)
.filter(p -> p != null)
.filter(Objects::nonNull)
.map(p -> p.endsWith("\\") ? p + "bin\\" : p + "\\bin\\")
.findFirst().orElse("");
} else {
Expand Down

0 comments on commit 390fa3c

Please sign in to comment.