0
votes

I am working on a project to create a secure video player. I would like to achieve video encryption on the fly while using QMediaPlayer class . Can somebody please help me achieve this ? Is writing the decrypted data to QIOdevice and reading from QIODevice the right way ? If so can I get an example implementation ?

Thanks in advance

1

1 Answers

1
votes

Yes, this is one of possible ways. An example would be:

  • Subclass QIODevice and reimplement readData()
  • In your reimplementation you read the encrypted data, decrypt it and return it
  • You pass your QIODevice-based object to QMediaPlayer.

If you want the player to be able to seek, you need to implement QIODevice::IsSequential() (return false) and implement seek/pos. If your encryption is byte-to-byte (i.e. you're not packing/padding the content) this should be a fairly simple implementation.

Another approach would be to use QAudioDecoder + QAudioOutput. This will allow you to perform tricks like encrypting the raw PCM first and then encoding it.