summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2020-02-20 12:57:42 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-02 12:11:46 +0000
commit5a10af9bca8976ffb415adf12d4e8ffe4921da67 (patch)
treecabbcc76e02dc3e0b47c17ff00bc1e09e10fac76
parent603f108126e71e8a13011561b95f66f3deb69edc (diff)
downloadqtmultimedia-5a10af9bca8976ffb415adf12d4e8ffe4921da67.tar.gz
Map QVideoFrame::Format_Y8=>QImage::Format_Grayscale8 in QVideoFrame
Fixes: QTBUG-52455 Change-Id: I30582582935ae0a2c5094db995cba83b62adc767 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 2b96c113cf7057b556856149114999b973b3f2c2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/multimedia/video/qvideoframe.cpp5
-rw-r--r--src/multimediawidgets/qpaintervideosurface.cpp3
-rw-r--r--tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp4
-rw-r--r--tests/auto/unit/qvideoframe/tst_qvideoframe.cpp2
4 files changed, 9 insertions, 5 deletions
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index fd7b74075..7840eda31 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -964,6 +964,8 @@ QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat(QImage::Format
return Format_RGB555;
case QImage::Format_RGB888:
return Format_RGB24;
+ case QImage::Format_Grayscale8:
+ return Format_Y8;
default:
return Format_Invalid;
}
@@ -1017,12 +1019,13 @@ QImage::Format QVideoFrame::imageFormatFromPixelFormat(PixelFormat format)
case Format_IMC2:
case Format_IMC3:
case Format_IMC4:
- case Format_Y8:
case Format_Y16:
case Format_Jpeg:
case Format_CameraRaw:
case Format_AdobeDng:
return QImage::Format_Invalid;
+ case Format_Y8:
+ return QImage::Format_Grayscale8;
case Format_User:
default:
return QImage::Format_Invalid;
diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp
index 5fe76d869..80bfec7bc 100644
--- a/src/multimediawidgets/qpaintervideosurface.cpp
+++ b/src/multimediawidgets/qpaintervideosurface.cpp
@@ -109,7 +109,8 @@ QVideoSurfaceGenericPainter::QVideoSurfaceGenericPainter()
m_imagePixelFormats << QVideoFrame::Format_RGB24;
m_imagePixelFormats << QVideoFrame::Format_ARGB32
- << QVideoFrame::Format_RGB565;
+ << QVideoFrame::Format_RGB565
+ << QVideoFrame::Format_Y8;
}
QList<QVideoFrame::PixelFormat> QVideoSurfaceGenericPainter::supportedPixelFormats(
diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
index be5c85ab9..98ec5fc06 100644
--- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
+++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
@@ -253,8 +253,8 @@ void tst_QPainterVideoSurface::supportedFormat_data()
<< QAbstractVideoBuffer::NoHandle
<< QVideoFrame::Format_Y8
<< QSize(640, 480)
- << false
- << false;
+ << true
+ << true;
QTest::newRow("Texture: rgb32 640x480")
<< QAbstractVideoBuffer::GLTextureHandle
<< QVideoFrame::Format_RGB32
diff --git a/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp b/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp
index 943051435..bb77b7cca 100644
--- a/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp
+++ b/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp
@@ -975,7 +975,7 @@ void tst_QVideoFrame::formatConversion_data()
<< QImage::Format_Invalid
<< QVideoFrame::Format_IMC4;
QTest::newRow("QVideoFrame::Format_Y8")
- << QImage::Format_Invalid
+ << QImage::Format_Grayscale8
<< QVideoFrame::Format_Y8;
QTest::newRow("QVideoFrame::Format_Y16")
<< QImage::Format_Invalid