如果过滤器具有持久性本地数据,我是否需要为每个 DirectShow 过滤器实例提供唯一的类 ID?

发布于 2024-12-13 01:57:27 字数 516 浏览 1 评论 0原文

我已经编写了一个推送源过滤器,我在 Delphi 6 应用程序中私下使用它。该应用程序使用DSPACK DirectShow 组件库。我私下的意思是,我只是将过滤器的实例直接添加到我的过滤器图表中,而不是将过滤器驻留在外部 DLL(.ax 文件)中。

我应该为我创建的过滤器的每个实例创建一个唯一的类 ID (GUID),还是在创建的所有实例之间使用相同的类 ID 是否安全?我对此感到担心,因为过滤器的每个实例都会创建一个本地数据存储对象,用于保存为过滤器排队的数据。本地数据存储对象由主机应用程序内的其他代码写入,从而通过我的推送源过滤器将数据推送到过滤器图表中。

我现在对 DirectShow 的了解还不够,不知道如何进行方法指针查找来了解我的设计是否安全。当我直接将 Filter 的实例添加到图表中时,DirectShow 是否存储 Filter Graph 将通过对象引用或类 ID 调用的接口方法指针?如果是前者,那么一切都会好起来,但如果是后者,那么如果同一个实例获得所有方法调用,那么这可能会出现问题。有谁知道这个设计问题的答案吗?

I have written a push source filter that I use privately in my Delphi 6 application. The application uses the DSPACK DirectShow component library. By privately I mean I simply add instances of the filter directly to my Filter Graph, instead of the filter residing in an external DLL (.ax file).

Should I create a unique class ID (GUID) for each instance of the Filter I create, or is it safe to use the same class ID between all instances created? I am concerned about this because each instance of the Filter creates a local data storage object for holding data queued for the Filter. The local data storage object is written to by other code within the host application thereby pushing data into into the Filter Graph via my push source filter .

I don't now enough about DirectShow to know how method pointers lookups are done to know if my design is safe. When I add an instance of a Filter to a graph directly, does DirectShow store the interface method pointers the Filter Graph will call by object reference, or by the class ID? If it's the former then everything will be fine, but if it's the latter, then that could be a problem if the same instance gets all the method calls. Does anyone know the answer to this design question?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等风也等你 2024-12-20 01:57:27

类标识符特定于类,而不是类实例。您的过滤器类应该有自己的唯一标识符,并且该类的所有实例都将在运行时共享它。如果您从另一个项目复制代码,则需要确保将所有现有的 CLSID、IID、LIBID 标识符替换为新生成的标识符。

Class identifier is specific to a class, not to class instance. Your filter class should have its own unique identifier, and all instances of the class would share it on runtime. If you are copying code from another project, you need to make sure you replace all existing CLSID, IID, LIBID identifiers with newly generated ones.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文