Phonon used in Qt Project - Custom QIODevice to support encrypted files

Jan Kohlhaas kohlhaas at lyth.de
Tue Nov 27 08:44:09 GMT 2012


Hello everybody,

I want to integrate Audio and Video support in my Qt-application using 
the Phonon framework. I'm handling protected data (mp3, avi etc.). 
Therefore I'm writing those files encrypted to the filesystem.

To avoid loading a whole video in the buffer I subclassed QIODevice and 
provided a custom IODevice which decrypts the encrypted content 
'on-the-fly' when Phonon asks for more bytes. (function readData)
I'm initializing the MediaSource using this custom IODevice.

Encryption/Decryption works fine, no problems. Now I tried to play 
different video types (Audio: mp3 is working) with my Phonon-Player.
AVI: working
WMV: not working

Now under 
"doc.qt.digia.com/main-snapshot/phonon-mediasource.html#MediaSource-6" I 
noticed the following sentence:

"Warning: On Windows, we only support QIODevices containing the avi, 
mp3, or mpg formats. Use the constructor that takes a file name to open 
files (the Qt backend does not use a QFile internally)."

Is there any way to avoid this restrictions and to extend this 
functionality? Unfortunalety I definitely have to use encrypted files. 
And perhaps can tell me somebody what's the reason behind this? Using 
usual (not encrypted) files without the custom IODevice there is no 
problem playing video files containing other formats like WMV or (with 
the right codecs) MP4.

Thanks in advance :)

Jan



More information about the kde-multimedia mailing list