* maybe fix libmediainfo library loading issues

This commit is contained in:
Reinhard Pointner 2015-11-09 08:07:00 +00:00
parent 77674a1486
commit b9f9ae2b34
2 changed files with 5 additions and 14 deletions

View File

@ -13,26 +13,12 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.sun.jna.NativeLibrary;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;
import com.sun.jna.WString;
public class MediaInfo implements Closeable {
static {
try {
// libmediainfo for linux depends on libzen
if (Platform.isLinux()) {
// We need to load dependencies first, because we know where our native libs are (e.g. Java Web Start Cache).
// If we do not, the system will look for dependencies, but only in the library path.
NativeLibrary.getInstance("zen");
}
} catch (Throwable e) {
// Logger.getLogger(MediaInfo.class.getName()).log(Level.WARNING, "Failed to load libzen");
}
}
private Pointer handle;
public MediaInfo() {

View File

@ -8,11 +8,16 @@ import com.sun.jna.FunctionMapper;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;
import com.sun.jna.WString;
interface MediaInfoLibrary extends Library {
// libmediainfo for linux depends on libzen, so we need to load dependencies first, because we know where our native libs are (e.g. Java Web Start Cache).
// if we do not, the system will look for dependencies, but only in the library path
Library LIB_ZEN = Platform.isLinux() ? (Library) Native.loadLibrary("zen", Library.class) : null;
MediaInfoLibrary INSTANCE = (MediaInfoLibrary) Native.loadLibrary("mediainfo", MediaInfoLibrary.class, singletonMap(OPTION_FUNCTION_MAPPER, new FunctionMapper() {
@Override