Qt contains great capabilities for video playback on android and is much nicer to handle than the Java Android SDK.
I am trying to play a video using QMediaPlayer and setting the output to a class derived from QAbstractVideoSurface.
By overriding the "present" method in QAbstractVideoSurface I can retrieve the frames, convert them to RGB and manipulate them as I want.
Unfortunately, the "present" method seems to be called asynchronously and in a non-blocking way.
Since my image manipulation routine takes some time, I lose a lot of frames. They simply get skipped. The MediaPlayer plays the video at normal speed and only calls the "present" method whenever the image manipulation routine is not busy.
I don't need the video to play in real time or be drawn anywhere, I am (ab)using the QMediaPlayer to get to the frames, playing the frames smoothly is not an issue, I just want to have all the frames without missing any.
Is there a way to make the "present" method blocking? Meaning that the MediaPlayer only plays a new frame if the "present" method has finished processing the previous frame.
Thank you in advance!
PS: Minimal example:
QMediaPlayer *player = new QMediaPlayer;
// DrawVideoSurface is derived from QAbstractVideoSurface
// and overrides the "present" method to perform image manipulation
DrawVideoSurface *processor = new DrawVideoSurface();