c# - 如何在树莓派上使用 VLC.DotNet.Core API
问题描述
我制作了一个使用 mono ( mcs
) 编译的 C# 控制台应用程序,我可以在 Windows 和 Raspberry Pi (raspbian) 上运行它。该应用程序使用 NuGet 包Vlc.DotNet.Core
与我的 Windows 机器上存在的 VLC 安装进行交互,这很有效。
我知道我的 Windows 机器上的路径libvlc.dll
(api 需要它才能工作),问题是我无法在 Raspberry Pi 上找到它,即使在apt-get install vlc
.
我在 Pi 中搜索了 vlc 的位置,并将该路径输入到构造函数中VlcMediaPlayer
,如下所示;
new VlcMediaPlayer(new DirectoryInfo("/usr/lib/arm-linux-gnueabihf/vlc"));
我对我使用了正确的路径几乎没有信心......显然,VLC 的 Windows 安装和 Raspbian 的安装之间存在重大差异。
在 Pi 上产生的异常显示为:
Unhandled Exception:
System.IO.FileNotFoundException: Unable to find the specified file.
at Vlc.DotNet.Core.Interops.VlcLibraryLoader..ctor (System.IO.DirectoryInfo dynamicLinkLibrariesPath) [0x0007a] in <baf298be89ec4e8f88b59dde806086ea>:0
at Vlc.DotNet.Core.Interops.VlcLibraryLoader.GetOrCreateLoader (System.IO.DirectoryInfo dynamicLinkLibrariesPath) [0x00051] in <baf298be89ec4e8f88b59dde806086ea>:0
at Vlc.DotNet.Core.Interops.VlcManager..ctor (System.IO.DirectoryInfo dynamicLinkLibrariesPath, System.String[] args) [0x00006] in <baf298be89ec4e8f88b59dde806086ea>:0
at Vlc.DotNet.Core.VlcMediaPlayer..ctor (System.IO.DirectoryInfo vlcLibDirectory) [0x00000] in <9af967e78de14038abf8c3386a2b8049>:0
at MonoApp.Classes.VLCFactory.Create () [0x0000b] in <0b03f50fed2542db8a444bf356ef64b6>:0
at MonoApp.Classes.VLCCommands.VLCCommand_Play.Execute (Vlc.DotNet.Core.VlcMediaPlayer& mediaPlayer, System.String[] args) [0x00007] in <0b03f50fed2542db8a444bf356ef64b6>:0
at MonoApp.Program.Main (System.String[] args) [0x00019] in <0b03f50fed2542db8a444bf356ef64b6>:0
编辑:
我在这里找到了 VlcLibraryLoader 类的源文件(如异常所示),显然它正在寻找三个 dll,其中只有两个存在于 Windows 上,所以我猜测链接的源文件有点过时了。这里的重点是他们正在寻找.dll
文件,而不是.so
Raspberry Pi 上存在的文件,所以我对它失败并不感到惊讶。然而,问题仍然存在……
问题:
- 我是否使用了正确的 vlc 包
libvlc-dev
,我还需要其他依赖项吗? - 是否
Vlc.DotNet.Core
已知 API 可以与之合作Raspbian
,mono
或者我是否走上了一条绝望的道路?
解决方案
我不知道 Vlc.DotNet.Core 是否可以在带有单声道的 raspbian 上工作。如您所知,它最初的目标是在 Windows 上工作。
不过,LibVLCSharp 可能适用于 raspbian,因为它适用于 ubuntu。
LibVLC/GTK linux 安装指南:https ://code.videolan.org/videolan/LibVLCSharp/blob/master/docs/linux-setup.md
LibVLCSharp.GTK 示例:https ://code.videolan.org/videolan/LibVLCSharp/tree/master/Samples/LibVLCSharp.GTK.Sample
祝你好运。
推荐阅读
- ios - 从声称 SDK 12.0 小于 SDK 11 的 xcode 提交 iOS 应用程序的问题
- sql - 示例中关于 Ignite RDD 查询的具体问题
- javascript - JavaScript 函数不覆盖变量
- javascript - 无法检索 Express JS 中的表单标签发布的文本数据
- ruby-on-rails - Ruby .map 哈希值到数组中的键值对
- sql - 混合使用日期时间和时间戳来清理字符串列
- c - lu 和 int 之间的算术似乎不正确
- powershell - 来自 Powershell 的 Robocopy 访问被拒绝错误 5
- android - 简单的 TextView 导致崩溃
- python - BeautifulSoup & Selenium - 异常后复制到我的电子表格的数据不正确