diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-10-11 11:51:14 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-10-31 09:49:49 +0100 |
commit | 59d0683c999bec5612f6ba91867bde4d02185204 (patch) | |
tree | a8bcd49d8044d2b9a76699137ad763a11a5464bb /src/multimedia/video/qvideoframe.cpp | |
parent | 71e2096c2b704420cbb0ee836c16565b658b3d0f (diff) |
Introduce QVideoFrame::image()
Since QVideoFrame::pixelFormat's do not 100% match QImage::Format's,
introducing converstion function.
Returns an image based on current frame.
Converts data if needed to supported QImage format.
Change-Id: I3331578c01cf9c999a380efc4a83bf9eddb07901
(cherry picked from commit 93f966335e1ed8ed47b7e8b32452d43c2f8a7bb1)
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/multimedia/video/qvideoframe.cpp')
-rw-r--r-- | src/multimedia/video/qvideoframe.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp index 5e2d6df39..fd7b74075 100644 --- a/src/multimedia/video/qvideoframe.cpp +++ b/src/multimedia/video/qvideoframe.cpp @@ -39,7 +39,6 @@ #include "qvideoframe.h" -#include "qvideoframe_p.h" #include "qimagevideobuffer_p.h" #include "qmemoryvideobuffer_p.h" #include "qvideoframeconversionhelper_p.h" @@ -1112,11 +1111,12 @@ static void qInitConvertFuncsAsm() } /*! - \internal + Based on the pixel format converts current video frame to image. + \since 5.15 */ -QImage qt_imageFromVideoFrame(const QVideoFrame &f) +QImage QVideoFrame::image() const { - QVideoFrame &frame = const_cast<QVideoFrame&>(f); + QVideoFrame frame = *this; QImage result; if (!frame.isValid() || !frame.map(QAbstractVideoBuffer::ReadOnly)) |