QT API changes from Qt 5 (5.12.11) to Qt 6 (6.4.0).
-
Hello Community,
I have an iPadOs application written in Qt 5.12.11, and it has used QVideoFrame API.
now since I have to migrate from Qt 5.12.11 to Qt 6.4.0, when I compile the application, I get error message as follows/Users/ronakjain/eye/ws640/app/vis.cpp:73:94: error: no member named 'Format_YV12' in 'QVideoFrame' QVideoFrame videoframe(y_size + uv_size*2, QSize(width, height), width, QVideoFrame::Format_YV12); ~~~~~~~~~~~~~^ /Users/ronakjain/eye/ws640/app/vis.cpp:74:24: error: incomplete type 'QAbstractVideoBuffer' named in nested name specifier videoframe.map(QAbstractVideoBuffer::WriteOnly); ^~~~~~~~~~~~~~~~~~~~~~ In file included from /Users/ronakjain/eye/ws640/app/vis.cpp:1: In file included from Focus/vis.h:5: In file included from ../../Qt/6.4.0/ios/include/QtMultimedia/QVideoFrame:1: ../../Qt/6.4.0/ios/include/QtMultimedia/qvideoframe.h:18:7: note: forward declaration of 'QAbstractVideoBuffer' class QAbstractVideoBuffer; ^ /Users/ronakjain/eye/ws640/app/vis.cpp:75:31: error: no matching member function for call to 'bits' auto dst = videoframe.bits(); ~~~~~~~~~~~^~~~ In file included from /Users/ronakjain/eye/ws640/app/vis.cpp:1: In file included from Focus/vis.h:5: In file included from ../../Qt/6.4.0/ios/include/QtMultimedia/QVideoFrame:1: ../../Qt/6.4.0/ios/include/QtMultimedia/qvideoframe.h:88:12: note: candidate function not viable: requires single argument 'plane', but no arguments were provided uchar *bits(int plane); ^ ../../Qt/6.4.0/ios/include/QtMultimedia/qvideoframe.h:89:18: note: candidate function not viable: requires single argument 'plane', but no arguments were provided const uchar *bits(int plane) const; ^ /Users/ronakjain/eye/ws640/app/vis.cpp:22:31: warning: implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int' [-Wshorten-64-to-32] int y_size = eye_data.size(); ~~~~~~ ~~~~~~~~~^~~~~~ 1 warning and 3 errors generated.
can anyone help me with how the QVideoFrame Object should be initiated with the parameters as per the new Qt API (Qt version 6.4.0)?
Note: I've already tried to go through docs and that seems to have constructors (check below link)
but I want to instantiate QVideoFrame Object with Frame Size, Frame Format, ...REFERENCES:
https://codebrowser.dev/qt6/qtmultimedia/src/multimedia/video/qvideoframe.h.htmlThanks
Ronak Jain. -
Hi @inkfil,
WriteOnly
has moved from QAbstractVideoBuffer::WriteOnly (Qt5) to QVideoFrame::WriteOnly (Qt6). So I guess:videoframe.map(QVideoFrame::WriteOnly);
Cheers.
-
@inkfil said in QT API changes from Qt 5 (5.12.11) to Qt 6 (6.4.0).:
/Users/ronakjain/eye/ws640/app/vis.cpp:74:24: error: incomplete type 'QAbstractVideoBuffer'
Include QAbstractVideoBuffer header file in vis.cpp
-
@jsulm said in QT API changes from Qt 5 (5.12.11) to Qt 6 (6.4.0).:
Include QAbstractVideoBuffer header file in vis.cpp
QAbstractVideoBuffer
was made private in Qt 6.4, so you can't include its header anymore.Give my earlier suggestion a try:
videoframe.map(QVideoFrame::WriteOnly);
Cheers.
-
videoframe.map(QVideoFrame::MapMode::WriteOnly);
this worked
but I also have other parameters that I need like Frame Format, ...can you please help me with that
-
@inkfil
At Qt6 all(?) enumerated types have been moved from from a "general, high-level" class/namespace --- likeQt::AlignLeft
orQVideoFrame::WriteOnly
--- down into a more "specific, low-level" class/namespace --- likeQt::AlignmentFlag::AlignLeft
orQVideoFrame::MapMode::WriteOnly
. You need to change all your code accordingly. There isn't a definitive list, you just have to find out and do it as necessary.In https://stackoverflow.com/questions/72086632/migrating-to-qt6-pyqt6-what-are-all-the-deprecated-short-form-names-in-qt5 and/or https://pypi.org/project/PyQtEnumConverter/ somebody wrote some kind of converter for Python/PyQt6 for this, maybe it will give you inspiration to understand what has changed.