如何在XPCOM组件中实现定时器?

发布于 2024-08-21 13:15:40 字数 299 浏览 3 评论 0原文

我正在创建一个基于 XULRunner 的 GStreamer 应用程序。为了实现这一目标,创建了一个 XPCOM 组件,该组件使一些 GStreamer 功能在 XUL 应用程序中可用。然而,GStreamer 通常使用消息循环 (GMainLoop),使人能够接收总线消息。因为 XULRunner 已经有自己的消息循环,所以我无法创建 GMainLoop。所以我需要另一种方式来获取这些消息。一种方法是使用 gst_bus_poll 调用。我需要经常调用它以防止消息队列被淹没。所以我认为计时器是正确的解决方案。

长话短说:如何在 XPCOM 组件中创建计时器?

I'm creating a GStreamer application based on XULRunner. To achieve this created an XPCOM component that makes some of the GStreamer functionality available in a XUL application. However, GStreamer normally makes use of a message loop (GMainLoop) which enables one to receive bus messages. Because XULRunner already has its own message loop I can't create a GMainLoop. So I need another way of getting those messages. One way is to use the gst_bus_poll call. I would need to call it frequently to prevent the message queue from being flooded. So I'm thinking that a timer is the correct solution here.

To make a long story short: how do I create a timer in an XPCOM component?

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

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

发布评论

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

评论(1

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