Video Stream, extending QIODevice
Hello,
I keep videos in oracle in BFILE (actually a pointer to video). Then I can reach the video binary stream from BFILE, using BFILE's getBinaryStream() function.
What I want to do is play this video in Qt, VideoPlayer. I see that, MediaSource object can get QIODevice as argument, so I think I should extend QIODevice.
Is there any example that I can examine how to subclass QIODevice? First of all, which functions do I have to override? How to implement readData() espacially?
Thanks in advance ...
Re: Video Stream, extending QIODevice
You can convert you binary data in QByteArray then use a QBuffer as source of Phonon::MediaSource
Example
Code:
player->load(MediaSource(&buffer));
player->play();
Re: Video Stream, extending QIODevice
Thank you, I had tried that method, but it fails with 400mb vidoes. When I try with a 20 mb video, it plays the sound but there is no display.
Here is the code:
Code:
byte[] bytes = bfile.getBytes(1, (int)length);
source = new MediaSource(buffer);
player.play(source);
Even if this method works, it's still too slow since it needs all the video in memory before starting to play. That's why I need streaming. Thanks again for your interest...
Re: Video Stream, extending QIODevice
Is there any way to achieve streaming with/without QIODevice?