Write a better native library loader so DLLs are no longer extracted to the current directory on Windows.

This commit is contained in:
Cameron Gutman
2013-12-28 16:56:38 -05:00
parent bb90e182d4
commit fe92144e43
4 changed files with 139 additions and 61 deletions

View File

@@ -37,15 +37,7 @@ public class SwingCpuDecoderRenderer implements VideoDecoderRenderer {
// Single threaded low latency decode is ideal
int avcFlags = AvcDecoder.LOW_LATENCY_DECODE;
int threadCount = 1;
// Hack to work around the bad Java native library loader
// which can't resolve native library dependencies
if (System.getProperty("os.name").contains("Windows")) {
System.loadLibrary("avutil-52");
System.loadLibrary("postproc-52");
System.loadLibrary("pthreadVC2");
}
int err = AvcDecoder.init(width, height, avcFlags, threadCount);
if (err != 0) {
throw new IllegalStateException("AVC decoder initialization failure: "+err);