简体   繁体   English

LibVLCSharp 如何确定应用程序需要哪些 DLL?

[英]LibVLCSharp How To Determine Which DLLs Are Required By An Application?

I am using LibVLCSharp to play an RTSP stream in my Winforms application.我正在使用 LibVLCSharp 在我的 Winforms 应用程序中播放 RTSP stream。 The library is great and everything is working fine.图书馆很棒,一切正常。 However, my ram usage of the application jumped from around 20-30MB to around 140MB, In addition, I have to include about 140MB worth of DLL files with my application.但是,我的应用程序的 ram 使用量从大约 20-30MB 跃升至大约 140MB,此外,我必须在我的应用程序中包含大约 140MB 的 DLL 个文件。 despite the executable being 2MB!尽管可执行文件是 2MB! The library right now is bascailly the whold VLC media player application bundled with my app.现在的库基本上是与我的应用程序捆绑在一起的整个 VLC 媒体播放器应用程序。

I only use very limited capabilites of the library (only streaming from an RTSP URL and displaying it in a form, without even and playback capabilities), so I figured there must be a way to include the required DLLs for my app with the program.我只使用了非常有限的库功能(仅从 RTSP URL 流式传输并以一种形式显示,没有播放功能),所以我认为必须有一种方法可以将我的应用程序所需的 DLL 包含在程序中。

Testing my theroy, I tried to randomly remove some DLLs from the libVLC directory.测试我的理论,我试图从 libVLC 目录中随机删除一些 DLL。 By some guessing and trial and error, I was actually able to remove ~20MB from the library and the stream worked just fine.通过一些猜测和反复试验,我实际上能够从库中删除 ~20MB,stream 工作得很好。 For example, by removing the DLLs under audio directory, the stream worked well but had no audio (which I don't need in my case).例如,通过删除音频目录下的 DLL,stream 运行良好但没有音频(在我的情况下不需要)。 Unfortunately, there is still about ~120MB of DLLs.不幸的是,仍然有大约 120MB 的 DLL。

I tried searching how to only include the DLLs required by the used features, or how to determine such DLLs such that the rest can be deleted, but I couldn't find any solution.我尝试搜索如何只包含所用功能所需的 DLL,或者如何确定此类 DLL 以便可以删除 rest,但我找不到任何解决方案。

A similar unanswered question here on stackoverflow: Libvlc - minimal files (functions) set for streaming out关于 stackoverflow 的一个类似未回答的问题: Libvlc - minimal files (functions) set for streaming out

There is no such guidelines because it really depends on what you are trying to do with your app.没有这样的指导方针,因为它真的取决于你想用你的应用程序做什么。 For example, libavcodec is needed in 99% of the builds, but whether you need the D3D9 plugin depends on the machines on which you will install the app.例如,99% 的构建都需要 libavcodec,但您是否需要 D3D9 插件取决于您将安装该应用程序的机器。

Once you have determined what to exclude, you may use exclusion lists in your csproj, like this:确定要排除的内容后,您可以在 csproj 中使用排除列表,如下所示:

<ItemGroup>
  <!-- You can exclude plugin-by-plugin: -->
  <VlcWindowsX64ExcludeFiles Include="plugins\gui\libqt_plugin.dll" />

  <!-- You can exclude a whole folder. Notice how the wildcard is mandatory when doing exclude on folders -->
  <VlcWindowsX64ExcludeFiles Include="plugins\lua\%2A" />

  <!-- You can exclude with wildcards -->
  <VlcWindowsX64ExcludeFiles Include="plugins\%2A\%2Adummy%2A" />

  <!-- You can exclude the same files for Windows x86 -->
  <VlcWindowsX86ExcludeFiles Include="@(VlcWindowsX64ExcludeFiles)" />
</ItemGroup>

If you want to only include the plugins you selected, you can do it that way instead:如果你只想包含你选择的插件,你可以这样做:

<ItemGroup>
  <!-- Includes the codec folder. Notice how the wildcard is mandatory when doing include on folders -->
  <VlcWindowsX64IncludeFiles Include="plugins\codec\%2A" />

  <!-- You can include plugin-by-plugin -->
  <VlcWindowsX64IncludeFiles Include="plugins\audio_output\libdirectsound_plugin.dll" />

  <!-- You can include with wildcards all in d3d9/d3d11 -->
  <VlcWindowsX64IncludeFiles Include="plugins\d3d%2A\%2A" />

  <!-- You can still exclude things from what you have included -->
  <VlcWindowsX64IncludeFiles Include="plugins\codec\libddummy_plugin.dll" />

  <!-- You can include the same files for Windows x86 -->
  <VlcWindowsX86IncludeFiles Include="@(VlcWindowsX64IncludeFiles)" />
</ItemGroup>

Please see the full documentation here: https://code.videolan.org/videolan/libvlc-nuget/-/blob/master/cherry-picking.md请在此处查看完整文档: https://code.videolan.org/videolan/libvlc-nuget/-/blob/master/cherry-picking.md

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

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