使用 DirectShowLib 的特定编解码器或 ffdshow 文件夹?
我在 C# 应用程序中使用 DirectShowLib 来允许视频播放。不幸的是,并非所有系统都提供像样的视频编解码器,因此我选择安装 FFDShow 作为安装的一部分。不幸的是,这似乎对某些用户不起作用,因为他们要么已经安装了多个视频编解码器包,要么正在使用旧版本。或者,例如,Windows 7 不再需要它。
当我前段时间玩 libvlc 时,他们允许我指定所有支持的视频编解码器的插件路径,但不幸的是我似乎找不到与 DirectShowLib 类似的东西。
有没有一种方法可以将所需的编解码器库打包为我的应用程序的一部分并指向该文件夹,或者将 FFDShow 安装到特定文件夹中并引用该文件夹?
I am using DirectShowLib in a C# application to allow video playback. Unfortunately, not all systems provide a decent video codec so I opted to install FFDShow as part of my installation. Unfortunately this doesn't seem to work for certain users since they either already have several video codec packs installed or are using old versions. Or, for example, Windows 7 does no longer require it.
When I played with libvlc some time ago they allowed me to specify the plugin path with all the supported video codecs, but unfortunately I cannot seem to find something similar with DirectShowLib.
Is there a way to either pack the required codec libraries as part of my application and point to that folder, or install FFDShow into a specific folder and reference that one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以采取的一种可能的方法是使用免注册 COM。您可以在清单文件中指定您正在使用一组特定的子组件(例如包含 FFDShow 组件的子目录)。您还需要在该子目录中创建 DLL 的清单。主要问题是您必须从 C# 实例化您的对象,类似于:
一旦您拥有过滤器,您就可以将其添加到图表中、转换到其他接口或您想要执行的任何其他操作。
为了帮助创建 FFDShow 组件的清单文件,您可以使用 regsvr42 (此答案中进行了描述:为注册免费 COM 生成清单文件
我已经成功地使用它来使用 DirectShow 过滤器,而无需注册它们。要记住的一件事是 COM 文件必须与您的应用程序位于同一目录或子目录中。它们在相邻目录中将不起作用。
One possible approach you could take is to use registration free COM. You would sepcify in your manifest file that you are using a particular group of subcomponents (such as a subdirectory containing FFDShow components). You would also need to create a manifest for the DLL's in that subdirectory. The main gotcha is you have to instantiate your objects from C# similar to this:
Once you have the filter, you can then add it to your graph, cast to other interfaces, or whatever else you want to do.
To help create the manifest file for FFDShow components, you can use regsvr42 (described in this answer: Generate Manifest Files for Registration Free COM
I have successfully used this to use DirectShow filters without registering them. One thing to keep in mind is the COM files must be in the same directory as your application or a subdirectory. Having them in a neighboring directory will not work.