简体   繁体   English

如何使用/安装自定义Directshow过滤器

[英]How to use/install custom Directshow filter

我有自定义编译的directshow过滤器 - filter.DLL - 但如何使用,或在系统中安装此过滤器?

Usually you register the directshow filter into system by calling (from an elevated command prompt window on windows vista/7) regsvr32 filter.dll . 通常,您通过调用(从windows vista / 7上的提升的命令提示符窗口) regsvr32 filter.dll将directshow过滤器注册到系统中。

After the registration process you can use your filter with a directshow graph viewing application: 注册过程结束后,您可以使用带有directshow图表查看应用程序的过滤器:

  • GraphEdit (graphedt.exe), installed by Windows SDK (ex. "c:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\bin\\graphedt.exe" ) 由Windows SDK安装的GraphEdit(graphedt.exe)(例如“c:\\ Program Files \\ Microsoft SDKs \\ Windows \\ v6.0A \\ bin \\ graphedt.exe”)
  • GraphStudio GraphStudio

After testing your filter with the above programs you can use it in a C++/C# client application. 使用上述程序测试过滤器后,可以在C ++ / C#客户端应用程序中使用它。

The main way would be to register the filter file with regsvr32 filter.dll and than create the filter with it's CLSID in your application. 主要方法是使用regsvr32 filter.dll注册过滤器文件,然后在应用程序中使用它的CLSID创建过滤器。

If the filter are in the same codebase as the application, you can just create the filter with new and use it. 如果过滤器与应用程序位于相同的代码库中,则只需使用new创建过滤器并使用它。

I prefer to load the filter.dll with CoLoadLibrary to get the IClassFactory of the filter and create the filter. 我更喜欢使用CoLoadLibrary加载CoLoadLibrary以获取过滤器的IClassFactory并创建过滤器。 You can test this with GraphStudioNext . 您可以使用GraphStudioNext进行测试。 You can find sample source code to load a filter this way here . 您可以在此处找到以这种方式加载过滤器的示例源代码。

Like Cristian said, people typically register the filter on the system. 像Cristian所说,人们通常在系统上注册过滤器。 But I prefer not to do this for a few reasons . 但出于某些原因,我不愿意这样做。 In particular, see the section on "Registering Filters with the Operating System." 特别是,请参阅“使用操作系统注册过滤器”一节。

I think nine times out of ten, you're better off instantiating with new. 我认为十分之九,你最好用新的实例化。 See AppFilter on Geraint Davis' page for an example. 有关示例,请参阅Geraint Davis页面上的AppFilter

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

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