PDA

View Full Version : Phonon - Custom QIODevice to support encrypted files



hunsrus
26th November 2012, 17:45
Hello,

I want to integrate Audio and Video support in my 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)

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.

Greetings

anda_skoa
26th November 2012, 19:19
The native backend is most likely implemented using some Windows framework for multimedia data and maybe that wants to operate on files.

You could try using a different Phonon backend, e.g. the VLC or GStreamer backend, it should be possible to build those for Windows as well.

If you need more detailed help, I suggest to subscribe to this mailing list https://mail.kde.org/mailman/listinfo/kde-multimedia
This is where the Phonon developers "hang out"

Cheers,
_

wysota
26th November 2012, 20:15
Hello,

I want to integrate Audio and Video support in my 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)

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.

Greetings

If all elses fail you can try implementing a pipe that you will feed with the decrypted data and then read the data from it using regular Phonon API. Note that you need to find a way to make sure nothing but your application can read from the pipe.

hunsrus
27th November 2012, 11:40
Thanks for your replies!
I posted to the mailing list.
Furthermore I'll try to change the backend although I don't think this is the problem.
Wysotas approach is very interesting, if everything else fails I'll give it try.
Nevertheless thanks for your help, great forum!