From ab43d1732b4202346ea8a17abcc8baf1bd6e2b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Schild?= Date: Sat, 11 Nov 2023 20:14:58 +0100 Subject: [PATCH] Updated maven build environment Updated tests Release 3.4.0 --- Changelog.md | 4 + README.md | 23 +- jave-all-deps/pom.xml | 38 +-- jave-core-test-java11/pom.xml | 20 +- jave-core-test/pom.xml | 20 +- .../ws/schild/jave/ConcatEncoderTest.java | 6 +- .../schild/jave/filters/ScaleFilterTest.java | 2 - .../schild/jave/filters/VideoFilterTest.java | 7 + jave-core/pom.xml | 27 +- .../src/main/java/ws/schild/jave/Encoder.java | 2 +- .../java/ws/schild/jave/MultimediaObject.java | 4 +- .../java/ws/schild/jave/VideoProcessor.java | 2 + .../java/ws/schild/jave/encode/ArgType.java | 9 +- .../jave/filters/AssSubtitlesFilter.java | 10 + .../java/ws/schild/jave/info/AudioInfo.java | 1 - .../process/ffmpeg/DefaultFFMPEGLocator.java | 282 +++++++++--------- jave-example/pom.xml | 12 +- jave-nativebin-arm32/pom.xml | 20 +- jave-nativebin-arm64/pom.xml | 20 +- jave-nativebin-linux32/pom.xml | 20 +- jave-nativebin-linux64/pom.xml | 20 +- jave-nativebin-osx64/pom.xml | 20 +- jave-nativebin-osxm1/pom.xml | 20 +- jave-nativebin-win32/pom.xml | 20 +- jave-nativebin-win64/pom.xml | 20 +- pom.xml | 10 +- 26 files changed, 334 insertions(+), 305 deletions(-) diff --git a/Changelog.md b/Changelog.md index 46fa5d2..3f8b3fd 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,10 @@ ## Changelog - **3.4.0** - Added PresetEnum to API + - Added quit encoding to api, thanks to sam80180 + - Added module name for java 9+ compatibility, thanks to Stickerifier + - Use proper class for semaphore, thanks to leeychee + - Updated maven build environment - **3.3.1** - Fixed naming of binary for OSX M1 platform - Windows 64bit + 32bit binary on 4.4.1 too diff --git a/README.md b/README.md index 6ae4ed8..55e52a8 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,10 @@ see the JAVE manual for details. | Operating System | Windows x32,x64 | MacOS x64 | MacOS m1 | Linux x32,x64 | Linux arm32,arm64 | | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | -| Supported? | YES | YES | YES | YES | YES | +| Supported? | YES | Partial,YES | YES | YES | YES | Please note that the arm+win 32 bit versions are still on 4.4.0 +The win32 binaries will be removed in the next release ## Projects using Jave2 * [XR3Player](https://github.com/goxr3plus/XR3Player) @@ -50,7 +51,7 @@ It includes all binaries for the supported platforms ws.schild jave-all-deps - 3.3.1 + 3.4.0 ``` @@ -64,7 +65,7 @@ Include the following in your pom files. ws.schild jave-core - 3.3.1 + 3.4.0 ``` @@ -75,7 +76,7 @@ and then the specific jar(s) for your platform(s) : ws.schild jave-nativebin-linux64 - 3.3.1 + 3.4.0 ``` @@ -84,7 +85,7 @@ and then the specific jar(s) for your platform(s) : ws.schild jave-nativebin-linux-arm64 - 3.3.1 + 3.4.0 ``` @@ -93,7 +94,7 @@ and then the specific jar(s) for your platform(s) : ws.schild jave-nativebin-linux-arm32 - 3.3.1 + 3.4.0 ``` @@ -102,7 +103,7 @@ and then the specific jar(s) for your platform(s) : ws.schild jave-nativebin-win64 - 3.3.1 + 3.4.0 ``` @@ -111,7 +112,7 @@ and then the specific jar(s) for your platform(s) : ws.schild jave-nativebin-osx64 - 3.3.1 + 3.4.0 ``` @@ -120,13 +121,13 @@ and then the specific jar(s) for your platform(s) : It includes all binaries for the supported platforms ``` XML -compile group: 'ws.schild', name: 'jave-all-deps', version: '3.3.1' +compile group: 'ws.schild', name: 'jave-all-deps', version: '3.4.0' ``` ### For one platform only (Linux 64Bit in this case) ``` XML -compile group: 'ws.schild', name: 'jave-core', version: '3.3.1' -compile group: 'ws.schild', name: 'jave-nativebin-linux64', version: '3.3.1' +compile group: 'ws.schild', name: 'jave-core', version: '3.4.0' +compile group: 'ws.schild', name: 'jave-nativebin-linux64', version: '3.4.0' ``` ### Main Components of Jave2 diff --git a/jave-all-deps/pom.xml b/jave-all-deps/pom.xml index 3954130..e8c4062 100644 --- a/jave-all-deps/pom.xml +++ b/jave-all-deps/pom.xml @@ -5,7 +5,7 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-all-deps Jave all native dependencies package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -35,16 +35,16 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 - 1.6.8 - 1.11.2 - 5.4.2 + 3.3.0 + 3.6.2 + 3.1.0 + 1.6.13 + 2.0.1 + 5.10.1 @@ -154,47 +154,47 @@ ws.schild jave-core - 3.3.1 + 3.4.0 ws.schild jave-nativebin-win32 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-win64 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-linux32 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-linux64 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-osx64 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-osxm1 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-linux-arm32 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-linux-arm64 - 3.3.1 + 3.4.0 diff --git a/jave-core-test-java11/pom.xml b/jave-core-test-java11/pom.xml index 4ce4c3e..5bc3a73 100644 --- a/jave-core-test-java11/pom.xml +++ b/jave-core-test-java11/pom.xml @@ -3,15 +3,15 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-core-test-java11 11 11 UTF-8 - 3.8.1 - 3.1.0 - 5.4.2 + 3.11.0 + 3.3.1 + 5.10.1 1.7.26 @@ -38,32 +38,32 @@ ws.schild jave-core - 3.3.1 + 3.4.0 ws.schild jave-nativebin-win32 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-win64 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-linux32 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-linux64 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-osx64 - 3.3.1 + 3.4.0 diff --git a/jave-core-test/pom.xml b/jave-core-test/pom.xml index 5352222..cf26503 100644 --- a/jave-core-test/pom.xml +++ b/jave-core-test/pom.xml @@ -5,15 +5,15 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-core-test 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 5.4.2 + 3.11.0 + 3.3.1 + 5.10.1 1.7.26 @@ -40,32 +40,32 @@ ws.schild jave-core - 3.3.1 + 3.4.0 ws.schild jave-nativebin-win32 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-win64 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-linux32 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-linux64 - 3.3.1 + 3.4.0 ws.schild jave-nativebin-osx64 - 3.3.1 + 3.4.0 diff --git a/jave-core-test/src/test/java/ws/schild/jave/ConcatEncoderTest.java b/jave-core-test/src/test/java/ws/schild/jave/ConcatEncoderTest.java index e3f41a8..a50b759 100644 --- a/jave-core-test/src/test/java/ws/schild/jave/ConcatEncoderTest.java +++ b/jave-core-test/src/test/java/ws/schild/jave/ConcatEncoderTest.java @@ -79,7 +79,7 @@ public void testConcatVideo1() throws Exception { video.setComplexFiltergraph(complexFiltergraph); encoder.encode(src, target, attrs); assertTrue(target.exists(), "Output file missing"); - assertTrue(target.length() == 107384, "Output file incorrect size"); + assertTrue(target.length() == 107872, "Output file incorrect size, expecting 107872 bytes, got "+target.length()); } /** @@ -126,7 +126,7 @@ public void testConcatVideo2() throws Exception { encoder.encode(src, target, attrs); assertTrue(target.exists(), "Output file missing"); - assertTrue(target.length() == 1368738, "Output file incorrect size"); + assertTrue(target.length() == 1360228, "Output file incorrect size, expecting 1360228 bytes, got "+target.length()); } @Test @@ -162,7 +162,7 @@ public void testContactAudio01() throws Exception { attributes.setVideoAttributes(video); encoder.encode(src, target, attributes); assertTrue(target.exists(), "Output file missing"); - assertTrue(target.length() == 20477182, "Output file incorrect size"); + assertTrue(target.length() == 20477182, "Output file incorrect size, expecting 20477182 bytes, got "+target.length()); } } diff --git a/jave-core-test/src/test/java/ws/schild/jave/filters/ScaleFilterTest.java b/jave-core-test/src/test/java/ws/schild/jave/filters/ScaleFilterTest.java index ffea9cc..8b20c76 100644 --- a/jave-core-test/src/test/java/ws/schild/jave/filters/ScaleFilterTest.java +++ b/jave-core-test/src/test/java/ws/schild/jave/filters/ScaleFilterTest.java @@ -6,12 +6,10 @@ package ws.schild.jave.filters; import java.io.File; -import static jdk.nashorn.internal.objects.NativeRegExp.source; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; import ws.schild.jave.AMediaTest; import ws.schild.jave.Encoder; -import ws.schild.jave.EncoderException; import ws.schild.jave.MultimediaObject; import ws.schild.jave.encode.AudioAttributes; import ws.schild.jave.encode.EncodingAttributes; diff --git a/jave-core-test/src/test/java/ws/schild/jave/filters/VideoFilterTest.java b/jave-core-test/src/test/java/ws/schild/jave/filters/VideoFilterTest.java index 1408598..14c4900 100644 --- a/jave-core-test/src/test/java/ws/schild/jave/filters/VideoFilterTest.java +++ b/jave-core-test/src/test/java/ws/schild/jave/filters/VideoFilterTest.java @@ -223,6 +223,13 @@ public void thatTrimAndWatermarkFilterProducesCorrectFiltergraphs() throws Excep .collect(Collectors.toList()); File fooPng = new File("foo.png"); String fooPath = fooPng.getAbsolutePath(); + // Check for windows path + String os = System.getProperty("os.name").toLowerCase(); + boolean isWindows = os.contains("windows"); + if (isWindows) { + fooPath= fooPath.replace("\\", "\\\\"); + fooPath= fooPath.replace(":", "\\:"); + } assertEquals( "[0]trim='duration=1.0:start=0.5',setpts='PTS-STARTPTS'[filtered0];" diff --git a/jave-core/pom.xml b/jave-core/pom.xml index 3172808..a90ce73 100644 --- a/jave-core/pom.xml +++ b/jave-core/pom.xml @@ -6,7 +6,7 @@ ws.schild jave-core jar - 3.3.1 + 3.4.0 Jave core package The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project. Developers can take take advantage of JAVE2 to transcode @@ -41,18 +41,19 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.0.0 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 + 3.3.0 + 3.6.2 + 3.1.0 3.3.0 - 1.6.8 - 1.11.2 + 1.6.13 + 2.0.1 1.7.36 - 5.4.2 + 5.10.1 @@ -75,7 +76,7 @@ org.codehaus.mojo buildnumber-maven-plugin - 1.4 + ${maven-buildnumber-plugin.version} validate @@ -85,8 +86,8 @@ - true - true + false + false diff --git a/jave-core/src/main/java/ws/schild/jave/Encoder.java b/jave-core/src/main/java/ws/schild/jave/Encoder.java index 20865b2..ce626ab 100644 --- a/jave-core/src/main/java/ws/schild/jave/Encoder.java +++ b/jave-core/src/main/java/ws/schild/jave/Encoder.java @@ -602,7 +602,7 @@ public void encode( * have named methods that would calculate durations as in #1 and #2. */ if (multimediaObjects.size() == 1 - && (!multimediaObjects.get(0).isURL() || !multimediaObjects.get(0).isReadURLOnce())) { + && !multimediaObjects.get(0).isReadURLOnce()) { info = multimediaObjects.get(0).getInfo(); } diff --git a/jave-core/src/main/java/ws/schild/jave/MultimediaObject.java b/jave-core/src/main/java/ws/schild/jave/MultimediaObject.java index 0acde44..c4ad454 100644 --- a/jave-core/src/main/java/ws/schild/jave/MultimediaObject.java +++ b/jave-core/src/main/java/ws/schild/jave/MultimediaObject.java @@ -66,8 +66,8 @@ public void setReadURLOnce(boolean readURLOnce) { private File inputFile; private URL inputURL; /** - * When true, we try to not read the source more than once One of the side effects is, that no - * progressbar is available. + * When true, we try to not read the source more than once. + * One of the side effects is, that no progressbar is available */ private boolean readURLOnce = false; diff --git a/jave-core/src/main/java/ws/schild/jave/VideoProcessor.java b/jave-core/src/main/java/ws/schild/jave/VideoProcessor.java index c83a0a3..23b5e24 100644 --- a/jave-core/src/main/java/ws/schild/jave/VideoProcessor.java +++ b/jave-core/src/main/java/ws/schild/jave/VideoProcessor.java @@ -71,6 +71,8 @@ public void catClipsTogether(List videos, File destination, VideoProgressL try (AutoRemoveableFile mergeFile = prepareMergeInstructions(videos, destination)) { MultimediaObject toMerge = fromFile(mergeFile); + // Prevent trying to determine multimedia infos from txt file + toMerge.setReadURLOnce(true); EncodingAttributes attributes = new EncodingAttributes(); attributes.setInputFormat("concat"); diff --git a/jave-core/src/main/java/ws/schild/jave/encode/ArgType.java b/jave-core/src/main/java/ws/schild/jave/encode/ArgType.java index de3e95b..cc06c51 100644 --- a/jave-core/src/main/java/ws/schild/jave/encode/ArgType.java +++ b/jave-core/src/main/java/ws/schild/jave/encode/ArgType.java @@ -6,7 +6,10 @@ * @author mressler */ public enum ArgType { - GLOBAL, - INFILE, - OUTFILE; + /** Global argument for ffmpeg */ + GLOBAL, + /** Arguments for input file(s) */ + INFILE, + /** Argument for output file(s) */ + OUTFILE; } diff --git a/jave-core/src/main/java/ws/schild/jave/filters/AssSubtitlesFilter.java b/jave-core/src/main/java/ws/schild/jave/filters/AssSubtitlesFilter.java index a8f108e..8c95a1c 100644 --- a/jave-core/src/main/java/ws/schild/jave/filters/AssSubtitlesFilter.java +++ b/jave-core/src/main/java/ws/schild/jave/filters/AssSubtitlesFilter.java @@ -2,6 +2,11 @@ import java.io.File; +/** + * Add subtitles to the video + * + * @author andre + */ public class AssSubtitlesFilter extends Filter { /** @@ -16,6 +21,11 @@ public AssSubtitlesFilter(File source) { addOrderedArgument(escapingPath(source.getAbsolutePath())); } + /** + * + * @param source The source ass subtitle file to be used for this movie filter. + * @param outputLabel The label to add as subtitle + */ public AssSubtitlesFilter(File source, String outputLabel) { this(source); addOutputLabel(outputLabel); diff --git a/jave-core/src/main/java/ws/schild/jave/info/AudioInfo.java b/jave-core/src/main/java/ws/schild/jave/info/AudioInfo.java index 80edb38..9226e59 100644 --- a/jave-core/src/main/java/ws/schild/jave/info/AudioInfo.java +++ b/jave-core/src/main/java/ws/schild/jave/info/AudioInfo.java @@ -144,7 +144,6 @@ public String getBitDepth() { * Sets the audio stream bit depth. * * @param bitDepth The audio stream bit depth. - * @return this instance */ public void setBitDepth(String bitDepth) { this.bitDepth = bitDepth; diff --git a/jave-core/src/main/java/ws/schild/jave/process/ffmpeg/DefaultFFMPEGLocator.java b/jave-core/src/main/java/ws/schild/jave/process/ffmpeg/DefaultFFMPEGLocator.java index b2b3665..57b9556 100644 --- a/jave-core/src/main/java/ws/schild/jave/process/ffmpeg/DefaultFFMPEGLocator.java +++ b/jave-core/src/main/java/ws/schild/jave/process/ffmpeg/DefaultFFMPEGLocator.java @@ -32,163 +32,165 @@ import ws.schild.jave.process.ProcessWrapper; /** - * The default ffmpeg executable locator, which exports on disk the ffmpeg executable bundled with - * the library distributions. It should work both for windows and many linux distributions. If it - * doesn't, try compiling your own ffmpeg executable and plug it in JAVE with a custom {@link + * The default ffmpeg executable locator, which exports on disk the ffmpeg + * executable bundled with the library distributions. It should work both for + * windows and many linux distributions. If it doesn't, try compiling your own + * ffmpeg executable and plug it in JAVE with a custom {@link * FFMPEGProcess} * * @author Carlo Pelliccia */ public class DefaultFFMPEGLocator implements ProcessLocator { - private static final Logger LOG = LoggerFactory.getLogger(DefaultFFMPEGLocator.class); - - /** The ffmpeg executable file path. */ - private final String path; - - /** It builds the default FFMPEGLocator, exporting the ffmpeg executable on a temp file. */ - public DefaultFFMPEGLocator() { - String os = System.getProperty("os.name").toLowerCase(); - boolean isWindows = os.contains("windows"); - boolean isMac = os.contains("mac"); - LOG.debug("Os name is <{}> isWindows: {} isMac: {}", os, isWindows, isMac); - - // Dir Folder - File dirFolder = new File(System.getProperty("java.io.tmpdir"), "jave/"); - if (!dirFolder.exists()) { - LOG.debug( - "Creating jave temp folder to place executables in <{}>", dirFolder.getAbsolutePath()); - dirFolder.mkdirs(); - } else { - LOG.debug("Jave temp folder exists in <{}>", dirFolder.getAbsolutePath()); - } - - // -----------------ffmpeg executable export on disk.----------------------------- - String suffix = isWindows ? ".exe" : (isMac ? "-osx" : ""); - String arch = System.getProperty("os.arch"); + private static final Logger LOG = LoggerFactory.getLogger(DefaultFFMPEGLocator.class); + + /** + * The ffmpeg executable file path. + */ + private final String path; + + /** + * It builds the default FFMPEGLocator, exporting the ffmpeg executable on a + * temp file. + */ + public DefaultFFMPEGLocator() { + String os = System.getProperty("os.name").toLowerCase(); + boolean isWindows = os.contains("windows"); + boolean isMac = os.contains("mac"); + LOG.debug("Os name is <{}> isWindows: {} isMac: {}", os, isWindows, isMac); + + // Dir Folder + File dirFolder = new File(System.getProperty("java.io.tmpdir"), "jave/"); + if (!dirFolder.exists()) { + LOG.debug( + "Creating jave temp folder to place executables in <{}>", dirFolder.getAbsolutePath()); + dirFolder.mkdirs(); + } else { + LOG.debug("Jave temp folder exists in <{}>", dirFolder.getAbsolutePath()); + } - // File - File ffmpegFile = new File(dirFolder, "ffmpeg-" + arch + "-" + Version.getVersion() + suffix); - LOG.debug("Executable path: {}", ffmpegFile.getAbsolutePath()); + // -----------------ffmpeg executable export on disk.----------------------------- + String suffix = isWindows ? ".exe" : (isMac ? "-osx" : ""); + String arch = System.getProperty("os.arch"); + + // File + File ffmpegFile = new File(dirFolder, "ffmpeg-" + arch + "-" + Version.getVersion() + suffix); + LOG.debug("Executable path: {}", ffmpegFile.getAbsolutePath()); + + synchronized (DefaultFFMPEGLocator.class) { + // Check the version of existing .exe file + if (ffmpegFile.exists()) { + // OK, already present + LOG.debug("Executable exists in <{}>", ffmpegFile.getAbsolutePath()); + } else { + LOG.debug("Need to copy executable to <{}>", ffmpegFile.getAbsolutePath()); + copyFile("ffmpeg-" + arch + suffix, ffmpegFile); + } + + // Need a chmod? + if (!isWindows) { + try { + Runtime.getRuntime().exec(new String[]{"/bin/chmod", "755", ffmpegFile.getAbsolutePath()}); + } catch (IOException e) { + LOG.error("Error setting executable via chmod", e); + } + } + } - synchronized(this) - { - // Check the version of existing .exe file + // Everything seems okay + path = ffmpegFile.getAbsolutePath(); if (ffmpegFile.exists()) { - // OK, already present - LOG.debug("Executable exists in <{}>", ffmpegFile.getAbsolutePath()); + LOG.debug("ffmpeg executable found: {}", path); } else { - LOG.debug("Need to copy executable to <{}>", ffmpegFile.getAbsolutePath()); - copyFile("ffmpeg-" + arch + suffix, ffmpegFile); - } - - // Need a chmod? - if (!isWindows) { - try { - Runtime.getRuntime().exec(new String[] {"/bin/chmod", "755", ffmpegFile.getAbsolutePath()}); - } catch (IOException e) { - LOG.error("Error setting executable via chmod", e); - } + LOG.error("ffmpeg executable NOT found: {}", path); } } - // Everything seems okay - path = ffmpegFile.getAbsolutePath(); - if (ffmpegFile.exists()) - { - LOG.debug("ffmpeg executable found: {}", path); + @Override + public String getExecutablePath() { + return path; } - else - { - LOG.error("ffmpeg executable NOT found: {}", path); - } - } - - @Override - public String getExecutablePath() { - return path; - } - - /** - * Copies a file bundled in the package to the supplied destination. - * - * @param path The name of the bundled file. - * @param dest The destination. - * @throws RuntimeException If an unexpected error occurs. - */ - private void copyFile(String path, File dest) { - String resourceName = "nativebin/" + path; - try { - LOG.debug("Copy from resource <{}> to target <{}>", resourceName, dest.getAbsolutePath()); - InputStream is = getClass().getResourceAsStream(resourceName); - if (is == null) { - // Use this for Java 9+ only if required - resourceName = "ws/schild/jave/nativebin/" + path; - LOG.debug( - "Alternative copy from SystemResourceAsStream <{}> to target <{}>", - resourceName, - dest.getAbsolutePath()); - is = ClassLoader.getSystemResourceAsStream(resourceName); - } - if (is == null) { - // Use this for spring boot with different class loaders - resourceName = "ws/schild/jave/nativebin/" + path; - LOG.debug( - "Alternative copy from Thread.currentThread().getContextClassLoader() <{}> to target <{}>", - resourceName, - dest.getAbsolutePath()); - ClassLoader classloader = Thread.currentThread().getContextClassLoader(); - is = classloader.getResourceAsStream(resourceName); - } - - if (is != null) { - if (copy(is, dest.getAbsolutePath())) { - if (dest.exists()) { - LOG.debug("Target <{}> exists", dest.getAbsolutePath()); - } else { - LOG.error("Target <{}> does not exist", dest.getAbsolutePath()); - } - } else { - LOG.error("Copy resource to target <{}> failed", dest.getAbsolutePath()); - } + + /** + * Copies a file bundled in the package to the supplied destination. + * + * @param path The name of the bundled file. + * @param dest The destination. + * @throws RuntimeException If an unexpected error occurs. + */ + private void copyFile(String path, File dest) { + String resourceName = "nativebin/" + path; try { - is.close(); - } catch (IOException ioex) { - LOG.warn("Error in closing input stream", ioex); + LOG.debug("Copy from resource <{}> to target <{}>", resourceName, dest.getAbsolutePath()); + InputStream is = getClass().getResourceAsStream(resourceName); + if (is == null) { + // Use this for Java 9+ only if required + resourceName = "ws/schild/jave/nativebin/" + path; + LOG.debug( + "Alternative copy from SystemResourceAsStream <{}> to target <{}>", + resourceName, + dest.getAbsolutePath()); + is = ClassLoader.getSystemResourceAsStream(resourceName); + } + if (is == null) { + // Use this for spring boot with different class loaders + resourceName = "ws/schild/jave/nativebin/" + path; + LOG.debug( + "Alternative copy from Thread.currentThread().getContextClassLoader() <{}> to target <{}>", + resourceName, + dest.getAbsolutePath()); + ClassLoader classloader = Thread.currentThread().getContextClassLoader(); + is = classloader.getResourceAsStream(resourceName); + } + + if (is != null) { + if (copy(is, dest.getAbsolutePath())) { + if (dest.exists()) { + LOG.debug("Target <{}> exists", dest.getAbsolutePath()); + } else { + LOG.error("Target <{}> does not exist", dest.getAbsolutePath()); + } + } else { + LOG.error("Copy resource to target <{}> failed", dest.getAbsolutePath()); + } + try { + is.close(); + } catch (IOException ioex) { + LOG.warn("Error in closing input stream", ioex); + } + } else { + LOG.error("Could not find ffmpeg platform executable in resources for <{}>", resourceName); + } + } catch (NullPointerException ex) { + LOG.error( + "Could not find ffmpeg executable for {} is the correct platform jar included?", + resourceName); + throw ex; } - } else { - LOG.error("Could not find ffmpeg platform executable in resources for <{}>", resourceName); - } - } catch (NullPointerException ex) { - LOG.error( - "Could not find ffmpeg executable for {} is the correct platform jar included?", - resourceName); - throw ex; - } - } - - /** - * Copy a file from source to destination. - * - * @param source The name of the bundled file. - * @param destination the destination - * @return True if succeeded , False if not - */ - private boolean copy(InputStream source, String destination) { - boolean success = true; - - try { - Files.copy(source, Paths.get(destination), StandardCopyOption.REPLACE_EXISTING); - } catch (IOException ex) { - LOG.error("Cannot write file " + destination, ex); - success = false; } - return success; - } + /** + * Copy a file from source to destination. + * + * @param source The name of the bundled file. + * @param destination the destination + * @return True if succeeded , False if not + */ + private boolean copy(InputStream source, String destination) { + boolean success = true; - @Override - public ProcessWrapper createExecutor() { - return new FFMPEGProcess(getExecutablePath()); - } + try { + Files.copy(source, Paths.get(destination), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException ex) { + LOG.error("Cannot write file " + destination, ex); + success = false; + } + + return success; + } + + @Override + public ProcessWrapper createExecutor() { + return new FFMPEGProcess(getExecutablePath()); + } } diff --git a/jave-example/pom.xml b/jave-example/pom.xml index 7e23223..78a724d 100644 --- a/jave-example/pom.xml +++ b/jave-example/pom.xml @@ -3,17 +3,17 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-example 12 12 UTF-8 - 3.8.1 - 3.1.0 + 3.11.0 + 3.3.1 3.1.2 1.7.26 - 5.4.2 + 5.10.1 @@ -66,12 +66,12 @@ ws.schild jave-core - 3.3.1 + 3.4.0 ws.schild jave-nativebin-linux32 - 3.3.1 + 3.4.0 diff --git a/jave-nativebin-arm32/pom.xml b/jave-nativebin-arm32/pom.xml index 15b4274..d61207f 100644 --- a/jave-nativebin-arm32/pom.xml +++ b/jave-nativebin-arm32/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-nativebin-linux-arm32 Jave linux arm 32 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -33,16 +33,16 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 - 1.6.8 - 1.11.2 - 5.4.2 + 3.3.0 + 3.6.2 + 3.1.0 + 1.6.13 + 2.0.1 + 5.10.1 diff --git a/jave-nativebin-arm64/pom.xml b/jave-nativebin-arm64/pom.xml index ab1ff18..9e1066d 100644 --- a/jave-nativebin-arm64/pom.xml +++ b/jave-nativebin-arm64/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-nativebin-linux-arm64 Jave linux arm 64 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -33,16 +33,16 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 - 1.6.8 - 1.11.2 - 5.4.2 + 3.3.0 + 3.6.2 + 3.1.0 + 1.6.13 + 2.0.1 + 5.10.1 diff --git a/jave-nativebin-linux32/pom.xml b/jave-nativebin-linux32/pom.xml index d993b10..3c49450 100644 --- a/jave-nativebin-linux32/pom.xml +++ b/jave-nativebin-linux32/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-nativebin-linux32 Jave linux 32 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -33,16 +33,16 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 - 1.6.8 - 1.11.2 - 5.4.2 + 3.3.0 + 3.6.2 + 3.1.0 + 1.6.13 + 2.0.1 + 5.10.1 diff --git a/jave-nativebin-linux64/pom.xml b/jave-nativebin-linux64/pom.xml index 72a4593..523ff48 100644 --- a/jave-nativebin-linux64/pom.xml +++ b/jave-nativebin-linux64/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-nativebin-linux64 Jave linux 64 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -33,16 +33,16 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 - 1.6.8 - 1.11.2 - 5.4.2 + 3.3.0 + 3.6.2 + 3.1.0 + 1.6.13 + 2.0.1 + 5.10.1 diff --git a/jave-nativebin-osx64/pom.xml b/jave-nativebin-osx64/pom.xml index b8a525c..d09190e 100644 --- a/jave-nativebin-osx64/pom.xml +++ b/jave-nativebin-osx64/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-nativebin-osx64 Jave OSX 64 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -33,16 +33,16 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 - 1.6.8 - 1.11.2 - 5.4.2 + 3.3.0 + 3.6.2 + 3.1.0 + 1.6.13 + 2.0.1 + 5.10.1 diff --git a/jave-nativebin-osxm1/pom.xml b/jave-nativebin-osxm1/pom.xml index ac50b05..8052c7b 100644 --- a/jave-nativebin-osxm1/pom.xml +++ b/jave-nativebin-osxm1/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-nativebin-osxm1 Jave OSX m1 native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -33,16 +33,16 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 - 1.6.8 - 1.11.2 - 5.4.2 + 3.3.0 + 3.6.2 + 3.1.0 + 1.6.13 + 2.0.1 + 5.10.1 diff --git a/jave-nativebin-win32/pom.xml b/jave-nativebin-win32/pom.xml index 0d54be1..94fabfc 100644 --- a/jave-nativebin-win32/pom.xml +++ b/jave-nativebin-win32/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-nativebin-win32 Jave windows 32 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -33,16 +33,16 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 - 1.6.8 - 1.11.2 - 5.4.2 + 3.3.0 + 3.6.2 + 3.1.0 + 1.6.13 + 2.0.1 + 5.10.1 diff --git a/jave-nativebin-win64/pom.xml b/jave-nativebin-win64/pom.xml index 0950de3..35938f0 100644 --- a/jave-nativebin-win64/pom.xml +++ b/jave-nativebin-win64/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 3.3.1 + 3.4.0 jave-nativebin-win64 Jave windows 64 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -33,16 +33,16 @@ 1.8 1.8 UTF-8 - 3.8.1 - 3.1.0 - 3.0.1-M1 + 3.11.0 + 3.3.1 + 3.1.1 2.5.3 - 3.1.0 - 3.1.0 - 1.6 - 1.6.8 - 1.11.2 - 5.4.2 + 3.3.0 + 3.6.2 + 3.1.0 + 1.6.13 + 2.0.1 + 5.10.1 diff --git a/pom.xml b/pom.xml index c740407..76b158b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,16 @@ jave-modules pom - 3.3.1 + 3.4.0 1.8 1.8 + 3.11.0 + 3.3.1 UTF-8 - 3.3.1 + 3.4.0 Jave master project Jave master project https://github.com/a-schild/jave2 @@ -32,7 +34,7 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + ${maven-compiler-plugin.version} ${project.build.sourceEncoding} @@ -40,7 +42,7 @@ org.apache.maven.plugins maven-resources-plugin - 2.4.3 + ${maven-resources-plugin.version} ${project.build.sourceEncoding}