summaryrefslogtreecommitdiffstats
path: root/src/plugins/common/evr/evrcustompresenter.h
diff options
context:
space:
mode:
authorAndré de la Rocha <andre.rocha@qt.io>2022-08-16 20:33:53 +0200
committerAndré de la Rocha <andre.rocha@qt.io>2022-09-28 11:19:48 +0200
commit729cdaed40a90ef7ffbf208f7272b9a95b945283 (patch)
treec4f46fe67d3c756fc2dac0fdaed826d3aeb41f2b /src/plugins/common/evr/evrcustompresenter.h
parent11c4ad2c8a39819c9359341ef0145984b9ac16d0 (diff)
Windows: Fix cropping for HEVC-encoded videos
The cropping info associated with HEVC-encoded video files was not being applied and as a result some videos could show garbage on the borders of the actual video contents, since instead of the source frames width and height, the sizes in pixels of the buffers used by the encoding algorithm, which are padded to multiples of some power of two, were used. Root cause seems to be a bug in Media Foundation or incompatibility with the Windows HEVC decoder, as the API is returning buffer sizes where sizes of actual video contents should be returned. It works as expected for other video formats. This patch makes the QtMultimedia decoder enforce the actual video dimensions obtained through the file's metadata. Fixes: QTBUG-105381 Change-Id: I2d67c64f07de489edd1d274060eccd5a4d69bafe Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 65345a04c67c585c4d38d56cb1416a3033434aaf) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/plugins/common/evr/evrcustompresenter.h')
-rw-r--r--src/plugins/common/evr/evrcustompresenter.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/common/evr/evrcustompresenter.h b/src/plugins/common/evr/evrcustompresenter.h
index e8c9cfcd2..86ca4e8e0 100644
--- a/src/plugins/common/evr/evrcustompresenter.h
+++ b/src/plugins/common/evr/evrcustompresenter.h
@@ -44,6 +44,7 @@
#include <qmutex.h>
#include <qqueue.h>
#include <qevent.h>
+#include <qrect.h>
#include <qvideosurfaceformat.h>
#include "evrdefs.h"
@@ -257,6 +258,7 @@ public:
void supportedFormatsChanged();
void setSurface(QAbstractVideoSurface *surface);
+ void setCropRect(QRect cropRect);
void startSurface();
void stopSurface();
@@ -368,6 +370,7 @@ private:
QAbstractVideoSurface *m_surface;
bool m_canRenderToSurface;
qint64 m_positionOffset; // Seek position in microseconds.
+ QRect m_cropRect; // Video crop rectangle
};
bool qt_evr_setCustomPresenter(IUnknown *evr, EVRCustomPresenter *presenter);