如何在 EXE 中直接嵌入 DirectShow Push Source 过滤器?
我有一个 Delphi 6 程序,它通过套接字从外部程序接收音频。现在,我想将该音频提供给我创建的 DirectShow 过滤器图表,该过滤器将该音频路由到 PC 上的不同输出过滤器。我正在使用 DSPACK 进行 DirectShow 过滤图工作。我将使用展示如何创建推送源过滤器的 DSPACK 示例之一作为我的起点。
是否可以将 DirectShow 过滤器直接嵌入到我的主 EXE 中,或者我是否必须创建外部 DLL 或 AX 文件并在其上运行 regsvr32?我想避免创建外部模块,否则我必须在它和我的主程序之间创建一个参数和数据传递桥,我宁愿消除这项工作。我想知道是否有一种方法可以简单地将推送源过滤器代码包含在我的主程序中,并巧妙地 Windows 将其作为 DirectShow 过滤器使用(如果可能的话)。
I have a Delphi 6 program that receives audio from an external program via a socket. Now I want to feed that audio to a DirectShow filter graph I create that routes that audio to different output filters on the PC. I am using DSPACK for my DirectShow filter graph work. I'll be using one of the DSPACK examples that shows how to create a Push Source Filter as my starting point.
Is it possible to embed a DirectShow filter directly into my main EXE, or do I have to create an external DLL or AX file and run regsvr32 on it? I'd like to avoid creating an external module otherwise I'll have to create a parameter and data passing bridge between it and my main program and I'd prefer to eliminate that work. I'm wondering if there is a way to simply include the push source filter code in my main program and finesse Windows into working with it as a DirectShow filter if that is at all possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
过滤器不必放入库 (DLL) 中,甚至不必是注册的 COM 对象,不是。如前所述,这样做的唯一原因是通过 CoCreateInstance 和/或通过 DirectShow 类别的枚举使过滤器可供应用程序使用。
直接放入您的应用程序中,它必须实现
IBaseFilter
并且您将IFilterGraph::AddFilter
将其添加到图中。私有过滤器的一个优点是,您不需要通过 COM 接口实现应用程序和过滤器之间的通信,并且可以使用本机/直接指针。另请参阅 Geraint 的帖子无需注册即可使用过滤器。
Filters don't have to be put into libraries (DLL), and they don't have to be even registered COM objects, no. As mentioned, the only reason to make this, is to make the filter available to applications through CoCreateInstance and/or through enumeration of DirectShow categories.
Being put into your application directly, it has to implement
IBaseFilter
and you willIFilterGraph::AddFilter
it into the graph. An advantage of having filter privately, is that you don't need to implement communication between application and filter through COM interface, and you can use native/direct pointers.See also Geraint's post Using Filters Without Registration.
我认为将过滤器放入 DLL 中的唯一原因是能够在多个程序中使用它们。另一方面,如果您要将过滤器放入 DLL 中,则始终可以让它们实现您在需要时可以使用的接口。
在我的工作中,我必须播放存储在专有存档文件中的电影。我制作了一个源,它有一个输出引脚,可以正确描述其媒体格式,如果我愿意,其余部分会自动工作。我还需要为视频使用专有的渲染器。所有这些东西都内置在用 C++ 编写的 .exe 中
I think the only reason to put your filters in a DLL is to be able to use them in multiple programs. On the other hand, if you were to put your filters into a DLL you could always have them implement an inferface that you QI for when you need it.
In my work, I had to play movies that were stored within a proprietary archive file. I made a source that had an output pin that described its media format properly, and the rest worked automatically, if I wanted it to. I also needed to use a proprietary renderer for the video. All this stuff was built into the .exe which was written in C++