简体   繁体   English

Vlcj本机发现在Raspberry Pi3 B +上失败

[英]Vlcj native discovery fails on Raspberry Pi3 B+

I have java code that needs to use the Vlcj library on a Raspberry Pi 3 B+ with Raspbian. 我有Java代码,需要在具有Raspbian的Raspberry Pi 3 B +上使用Vlcj库。 But when starting up with the NativeDiscovery.discover(), i get a "no vlc library found" message. 但是,当启动NativeDiscovery.discover()时,我收到“找不到vlc库”消息。 I have tried to use addSearchPath() on "/usr/bin/" with no success. 我尝试在“ / usr / bin /”上使用addSearchPath()失败。

How can I solve my issue? 我该如何解决我的问题? Thanks 谢谢

Your JVM needs to know where to find libvlc.so and the VLC plugins. 您的JVM需要知道在哪里可以找到libvlc.so和VLC插件。

They are not in "/usr/bin". 它们不在 “ / usr / bin”中。

There is more than one way to try and resolve this, the simplest perhaps is to use LD_LIBRARY_PATH. 有多种方法可以尝试解决此问题,最简单的方法也许是使用LD_LIBRARY_PATH。

Once you have found the directory containing libvlc.so, you can specify the LD_LIBRARY_PATH environment variable when you start your app. 找到包含libvlc.so的目录后,可以在启动应用程序时指定LD_LIBRARY_PATH环境变量。

On my Pi, libvlc.so is in /usr/lib/arm-linux-gnueabihf, so something like (the given jar files in the classpath are just examples): 在我的Pi上,libvlc.so位于/ usr / lib / arm-linux-gnueabihf中,因此类似(类路径中给定的jar文件只是示例):

LD_LIBRARY_PATH=/usr/lib/arm-linux-gnueabihf java -cp vlcj.jar:jna.jar:jna-platform.jar:your-app.jar

This might be enough to make it work, it might not. 这可能足以使其正常工作,但可能并非如此。 LibVlc might complain about not being able to find its plugins. LibVlc可能会抱怨无法找到其插件。

If so, find where the plugins are installed (there should be a directory named "plugins" under the directory where you found libvlc.so). 如果是这样,请找到插件的安装位置(在找到libvlc.so的目录下应该有一个名为“ plugins”的目录)。

On my Pi these are in /usr/lib/arm-linux-gnueabihf/vlc/plugins. 在我的Pi上,这些文件位于/ usr / lib / arm-linux-gnueabihf / vlc / plugins中。

Now you set the VLC_PLUGIN_PATH to point to that directory: 现在,您将VLC_PLUGIN_PATH设置为指向该目录:

LD_LIBRARY_PATH=/usr/lib/arm-linux-gnueabihf VLC_PLUGIN_PATH=/usr/lib/arm-linux-gnueabihf/vlc/plugins java -cp vlcj.jar:jna.jar:jna-platform.jar:your-app.jar

You can set those environment variables in your profile or whatever instead of specifying on the command line if you want. 您可以在配置文件中或其他内容中设置这些环境变量,而不需要在命令行中指定。

vlcj's native discovery mechanism generally tries to resolve all of this nastiness for you, but it doesn't (currently) know about Raspberry Pi so you have to do it yourself. vlcj的本机发现机制通常会尝试为您解决所有这些麻烦,但是(当前)它不了解Raspberry Pi,因此您必须自己做。

The next major version of vlcj (which will be 4.0.0) has an improved native discovery mechanism. vlcj的下一个主要版本(将为4.0.0)具有改进的本机发现机制。 I tested an early development version of this on my Pi and it just worked straight away without any of the above. 我在Pi上测试了该软件的早期开发版本,并且在没有以上任何条件的情况下就可以立即使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM