diff options
author | Val Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-06-21 15:41:30 +0200 |
---|---|---|
committer | Val Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-07-02 13:15:36 +0200 |
commit | 15abbc8c9e3acb5d9bee70fd8bec25242ec7abdd (patch) | |
tree | cb38cb55ab2bc1deab2a7e5d0cef2efb06277891 | |
parent | f0e7ea99687834d19e7949e7c1de1cbdb486d050 (diff) | |
download | qtmultimedia-15abbc8c9e3acb5d9bee70fd8bec25242ec7abdd.tar.gz |
DirectShow: Map MEDIASUBTYPE_RGB24 to QVideoFrame::Format_BGR24
MEDIASUBTYPE_RGB24 inverts Red and Blue channels, i.e. on Little-Endian: BGR
and thus Format_BGR24 should be used instead of Format_RGB24.
To reproduce the bug:
QCameraViewfinderSettings settings;
settings.setPixelFormat(QVideoFrame::Format_RGB24);
camera->setViewfinderSettings(settings);
If the camera supports MEDIASUBTYPE_RGB24 it will show Red and Blue
channels inverted.
*NOTE*
This fix causes ignoring MEDIASUBTYPE_RGB24 format and using
MEDUASUBTYPE_RGB32 instead.
Because the video surfaces currently do not support QVideoFrame::Format_BGR32.
So it fixes the issue with inverted colors by ignoring RGB24 media type.
If there is a need to use RGB24, it would require to implement custom
surface which supports QVideoFrame::Format_BGR24 and swap colors
manually.
Change-Id: I0d77694ef688a05dc52d13f991a5088e00f72867
Fixes: QTBUG-75959
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r-- | src/plugins/directshow/common/directshowmediatype.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/directshow/common/directshowmediatype.cpp b/src/plugins/directshow/common/directshowmediatype.cpp index fe86e0204..103f1ddc1 100644 --- a/src/plugins/directshow/common/directshowmediatype.cpp +++ b/src/plugins/directshow/common/directshowmediatype.cpp @@ -52,7 +52,7 @@ namespace { { QVideoFrame::Format_ARGB32, MEDIASUBTYPE_ARGB32 }, { QVideoFrame::Format_RGB32, MEDIASUBTYPE_RGB32 }, - { QVideoFrame::Format_RGB24, MEDIASUBTYPE_RGB24 }, + { QVideoFrame::Format_BGR24, MEDIASUBTYPE_RGB24 }, { QVideoFrame::Format_RGB565, MEDIASUBTYPE_RGB565 }, { QVideoFrame::Format_RGB555, MEDIASUBTYPE_RGB555 }, { QVideoFrame::Format_AYUV444, MEDIASUBTYPE_AYUV }, |