增加打包支持

This commit is contained in:
sulv 2024-10-11 20:44:32 +08:00
parent 683db93689
commit 7f75b8f0ba
11 changed files with 40 additions and 3 deletions

View File

@ -3,5 +3,6 @@
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources/lib/win" charset="UTF-8" />
</component>
</project>

31
pom.xml
View File

@ -47,5 +47,36 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<mainClass>com.ly.VideoInferenceApp</mainClass> <!-- 将MainClass替换为你的主类 -->
</manifest>
</archive>
</configuration>
</plugin>
<!-- 使用maven-shade-plugin来打包所有依赖 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -15,6 +15,9 @@ import org.opencv.videoio.Videoio;
import javax.swing.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@ -33,12 +36,14 @@ public class VideoPlayer {
String OS = System.getProperty("os.name").toLowerCase();
if (OS.contains("win")) {
// 使用发布版 FFmpeg DLL
System.load(ClassLoader.getSystemResource("lib/win/opencv_videoio_ffmpeg470_64.dll").getPath());
// 如果需要调试版取消注释以下行
// System.load(ClassLoader.getSystemResource("lib/win/opencv_videoio_ffmpeg470_64d.dll").getPath());
System.load(System.getProperty("user.dir") + "\\lib\\win\\opencv_videoio_ffmpeg470_64.dll");
}
}
private VideoCapture videoCapture;
private volatile boolean isPlaying = false;
private volatile boolean isPaused = false;

View File

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 147 KiB