* maybe fix libmediainfo library loading issues
This commit is contained in:
parent
77674a1486
commit
b9f9ae2b34
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue