PDA

View Full Version : Map a QVideoFrame



maxilase
16th July 2015, 14:28
Hello Qt experts !

I am having some trouble using an external program (GStreamer1.0) running along with Qt (on windows 7).
I manage to get some frames out of a pipeline using the QImage type like this :

const QImage frame(bufferInfo.data,width,height,myQImageFrameFo rmat);

Now since Qt 5.5 is release, I would like to do the same but by mapping received frame into a QVideoFrame (since it seems to be the class dedicated to it).
However I'm having some trouble. The documentation says that normally I should be albe to map the "frame buffer" into memory in order to write into it using bits(); (http://doc.qt.io/qt-5/qvideoframe.html#map).

I did a few tries but it seems that the function map:
myVideoFrame->map(QAbstractVideoBuffer::ReadWrite); always give a "false" meaning (I guess) that the mapping into memory has failed.
I really dont know why I have this since the only actions I did on this video frame is

creating the frame
Adding metadata
setting the field type



I don't know if I am too early using this class since Qt5.5 just came out but I did not read anything about being cautious using QVideoFrame and I'm not finding any example on the web.
Thanks in advance for your help !

maxilase
17th July 2015, 11:21
Following up my problem I was finally able to map my QVideoFrame by using a local variable instead of a member one.

Now I am getting another problem, since I (normally) have my frame filled up, how do I display it ? One of my problem being that the QVideoFrame::PixelFormat seems not to exist for QImage or QPixmap (QVideoFrame::Format_RGB32).

I was hoping that I could use some kind of QVideoWidget or QMediaPlayer to display my frames but I dont see obvious way to do it...