Phonon: Move disk access off the main thread
-
Hi,
I am writing a "digital signage" application that needs to run on Windows, Mac OS X and (maybe/later) Linux. The app displays various kinds of media in multiple zones on the screen. For example; A slideshow of images on the left side, videos on the right side and a text ticker on the bottom. The tricky part is, as one would expect ;), the ticker. I'm using QPropertyAnimation to animate the "pos" of a QLabel.
This works fine until a new file gets loaded for the slide show or the video. AFAIK the QPropertyAnimation uses a QTimeLine or some other kind of timer that fires every 40 ms to achieve a decent framerate. Accessing the disk usually takes longer than 40 ms, which results in the ticker pausing.
Since I can't put the ticker on another thread, I need to move the disk access off the main thread. To easily try different approaches, I've created a small test app that only contains the relevant parts. The code is available here: "http://bitbucket.org/haikoschol/tickertest":http://bitbucket.org/haikoschol/tickertest
For images I've found a solution that works without taking up too much memory (as did simply caching all images); "http://bitbucket.org/haikoschol/tickertest/src/eb800a2c7474/imagecache.cpp":http://bitbucket.org/haikoschol/tickertest/src/eb800a2c7474/imagecache.cpp
I'm sure this could be improved, but it works. Since videos can get really large, I can't do the same thing there. So I tried to at least create a MediaSource object in advance, in the hope of saving the disk seek time. This doesn't seem to make a difference, though. I considered subclassing QIODevice to buffer parts of the file on a thread, but then I found this in the docs: "Warning: On Windows, we only support QIODevices containing the avi, mp3, or mpg formats."
Any ideas what else I could try?
edit: fixed links
-
I haven't looked into 4.7, yet. Will do that now. Thanks for the hint.