MediaInfo icon indicating copy to clipboard operation
MediaInfo copied to clipboard

Mediainfo.dll and the latest JNA is not working

Open valib opened this issue 4 years ago • 8 comments

Using the JNA 5.7.0 returns empty strings for all requests made in Java. The JNA 5.6.0 works without any problem

valib avatar Feb 22 '21 22:02 valib

@JeromeMartinez do you have any idea what is wrong?

valib avatar Apr 02 '21 08:04 valib

I'm unable to reproduce this on Windows (JDK 16, JNA 5.7.0) using https://github.com/UniversalMediaServer/UniversalMediaServer/blob/master/src/main/java/net/pms/dlna/MediaInfo.java as wrapper.

g-maxime avatar Apr 02 '21 21:04 g-maxime

@g-maxime for me the latest working version of the JNA is 5.6.0. I have no idea how do you test it but maybe our implementation is wrong. Please check the file https://github.com/UniversalMediaServer/UniversalMediaServer/blob/master/src/main/java/net/pms/dlna/LibMediaInfoParser.java if you find what could be wrong. We use legacy formats whose could cause the problem.

valib avatar Apr 16 '21 23:04 valib

@g-maxime I localized the problem. The MediaInfo Count_Get(StreamKind, -1) for JNA 5.7+ returns always 0 but the Get(StreamKind, 0, "StreamCount") returns correct number or empty string if the StreamKind is missing. EDIT: what is funny the Count_Get(StreamKind, 0) returns 377 not the correct 1. The rest of the requests are working.

valib avatar Apr 27 '21 11:04 valib

The temporary fix is not using the Count_Get but use the Get(StreamKind, 0, "StreamCount") instead like I made in https://github.com/UniversalMediaServer/UniversalMediaServer/pull/2472 but it should be fixed in the MediaInfo otherwise the Count_Get is not usable for the JNA 5.7+.

valib avatar Apr 27 '21 21:04 valib

it should be fixed in the MediaInfo

Definitely, we'll check when we have a bit free time.

JeromeMartinez avatar May 09 '21 21:05 JeromeMartinez

Any news?

valib avatar Sep 08 '21 11:09 valib

I can also confirm the issue. The -1 somehow makes it always return 0 from the Java side. Different versions of jnidispatch.dll make it work / not work even if MediaInfo.dll is unchanged. Furthermore, the issue seems to be specific to Windows. The same JNA code works for Linux libmediainfo.so and macOS libmediainfo.dylib. No idea what's going on.

rednoah avatar Dec 21 '21 08:12 rednoah