views:

105

answers:

1

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?

+1  A: 

Take a look at nsITimer.

And you might be interested in the code in this bug about implementing a GStreamer backend for <video>.

Nickolay
I've been experimenting a little and ended up with implementing the timer at the Javascript side (setTimeout).Concerning the GStreamer backend for html video. It seems interesting, but I can't seem to find the actual source file in the Mozilla source directory (a/content/html/content/public/nsHTMLMediaElement.h). I'm probably looking in the wrong place.Btw, currently my code is inspired from the Songbird sources. It works fairly well on Windows and Mac. But occasionally the app becomes non-responsive (usually while also playing video in another app or youtube).
StackedCrooked
@StackedCrooked: http://mxr.mozilla.org/mozilla-central/source/content/html/content/public/nsHTMLMediaElement.h . The "a/" thing is just the way diffs often are with DVCS.
Nickolay