Enabled deprication warnings, fixed some of the warnings

This commit is contained in:
Ziver Koc 2025-12-18 01:00:03 +01:00
parent 5f02f65ead
commit 986ec8958a
17 changed files with 235 additions and 109 deletions

View file

@ -80,6 +80,10 @@ java {
withJavadocJar()
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
sourceSets {
main {
java {

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Ziver Koc
* Copyright (c) 2020-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -31,6 +31,7 @@ import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import java.io.Closeable;
import java.lang.reflect.InvocationTargetException;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -110,10 +111,10 @@ public class DBConnection implements Closeable{
* @param db is the DB type
* @return the protocol name of the DBMS
*/
public static String initDriver(DBMS db) throws InstantiationException, IllegalAccessException, ClassNotFoundException{
public static String initDriver(DBMS db) throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException {
switch(db) {
case MySQL:
Class.forName("com.mysql.jdbc.Driver").newInstance();
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
DriverManager.setLoginTimeout(10);
return "mysql";
case SQLite:

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Ziver Koc
* Copyright (c) 2020-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -27,6 +27,7 @@ package zutil.image;
import zutil.ProgressListener;
import java.awt.image.BufferedImage;
import java.lang.reflect.InvocationTargetException;
/**
* This is a abstract class for all the effects
@ -74,8 +75,8 @@ public abstract class ImageFilterProcessor {
* @param img The image to process
* @return The processed image
*/
public static ImageFilterProcessor getProcessor(String effect, BufferedImage img) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
ImageFilterProcessor processor = (ImageFilterProcessor)Class.forName(effect).newInstance();
public static ImageFilterProcessor getProcessor(String effect, BufferedImage img) throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException {
ImageFilterProcessor processor = (ImageFilterProcessor)Class.forName(effect).getDeclaredConstructor().newInstance();
processor.img = img;
return processor;
}

View file

@ -1,3 +1,27 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package zutil.net.acme;
import org.shredzone.acme4j.toolbox.AcmeUtils;
@ -12,6 +36,9 @@ import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
/**
* A file based datastore for storing ACME protocol needed data.
*/
public class AcmeFileDataStore implements AcmeDataStore {
private final File accountLocationFile;

View file

@ -189,9 +189,9 @@ public class HttpURL {
for (String key : parameters.keySet()) {
if (param.length() > 0)
param.append('&');
param.append(URLEncoder.encode(key));
param.append(URLEncoder.encode(key, StandardCharsets.UTF_8));
param.append('=');
param.append(URLEncoder.encode(parameters.get(key)));
param.append(URLEncoder.encode(parameters.get(key), StandardCharsets.UTF_8));
}
return param.toString();
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Ziver Koc
* Copyright (c) 2020-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -32,6 +32,7 @@ import zutil.net.http.HttpPrintStream;
import zutil.net.http.HttpURL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Random;
import java.util.logging.Logger;
@ -111,7 +112,7 @@ public class OAuth2AuthorizationPage implements HttpPage {
}
try {
url = new HttpURL(URLDecoder.decode(request.get("redirect_uri")));
url = new HttpURL(URLDecoder.decode(request.get("redirect_uri"), StandardCharsets.UTF_8));
} catch(Exception e) {}
if (url == null || !"HTTPS".equalsIgnoreCase(url.getProtocol())) {

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Ziver Koc
* Copyright (c) 2020-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -165,6 +165,7 @@ public class HttpServletRequestImpl implements HttpServletRequest {
}
@Override
@Deprecated
public boolean isRequestedSessionIdFromUrl() {
return false;
}
@ -325,6 +326,7 @@ public class HttpServletRequestImpl implements HttpServletRequest {
}
@Override
@Deprecated
public String getRealPath(String s) {
return null;
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Ziver Koc
* Copyright (c) 2020-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -56,11 +56,13 @@ public class HttpServletResponseImpl implements HttpServletResponse {
}
@Override
@Deprecated
public String encodeUrl(String s) {
return null;
}
@Override
@Deprecated
public String encodeRedirectUrl(String s) {
return null;
}
@ -116,6 +118,7 @@ public class HttpServletResponseImpl implements HttpServletResponse {
}
@Override
@Deprecated
public void setStatus(int i, String s) {
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Ziver Koc
* Copyright (c) 2020-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -63,6 +63,7 @@ public class HttpSessionImpl implements HttpSession {
}
@Override
@Deprecated
public HttpSessionContext getSessionContext() {
throw new UnsupportedOperationException();
}
@ -73,6 +74,7 @@ public class HttpSessionImpl implements HttpSession {
}
@Override
@Deprecated
public Object getValue(String name) {
return null;
}
@ -83,6 +85,7 @@ public class HttpSessionImpl implements HttpSession {
}
@Override
@Deprecated
public String[] getValueNames() {
return new String[0];
}
@ -93,6 +96,7 @@ public class HttpSessionImpl implements HttpSession {
}
@Override
@Deprecated
public void putValue(String name, Object value) {
}
@ -103,6 +107,7 @@ public class HttpSessionImpl implements HttpSession {
}
@Override
@Deprecated
public void removeValue(String name) {
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Ziver Koc
* Copyright (c) 2020-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -24,6 +24,7 @@
package zutil.net.ws;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Collection;
@ -132,7 +133,7 @@ public class WebServiceDef {
return path;
}
public WSInterface newInstance() throws InstantiationException, IllegalAccessException {
return intf.newInstance();
public WSInterface newInstance() throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
return intf.getDeclaredConstructor().newInstance();
}
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Ziver Koc
* Copyright (c) 2021-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -24,12 +24,15 @@
package zutil.osal.app.ffmpeg;
import zutil.log.LogUtil;
import zutil.osal.app.ffmpeg.FFmpegConstants.*;
import zutil.osal.app.ffmpeg.FFmpegProgressManager.FFmpegProgressListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
/**
* Class for building a ffmpeg commandline for execution
@ -37,6 +40,8 @@ import java.util.List;
* @see <a href="https://ffmpeg.org/ffmpeg.html">FFmpeg Commandline Documentation</a>
*/
public class FFmpeg {
private Logger logger = LogUtil.getLogger();
private FFmpegLogLevel logLevel;
private boolean overwriteOutput = false;
private List<FFmpegInput> inputs = new ArrayList<>();
@ -81,22 +86,28 @@ public class FFmpeg {
}
public String buildCommand() {
StringBuilder command = new StringBuilder();
command.append("ffmpeg");
/**
* Will generate a parameter list that will be supplied to ffmpeg binary based on the Object configuration.
*
* @return a list of parameter that should be supplied to FFmpeg
*/
public List<String> buildCommand() {
List<String> command = new ArrayList<>();
// General inputs
if (logLevel != null) {
command.append(" -loglevel ").append(logLevel.toString().toLowerCase());
command.add("-loglevel");
command.add(logLevel.toString().toLowerCase());
}
if (progressManager != null) {
command.append(" -progress ").append(progressManager.getAddress());
command.add("-progress");
command.add(progressManager.getAddress());
}
if (overwriteOutput) {
command.append(" -y");
command.add("-y");
}
// TODO: -stdin Enable interaction on standard input
@ -104,15 +115,35 @@ public class FFmpeg {
// Inputs
for (FFmpegInput input : inputs) {
command.append(" ").append(input.buildCommand());
command.addAll(input.buildCommand());
}
// Outputs
for (FFmpegOutput output : outputs) {
command.append(" ").append(output.buildCommand());
command.addAll(output.buildCommand());
}
return command.toString();
return command;
}
/**
* Will execute the ffmpeg binary with the configured parameters.
* Recommended to use {@see OSALBinaryManager} to select correct FFmpeg binary depending on OS.
*
* @param ffmpegPath The path to the FFmpeg binary. (OS dependent)
* @return a Process object containing the execution of FFmpeg.
*/
public Process execute(File ffmpegPath) throws IOException {
List<String> cmd = new ArrayList<>();
cmd.add(ffmpegPath.getAbsolutePath());
cmd.addAll(buildCommand());
ProcessBuilder pb = new ProcessBuilder(cmd);
pb.redirectErrorStream(true);
logger.finest("Executing FFmpeg: " + String.join(" ", cmd));
return pb.start();
}
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Ziver Koc
* Copyright (c) 2021-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -24,8 +24,6 @@
package zutil.osal.app.ffmpeg;
import zutil.StringUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -88,6 +86,7 @@ public class FFmpegInput {
/**
* Add additional args that may not be supported by the API, these values will be inserted to the command line as is.
* Each argument must be a separate String in the list.
*
* @param args a list of additional commands
*/
@ -102,7 +101,7 @@ public class FFmpegInput {
/**
* Enable or Blocks audio from input file. (enabled by default)
*
* @param enabled Set to false to disable audio
* @param enabled Set too false to disable audio
*/
public void setAudioEnabled(boolean enabled) {
this.audioEnabled = enabled;
@ -115,7 +114,7 @@ public class FFmpegInput {
/**
* Enable or Blocks subtitles from input file. (enabled by default)
*
* @param enabled Set to false to disable subtitles
* @param enabled Set too false to disable subtitles
*/
public void setSubtitleEnabled(boolean enabled) {
this.subtitleEnabled = enabled;
@ -125,36 +124,46 @@ public class FFmpegInput {
// Command Generation
// ----------------------------------------------------
protected String buildCommand() {
StringBuilder command = new StringBuilder();
protected List<String> buildCommand() {
List<String> command = new ArrayList<>();
// ----------------------------------------------------
// General Options
// ----------------------------------------------------
if (positionStart != null)
command.append(" -ss ").append(positionStart);
if (positionEnd != null)
command.append(" -to ").append(positionEnd);
if (duration != null)
command.append(" -t ").append(duration);
if (positionStart != null) {
command.add("-ss");
command.add(String.valueOf(positionStart));
}
if (positionEnd != null) {
command.add("-to");
command.add(String.valueOf(positionEnd));
}
if (duration != null) {
command.add("-t");
command.add(String.valueOf(duration));
}
// ----------------------------------------------------
// Audio Options
// ----------------------------------------------------
if (!audioEnabled)
command.append(" -an");
if (!audioEnabled) {
command.add("-an");
}
// ----------------------------------------------------
// Subtitle Options
// ----------------------------------------------------
if (!subtitleEnabled)
command.append(" -sn");
if (!subtitleEnabled) {
command.add("-sn");
}
command.append(StringUtil.join(" ", additionalArgs));
command.append(" -i \"").append(input).append("\"");
return command.toString().trim();
command.addAll(additionalArgs);
command.add("-i");
command.add(input);
return command;
}
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Ziver Koc
* Copyright (c) 2021-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -24,7 +24,6 @@
package zutil.osal.app.ffmpeg;
import zutil.StringUtil;
import zutil.osal.app.ffmpeg.FFmpegConstants.FFmpegAudioCodec;
import zutil.osal.app.ffmpeg.FFmpegConstants.FFmpegSubtitleCodec;
import zutil.osal.app.ffmpeg.FFmpegConstants.FFmpegVideoCodec;
@ -126,6 +125,7 @@ public class FFmpegOutput {
/**
* Add additional args that may not be supported by the API, these values will be inserted to the command line as is.
* Each argument must be a separate String in the list.
*
* @param args a list of FFmpeg arguments
*/
@ -282,7 +282,7 @@ public class FFmpegOutput {
/**
* Enable or Disables subtitles in output file. (enabled by default)
*
* @param enabled Set to false to disable subtitles
* @param enabled Set too false to disable subtitles
*/
public void setSubtitleEnabled(boolean enabled) {
this.subtitleEnabled = enabled;
@ -292,70 +292,104 @@ public class FFmpegOutput {
// Command Generation
// ----------------------------------------------------
protected String buildCommand() {
StringBuilder command = new StringBuilder();
protected List<String> buildCommand() {
List<String> command = new ArrayList<>();
// ----------------------------------------------------
// General Options
// ----------------------------------------------------
if (positionStart != null)
command.append(" -ss ").append(positionStart);
if (positionEnd != null)
command.append(" -to ").append(positionEnd);
if (duration != null)
command.append(" -t ").append(duration);
if (fileSize != null)
command.append(" -fs ").append(fileSize);
if (positionStart != null) {
command.add("-ss");
command.add(String.valueOf(positionStart));
}
if (positionEnd != null) {
command.add("-to");
command.add(String.valueOf(positionEnd));
}
if (duration != null) {
command.add("-t");
command.add(String.valueOf(duration));
}
if (fileSize != null) {
command.add("-fs");
command.add(String.valueOf(fileSize));
}
if (encodingPass != null)
command.append(" -pass ").append(encodingPass);
if (encodingPass != null) {
command.add("-pass");
command.add(String.valueOf(encodingPass));
}
// ----------------------------------------------------
// Video Options
// ----------------------------------------------------
if (videoCodec != null)
command.append(" -codec:v ").append(videoCodec);
if (videoFrameRate != null)
command.append(" -frames ").append(videoFrameRate);
if (videoWidth != null && videoHeight != null)
command.append(" -filter:v scale=").append(videoWidth).append(':').append(videoHeight);
if (videoBitRate != null)
command.append(" -b:v ").append(videoBitRate);
if (videoQuality != null)
command.append(" -qscale:v ").append(videoQuality);
if (videoCodec != null) {
command.add("-codec:v");
command.add(videoCodec);
}
if (videoFrameRate != null) {
command.add("-frames");
command.add(String.valueOf(videoFrameRate));
}
if (videoWidth != null && videoHeight != null) {
command.add("-filter:v");
command.add("scale=" + videoWidth + ":" + videoHeight);
}
if (videoBitRate != null) {
command.add("-b:v");
command.add(String.valueOf(videoBitRate));
}
if (videoQuality != null) {
command.add("-qscale:v");
command.add(String.valueOf(videoQuality));
}
// ----------------------------------------------------
// Audio Options
// ----------------------------------------------------
if (audioCodec != null)
command.append(" -codec:a ").append(audioCodec);
if (audioSampleRate != null)
command.append(" -ar ").append(audioSampleRate);
if (audioChannels != null)
command.append(" -ac ").append(audioChannels);
if (audioBitRate != null)
command.append(" -b:a ").append(audioBitRate);
if (audioQuality != null)
command.append(" -qscale:a ").append(audioQuality);
if (audioCodec != null) {
command.add("-codec:a");
command.add(audioCodec);
}
if (audioSampleRate != null) {
command.add("-ar");
command.add(String.valueOf(audioSampleRate));
}
if (audioChannels != null) {
command.add("-ac");
command.add(String.valueOf(audioChannels));
}
if (audioBitRate != null) {
command.add("-b:a");
command.add(String.valueOf(audioBitRate));
}
if (audioQuality != null) {
command.add("-qscale:a");
command.add(String.valueOf(audioQuality));
}
if (!audioEnabled)
command.append(" -an");
if (!audioEnabled) {
command.add("-an");
}
// ----------------------------------------------------
// Subtitle Options
// ----------------------------------------------------
if (subtitleCodec != null)
command.append(" -codec:s ").append(subtitleCodec);
if (subtitleCodec != null) {
command.add("-codec:s");
command.add(subtitleCodec);
}
if (!subtitleEnabled)
command.append(" -sn");
if (!subtitleEnabled) {
command.add("-sn");
}
command.append(StringUtil.join(" ", additionalArgs));
command.append(" \"").append(output).append("\"");
return command.toString().trim();
command.addAll(additionalArgs);
command.add(output);
return command;
}
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Ziver Koc
* Copyright (c) 2020-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -152,7 +152,7 @@ public class PluginData {
private <T> T getObject(Class<T> objClass) {
try {
if (!objectMap.containsKey(objClass))
objectMap.put(objClass, objClass.newInstance());
objectMap.put(objClass, objClass.getDeclaredConstructor().newInstance());
return (T) objectMap.get(objClass);
} catch (Exception e) {
log.log(Level.WARNING, "Unable to instantiate plugin class: " + objClass, e);

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Ziver Koc
* Copyright (c) 2021-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -26,6 +26,8 @@ package zutil.osal.app.ffmpeg;
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.*;
public class FFmpegInputTest {
@ -34,7 +36,7 @@ public class FFmpegInputTest {
public void onlyInput() {
FFmpegInput ffmpegInput = new FFmpegInput("iTest.mp4");
assertEquals("-i \"iTest.mp4\"", ffmpegInput.buildCommand());
assertEquals(Arrays.asList("-i", "iTest.mp4"), ffmpegInput.buildCommand());
}
@Test
@ -48,9 +50,10 @@ public class FFmpegInputTest {
ffmpegInput.setSubtitleEnabled(false);
assertEquals("-ss 9.1 -to 20.1 -t 10.1" +
" -an" +
" -sn" +
" -i \"iTest.mp4\"", ffmpegInput.buildCommand());
assertEquals(Arrays.asList("-ss", "9.1", "-to", "20.1", "-t", "10.1",
"-an",
"-sn",
"-i", "iTest.mp4"),
ffmpegInput.buildCommand());
}
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Ziver Koc
* Copyright (c) 2021-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -26,6 +26,8 @@ package zutil.osal.app.ffmpeg;
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.*;
public class FFmpegOutputTest {
@ -34,7 +36,7 @@ public class FFmpegOutputTest {
public void onlyOutput() {
FFmpegOutput ffmpegOutput = new FFmpegOutput("oTest.mp4");
assertEquals("\"oTest.mp4\"", ffmpegOutput.buildCommand());
assertEquals(Arrays.asList("oTest.mp4"), ffmpegOutput.buildCommand());
}
@ -63,11 +65,11 @@ public class FFmpegOutputTest {
ffmpegOutput.setSubtitleCodec(FFmpegConstants.FFmpegSubtitleCodec.subrip);
ffmpegOutput.setSubtitleEnabled(false);
assertEquals("-ss 9.1 -to 20.1 -t 10.1 -fs 1000 -pass 2" +
" -codec:v libx264 -frames 29.8 -filter:v scale=320:240 -b:v 300000 -qscale:v 22" +
" -codec:a libmp3lame -ar 48000 -ac 6 -b:a 360000 -qscale:a 23 -an" +
" -codec:s subrip -sn" +
" \"oTest.mp4\"",
assertEquals(Arrays.asList("-ss", "9.1", "-to", "20.1", "-t", "10.1", "-fs", "1000", "-pass", "2",
"-codec:v", "libx264", "-frames", "29.8", "-filter:v", "scale=320:240", "-b:v", "300000", "-qscale:v", "22",
"-codec:a", "libmp3lame", "-ar", "48000", "-ac", "6", "-b:a", "360000", "-qscale:a", "23", "-an",
"-codec:s", "subrip", "-sn",
"oTest.mp4"),
ffmpegOutput.buildCommand());
}

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Ziver Koc
* Copyright (c) 2021-2025 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -27,6 +27,8 @@ package zutil.osal.app.ffmpeg;
import org.junit.Test;
import zutil.osal.app.ffmpeg.FFmpegConstants.*;
import java.util.Arrays;
import static org.junit.Assert.*;
@ -38,7 +40,7 @@ public class FFmpegTest {
ffmpeg.addInput(new FFmpegInput("iTest.mp4"));
ffmpeg.addOutput(new FFmpegOutput("oTest.mp4"));
assertEquals("ffmpeg -i \"iTest.mp4\" \"oTest.mp4\"", ffmpeg.buildCommand());
assertEquals(Arrays.asList("-i", "iTest.mp4", "oTest.mp4"), ffmpeg.buildCommand());
}
@Test
@ -48,7 +50,7 @@ public class FFmpegTest {
ffmpeg.addInput(new FFmpegInput("iTest.mp4"));
ffmpeg.addOutput(new FFmpegOutput("oTest.mp4"));
assertEquals("ffmpeg -loglevel error -i \"iTest.mp4\" \"oTest.mp4\"", ffmpeg.buildCommand());
assertEquals(Arrays.asList("-loglevel", "error", "-i", "iTest.mp4", "oTest.mp4"), ffmpeg.buildCommand());
}
@Test
@ -58,6 +60,6 @@ public class FFmpegTest {
ffmpeg.addInput(new FFmpegInput("iTest.mp4"));
ffmpeg.addOutput(new FFmpegOutput("oTest.mp4"));
assertEquals("ffmpeg -y -i \"iTest.mp4\" \"oTest.mp4\"", ffmpeg.buildCommand());
assertEquals(Arrays.asList("-y", "-i", "iTest.mp4", "oTest.mp4"), ffmpeg.buildCommand());
}
}