-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add ffmpeg and javacv dependencies
- Loading branch information
li-guohao
committed
Sep 6, 2023
1 parent
f79b608
commit 8c27f92
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
server/src/test/java/run/ikaros/server/ffmpeg/FfmpegTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package run.ikaros.server.ffmpeg; | ||
|
||
import static org.bytedeco.ffmpeg.global.avformat.av_dump_format; | ||
import static org.bytedeco.ffmpeg.global.avformat.avformat_close_input; | ||
import static org.bytedeco.ffmpeg.global.avformat.avformat_find_stream_info; | ||
import static org.bytedeco.ffmpeg.global.avformat.avformat_open_input; | ||
import static org.bytedeco.ffmpeg.global.avutil.av_strerror; | ||
|
||
import org.bytedeco.ffmpeg.avformat.AVFormatContext; | ||
import org.bytedeco.javacpp.BytePointer; | ||
import org.bytedeco.javacpp.PointerPointer; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class FfmpegTest { | ||
|
||
static void check(int err) { | ||
if (err < 0) { | ||
BytePointer e = new BytePointer(512); | ||
av_strerror(err, e, 512); | ||
throw new RuntimeException( | ||
e.getString().substring(0, (int) BytePointer.strlen(e)) + ":" + err); | ||
} | ||
} | ||
|
||
@Test | ||
@Disabled | ||
void getVideoInfo() { | ||
String fileName = System.getenv("IKAROS_FFMPEG_TEST_VIDEO_URL"); | ||
AVFormatContext inputFormatContext = new AVFormatContext(null); | ||
try { | ||
check(avformat_open_input(inputFormatContext, fileName, null, null)); | ||
check(avformat_find_stream_info(inputFormatContext, (PointerPointer) null)); | ||
av_dump_format(inputFormatContext, 0, fileName, 0); | ||
} finally { | ||
avformat_close_input(inputFormatContext); | ||
} | ||
} | ||
|
||
|
||
} |