From 31b5b4354dc03f613fa2cceade0983e6005844a9 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Wed, 15 Jun 2022 10:32:16 -0500 Subject: [PATCH 01/12] Add pyproject.toml for sip bindings --- python/pyproject.toml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 python/pyproject.toml diff --git a/python/pyproject.toml b/python/pyproject.toml new file mode 100644 index 000000000..8d1a4ecfd --- /dev/null +++ b/python/pyproject.toml @@ -0,0 +1,36 @@ +# Specify the build system requirements. +[build-system] +requires = ["sip >=5.3, <7", "PyQt-builder >=1.9, <2"] +build-backend = "sipbuild.api" + +# Specify the PEP 566 metadata for the project. +[tool.sip.metadata] +name = "PyQtAV" +version = "1.12.0" +summary = "Python bindings for the QtAV" +home-page = "" +author = "" +author-email = "" +license = "LGPL" + +# Specify a PyQt-based project. +[tool.sip] +project-factory = "pyqtbuild:PyQtProject" + +# Configure the project. +[tool.sip.project] +tag-prefix = "QtAV" +sip-include-dirs = [PYQT_BINDINGS_DIR] + +# Define and configure each set of bindings. +[tool.sip.bindings.QtAV] +qmake-QT = ["widgets"] +include-dirs = [INCLUDE_DIRS] +libraries = [QTAV_LIB] +library-dirs = [LIB_DIRS] + +[tool.sip.bindings.QtAVWidgets] +qmake-QT = ["widgets", "opengl"] +include-dirs = [INCLUDE_DIRS] +libraries = [QTAV_LIB, QTAV_WIDGETS_LIB] +library-dirs = [LIB_DIRS] From b77219fbb9a8bf604c3fef35c1896cd7bb063e77 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Thu, 12 Jul 2018 14:42:22 -0500 Subject: [PATCH 02/12] Wait for the PositionWatcher thread to stop --- src/output/audio/AudioOutputDSound.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/output/audio/AudioOutputDSound.cpp b/src/output/audio/AudioOutputDSound.cpp index 227fba991..1b7905699 100644 --- a/src/output/audio/AudioOutputDSound.cpp +++ b/src/output/audio/AudioOutputDSound.cpp @@ -193,6 +193,12 @@ bool AudioOutputDSound::close() available = false; destroy(); CloseHandle(notify_event); // FIXME: is it ok if thread is still waiting? + + // Wait for the PositionWatcher thread to stop. + while (watcher.isRunning()) { + watcher.wait(500); + } + return true; } From 705ad03cc01f9f710963d0923de80c0b1623232d Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Tue, 10 Sep 2019 22:38:56 -0500 Subject: [PATCH 03/12] Workaround compile error with SIP_OVERRIDE --- python/sip/QtAVWidgets/GLWidgetRenderer2.sip | 2 +- python/sip/QtAVWidgets/GraphicsItemRenderer.sip | 2 +- python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip | 2 +- python/sip/QtAVWidgets/WidgetRenderer.sip | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/sip/QtAVWidgets/GLWidgetRenderer2.sip b/python/sip/QtAVWidgets/GLWidgetRenderer2.sip index 81bebe5e6..3f983d6d4 100644 --- a/python/sip/QtAVWidgets/GLWidgetRenderer2.sip +++ b/python/sip/QtAVWidgets/GLWidgetRenderer2.sip @@ -34,7 +34,7 @@ public: public: GLWidgetRenderer2(QWidget* parent /TransferThis/ = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0); - virtual VideoRendererId id(); + VideoRendererId id(); virtual QWidget* widget(); signals: diff --git a/python/sip/QtAVWidgets/GraphicsItemRenderer.sip b/python/sip/QtAVWidgets/GraphicsItemRenderer.sip index fbc520f52..75348448b 100644 --- a/python/sip/QtAVWidgets/GraphicsItemRenderer.sip +++ b/python/sip/QtAVWidgets/GraphicsItemRenderer.sip @@ -34,7 +34,7 @@ public: public: GraphicsItemRenderer(QGraphicsItem* parent /TransferThis/ = 0); - virtual VideoRendererId id(); + VideoRendererId id(); bool isSupported(VideoFormat::PixelFormat pixfmt); diff --git a/python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip b/python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip index 38844862d..aa9768a76 100644 --- a/python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip +++ b/python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip @@ -34,7 +34,7 @@ public: public: explicit OpenGLWidgetRenderer(QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = 0); - virtual VideoRendererId id(); + VideoRendererId id() const; virtual QWidget* widget(); signals: diff --git a/python/sip/QtAVWidgets/WidgetRenderer.sip b/python/sip/QtAVWidgets/WidgetRenderer.sip index 5f2561b93..b4d38583a 100644 --- a/python/sip/QtAVWidgets/WidgetRenderer.sip +++ b/python/sip/QtAVWidgets/WidgetRenderer.sip @@ -24,7 +24,7 @@ public: public: WidgetRenderer(QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = 0); - virtual VideoRendererId id(); + VideoRendererId id(); virtual QWidget* widget(); signals: From fa9aa8debe93c249eedeb493cac660b5e1464095 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Mon, 3 Oct 2022 11:09:44 -0500 Subject: [PATCH 04/12] Update constructors to use Qt::WindowFlags() --- python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip | 2 +- python/sip/QtAVWidgets/WidgetRenderer.sip | 2 +- tools/templates/vo.h | 2 +- widgets/Direct2DRenderer.cpp | 2 +- widgets/GDIRenderer.cpp | 2 +- widgets/QtAVWidgets/GLWidgetRenderer.h | 2 +- widgets/QtAVWidgets/GLWidgetRenderer2.h | 2 +- widgets/QtAVWidgets/QOpenGLWidget.h | 2 +- widgets/X11Renderer.cpp | 2 +- widgets/XVRenderer.cpp | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip b/python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip index aa9768a76..9edb5e8b7 100644 --- a/python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip +++ b/python/sip/QtAVWidgets/OpenGLWidgetRenderer.sip @@ -33,7 +33,7 @@ public: QSize videoFrameSize(); public: - explicit OpenGLWidgetRenderer(QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = 0); + explicit OpenGLWidgetRenderer(QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = Qt::WindowFlags()); VideoRendererId id() const; virtual QWidget* widget(); diff --git a/python/sip/QtAVWidgets/WidgetRenderer.sip b/python/sip/QtAVWidgets/WidgetRenderer.sip index b4d38583a..96740a0f0 100644 --- a/python/sip/QtAVWidgets/WidgetRenderer.sip +++ b/python/sip/QtAVWidgets/WidgetRenderer.sip @@ -23,7 +23,7 @@ public: QSize videoFrameSize(); public: - WidgetRenderer(QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = 0); + WidgetRenderer(QWidget* parent /TransferThis/ = 0, Qt::WindowFlags f = Qt::WindowFlags()); VideoRendererId id(); virtual QWidget* widget(); diff --git a/tools/templates/vo.h b/tools/templates/vo.h index 85d687039..6378f20cd 100644 --- a/tools/templates/vo.h +++ b/tools/templates/vo.h @@ -13,7 +13,7 @@ class Q_AV_EXPORT %CLASS% : public QWidget, public VideoRenderer Q_OBJECT DPTR_DECLARE_PRIVATE(%CLASS%) public: - %CLASS%(QWidget* parent = 0, Qt::WindowFlags f = 0); + %CLASS%(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags()); virtual ~%CLASS%(); /* WA_PaintOnScreen: To render outside of Qt's paint system, e.g. If you require diff --git a/widgets/Direct2DRenderer.cpp b/widgets/Direct2DRenderer.cpp index 9e63febb4..7841a97a2 100644 --- a/widgets/Direct2DRenderer.cpp +++ b/widgets/Direct2DRenderer.cpp @@ -55,7 +55,7 @@ class Direct2DRenderer : public QWidget, public VideoRenderer Q_OBJECT DPTR_DECLARE_PRIVATE(Direct2DRenderer) public: - Direct2DRenderer(QWidget* parent = 0, Qt::WindowFlags f = 0); + Direct2DRenderer(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags()); VideoRendererId id() const Q_DECL_OVERRIDE; bool isSupported(VideoFormat::PixelFormat pixfmt) const Q_DECL_OVERRIDE; diff --git a/widgets/GDIRenderer.cpp b/widgets/GDIRenderer.cpp index af20c869f..5636d5736 100644 --- a/widgets/GDIRenderer.cpp +++ b/widgets/GDIRenderer.cpp @@ -41,7 +41,7 @@ class GDIRenderer : public QWidget, public VideoRenderer Q_OBJECT DPTR_DECLARE_PRIVATE(GDIRenderer) public: - GDIRenderer(QWidget* parent = 0, Qt::WindowFlags f = 0); //offscreen? + GDIRenderer(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags()); //offscreen? VideoRendererId id() const Q_DECL_OVERRIDE; bool isSupported(VideoFormat::PixelFormat pixfmt) const Q_DECL_OVERRIDE; /* WA_PaintOnScreen: To render outside of Qt's paint system, e.g. If you require diff --git a/widgets/QtAVWidgets/GLWidgetRenderer.h b/widgets/QtAVWidgets/GLWidgetRenderer.h index 20dcd55a0..a1d11e468 100644 --- a/widgets/QtAVWidgets/GLWidgetRenderer.h +++ b/widgets/QtAVWidgets/GLWidgetRenderer.h @@ -41,7 +41,7 @@ class Q_AVWIDGETS_EXPORT GLWidgetRenderer : public QGLWidget, public VideoRender Q_OBJECT DPTR_DECLARE_PRIVATE(GLWidgetRenderer) public: - GLWidgetRenderer(QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0); + GLWidgetRenderer(QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = Qt::WindowFlags()); virtual VideoRendererId id() const; virtual bool isSupported(VideoFormat::PixelFormat pixfmt) const; virtual QWidget* widget() { return this; } diff --git a/widgets/QtAVWidgets/GLWidgetRenderer2.h b/widgets/QtAVWidgets/GLWidgetRenderer2.h index 037a7cc53..ccda2637f 100644 --- a/widgets/QtAVWidgets/GLWidgetRenderer2.h +++ b/widgets/QtAVWidgets/GLWidgetRenderer2.h @@ -56,7 +56,7 @@ class Q_AVWIDGETS_EXPORT GLWidgetRenderer2 : public QGLWidget, public OpenGLRend Q_PROPERTY(QSize videoFrameSize READ videoFrameSize NOTIFY videoFrameSizeChanged) Q_ENUMS(Quality) public: - GLWidgetRenderer2(QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0); + GLWidgetRenderer2(QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = Qt::WindowFlags()); virtual VideoRendererId id() const Q_DECL_OVERRIDE; virtual QWidget* widget() Q_DECL_OVERRIDE { return this; } Q_SIGNALS: diff --git a/widgets/QtAVWidgets/QOpenGLWidget.h b/widgets/QtAVWidgets/QOpenGLWidget.h index e6364120b..ab16e3c79 100644 --- a/widgets/QtAVWidgets/QOpenGLWidget.h +++ b/widgets/QtAVWidgets/QOpenGLWidget.h @@ -42,7 +42,7 @@ class Q_AVWIDGETS_EXPORT QOpenGLWidget : public QWidget Q_OBJECT Q_DISABLE_COPY(QOpenGLWidget) public: - explicit QOpenGLWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); + explicit QOpenGLWidget(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags()); virtual ~QOpenGLWidget(); void setFormat(const QSurfaceFormat &format); QSurfaceFormat format() const; diff --git a/widgets/X11Renderer.cpp b/widgets/X11Renderer.cpp index 91c952fb9..1e281a4b1 100644 --- a/widgets/X11Renderer.cpp +++ b/widgets/X11Renderer.cpp @@ -47,7 +47,7 @@ class X11Renderer: public QWidget, public VideoRenderer Q_OBJECT DPTR_DECLARE_PRIVATE(X11Renderer) public: - X11Renderer(QWidget* parent = 0, Qt::WindowFlags f = 0); + X11Renderer(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags()); VideoRendererId id() const Q_DECL_OVERRIDE; bool isSupported(VideoFormat::PixelFormat pixfmt) const Q_DECL_OVERRIDE; diff --git a/widgets/XVRenderer.cpp b/widgets/XVRenderer.cpp index 9ae64eb4e..6274700b4 100644 --- a/widgets/XVRenderer.cpp +++ b/widgets/XVRenderer.cpp @@ -50,7 +50,7 @@ class XVRenderer: public QWidget, public VideoRenderer Q_OBJECT DPTR_DECLARE_PRIVATE(XVRenderer) public: - XVRenderer(QWidget* parent = 0, Qt::WindowFlags f = 0); + XVRenderer(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags()); virtual VideoRendererId id() const Q_DECL_OVERRIDE; virtual bool isSupported(VideoFormat::PixelFormat pixfmt) const Q_DECL_OVERRIDE; From 522f958eab77a78c63d79497dda8b40a56687786 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Mon, 3 Oct 2022 11:27:00 -0500 Subject: [PATCH 05/12] Remove old windows version check --- src/codec/video/VideoDecoderDXVA.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/codec/video/VideoDecoderDXVA.cpp b/src/codec/video/VideoDecoderDXVA.cpp index 64b12f33d..0f8abf250 100644 --- a/src/codec/video/VideoDecoderDXVA.cpp +++ b/src/codec/video/VideoDecoderDXVA.cpp @@ -29,7 +29,6 @@ //#include "QtAV/private/mkid.h" #include "utils/Logger.h" #include "directx/SurfaceInteropD3D9.h" -#include #define DX_LOG_COMPONENT "DXVA2" #include "utils/DirectXHelper.h" @@ -98,7 +97,7 @@ class VideoDecoderDXVAPrivate Q_DECL_FINAL: public VideoDecoderD3DPrivate VideoDecoderD3DPrivate() { // d3d9+gl interop may not work on optimus moble platforms, 0-copy is enabled only for egl interop - if (d3d9::InteropResource::isSupported(d3d9::InteropEGL) && QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) + if (d3d9::InteropResource::isSupported(d3d9::InteropEGL)) copy_mode = VideoDecoderFFmpegHW::ZeroCopy; hd3d9_dll = 0; From faa9d98dfd2ec04be926ae555e148f9df3ff7502 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Mon, 3 Oct 2022 11:36:25 -0500 Subject: [PATCH 06/12] Workaround compiler error C7626 --- src/cuda/cuda_api.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cuda/cuda_api.cpp b/src/cuda/cuda_api.cpp index c37d25e2d..32dce6774 100644 --- a/src/cuda/cuda_api.cpp +++ b/src/cuda/cuda_api.cpp @@ -108,7 +108,7 @@ class cuda_api::context { QLibrary cuda_dll; QLibrary cuvid_dll; - typedef struct { + typedef struct cuda_api { typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char **pStr); tcuGetErrorName* cuGetErrorName; typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char **pStr); From 8f88d136383ad498377265864131534874fa0315 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Mon, 3 Oct 2022 11:37:06 -0500 Subject: [PATCH 07/12] Use asprintf instead of sprintf --- src/codec/video/VideoDecoderDXVA.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/codec/video/VideoDecoderDXVA.cpp b/src/codec/video/VideoDecoderDXVA.cpp index 0f8abf250..c8722127a 100644 --- a/src/codec/video/VideoDecoderDXVA.cpp +++ b/src/codec/video/VideoDecoderDXVA.cpp @@ -268,9 +268,9 @@ bool VideoDecoderDXVAPrivate::createDevice() return false; } vendor = QString::fromLatin1(DXHelper::vendorName(d3dai.VendorId)); - description = QString().sprintf("DXVA2 (%.*s, vendor %lu(%s), device %lu, revision %lu)", - sizeof(d3dai.Description), d3dai.Description, - d3dai.VendorId, qPrintable(vendor), d3dai.DeviceId, d3dai.Revision); + description = QString().asprintf("DXVA2 (%.*s, vendor %lu(%s), device %lu, revision %lu)", + sizeof(d3dai.Description), d3dai.Description, + d3dai.VendorId, qPrintable(vendor), d3dai.DeviceId, d3dai.Revision); //if (copy_uswc) // copy_uswc = vendor.toLower() == "intel"; From 152ce27be0a178d85d64f6db140bb5b6df6c049a Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Mon, 3 Oct 2022 11:38:45 -0500 Subject: [PATCH 08/12] Update how we access OpenGL context --- src/opengl/gl_api.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl_api.cpp b/src/opengl/gl_api.cpp index 9caeba8b4..1ddd21f87 100644 --- a/src/opengl/gl_api.cpp +++ b/src/opengl/gl_api.cpp @@ -32,7 +32,8 @@ void* GetProcAddress_Qt(const char *name) void* p = (void*)QOpenGLContext::currentContext()->getProcAddress(QByteArray((const char*)name)); if (!p) { #if defined(Q_OS_WIN) && defined(QT_OPENGL_DYNAMIC) - HMODULE handle = (HMODULE)QOpenGLContext::openGLModuleHandle(); + using namespace QNativeInterface; + HMODULE handle = QWGLContext::openGLModuleHandle(); if (handle) p = (void*)GetProcAddress(handle, name); #endif From 07cb7bb2e5bf59d8b36b50e4bc600dc68346fce3 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Mon, 3 Oct 2022 11:40:19 -0500 Subject: [PATCH 09/12] Add missing header include --- src/AVError.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AVError.cpp b/src/AVError.cpp index 5f7b3fe37..a83d0a6d1 100644 --- a/src/AVError.cpp +++ b/src/AVError.cpp @@ -20,6 +20,7 @@ ******************************************************************************/ #include "QtAV/AVError.h" #include "QtAV/private/AVCompat.h" +#include #ifndef QT_NO_DEBUG_STREAM #include #endif From c7f3ab2e57083dad1b3caf89c65535912931b25a Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Mon, 3 Oct 2022 11:41:34 -0500 Subject: [PATCH 10/12] Update iteration over QRegion rects --- src/output/video/QPainterRenderer.cpp | 3 +-- widgets/GDIRenderer.cpp | 3 +-- widgets/X11Renderer.cpp | 3 +-- widgets/XVRenderer.cpp | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/output/video/QPainterRenderer.cpp b/src/output/video/QPainterRenderer.cpp index 656a921a7..18f9d405b 100644 --- a/src/output/video/QPainterRenderer.cpp +++ b/src/output/video/QPainterRenderer.cpp @@ -85,8 +85,7 @@ void QPainterRenderer::drawBackground() d.painter->fillRect(QRect(QPoint(), rendererSize()), backgroundColor()); d.painter->restore(); #else - const QVector bg(bgRegion.rects()); - foreach (const QRect& r, bg) { + foreach (const QRect& r, bgRegion) { d.painter->fillRect(r, backgroundColor()); } #endif diff --git a/widgets/GDIRenderer.cpp b/widgets/GDIRenderer.cpp index 5636d5736..c3f9db32e 100644 --- a/widgets/GDIRenderer.cpp +++ b/widgets/GDIRenderer.cpp @@ -238,8 +238,7 @@ void GDIRenderer::drawBackground() //HDC hdc = d.device_context; Graphics g(d.device_context); SolidBrush brush(Color(bc.alpha(), bc.red(), bc.green(), bc.blue())); //argb - const QVector bg(bgRegion.rects()); - foreach (const QRect& r, bg) { + foreach (const QRect& r, bgRegion) { g.FillRectangle(&brush, r.x(), r.y(), r.width(), r.height()); } } diff --git a/widgets/X11Renderer.cpp b/widgets/X11Renderer.cpp index 1e281a4b1..6b914fa4b 100644 --- a/widgets/X11Renderer.cpp +++ b/widgets/X11Renderer.cpp @@ -441,8 +441,7 @@ void X11Renderer::drawBackground() // TODO: fill once each resize? mpv // TODO: set color //XSetBackground(d.display, d.gc, BlackPixel(d.display, DefaultScreen(d.display))); - const QVector bg(bgRegion.rects()); - foreach (const QRect& r, bg) { + foreach (const QRect& r, bgRegion) { XFillRectangle(d.display, winId(), d.gc, r.x(), r.y(), r.width(), r.height()); } XFlush(d.display); // apply the color diff --git a/widgets/XVRenderer.cpp b/widgets/XVRenderer.cpp index 6274700b4..ef414049a 100644 --- a/widgets/XVRenderer.cpp +++ b/widgets/XVRenderer.cpp @@ -492,8 +492,7 @@ void XVRenderer::drawBackground() return; DPTR_D(XVRenderer); // TODO: set color - const QVector bg(bgRegion.rects()); - foreach (const QRect& r, bg) { + foreach (const QRect& r, bgRegion) { XFillRectangle(d.display, winId(), d.gc, r.x(), r.y(), r.width(), r.height()); } XFlush(d.display); From e2bbc870fc97be94c85fdd25837d7ac2ee8197e4 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Mon, 3 Oct 2022 11:43:57 -0500 Subject: [PATCH 11/12] Update Python bindings --- python/pyproject.toml | 2 +- python/sip/QtAV/VideoFormat.sip | 1 - python/sip/QtAVWidgets/GLWidgetRenderer2.sip | 64 -------------------- python/sip/QtAVWidgets/QtAVWidgetsmod.sip | 2 +- src/libQtAV.pro | 2 +- widgets/QtAVWidgets/OpenGLWidgetRenderer.h | 2 +- 6 files changed, 4 insertions(+), 69 deletions(-) delete mode 100644 python/sip/QtAVWidgets/GLWidgetRenderer2.sip diff --git a/python/pyproject.toml b/python/pyproject.toml index 8d1a4ecfd..5f5b2a626 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -30,7 +30,7 @@ libraries = [QTAV_LIB] library-dirs = [LIB_DIRS] [tool.sip.bindings.QtAVWidgets] -qmake-QT = ["widgets", "opengl"] +qmake-QT = ["widgets", "opengl", "openglwidgets"] include-dirs = [INCLUDE_DIRS] libraries = [QTAV_LIB, QTAV_WIDGETS_LIB] library-dirs = [LIB_DIRS] diff --git a/python/sip/QtAV/VideoFormat.sip b/python/sip/QtAV/VideoFormat.sip index 3d2515cd3..394f09e19 100644 --- a/python/sip/QtAV/VideoFormat.sip +++ b/python/sip/QtAV/VideoFormat.sip @@ -104,7 +104,6 @@ public: static QImage::Format imageFormatFromPixelFormat(PixelFormat format); static PixelFormat pixelFormatFromFFmpeg(int ff); //AVPixelFormat static int pixelFormatToFFmpeg(PixelFormat fmt); - static QVector pixelFormatsFFmpeg(); VideoFormat(PixelFormat format = Format_Invalid); VideoFormat(int formatFF /Constrained/); diff --git a/python/sip/QtAVWidgets/GLWidgetRenderer2.sip b/python/sip/QtAVWidgets/GLWidgetRenderer2.sip deleted file mode 100644 index 3f983d6d4..000000000 --- a/python/sip/QtAVWidgets/GLWidgetRenderer2.sip +++ /dev/null @@ -1,64 +0,0 @@ -namespace QtAV -{ - -class GLWidgetRenderer2 : public QGLWidget, public QtAV::OpenGLRendererBase -{ -%TypeHeaderCode -#include -%End - -public: - void setBrightness(qreal brightness); - qreal brightness(); - void setContrast(qreal contrast); - qreal contrast(); - void setHue(qreal hue); - qreal hue(); - void setSaturation(qreal saturation); - qreal saturation(); - void setBackgroundColor(QColor color); - QColor backgroundColor(); - - QRectF regionOfInterest(); - void setRegionOfInterest(QRectF region); - qreal sourceAspectRatio(); - qreal outAspectRatio(); - void setOutAspectRatio(qreal ratio); - OutAspectRatioMode outAspectRatioMode(); - void setOutAspectRatioMode(OutAspectRatioMode mode); - - int orientation(); - void setOrientation(int orientation); - QRect videoRect(); - QSize videoFrameSize(); - -public: - GLWidgetRenderer2(QWidget* parent /TransferThis/ = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0); - VideoRendererId id(); - virtual QWidget* widget(); - -signals: - void sourceAspectRatioChanged(qreal value) final; - void regionOfInterestChanged(); - void outAspectRatioChanged(); - void outAspectRatioModeChanged(); - void brightnessChanged(qreal value); - void contrastChanged(qreal); - void hueChanged(qreal); - void saturationChanged(qreal); - void orientationChanged(); - void videoRectChanged(); - void videoFrameSizeChanged(); - void backgroundColorChanged(); - -protected: - virtual void initializeGL(); - virtual void paintGL(); - virtual void resizeGL(int w, int h); - virtual void resizeEvent(QResizeEvent *); // not virtual in QGLWidget (Qt<5.5) - virtual void showEvent(QShowEvent *); - -}; -typedef GLWidgetRenderer2 VideoRendererGLWidget2; - -}; diff --git a/python/sip/QtAVWidgets/QtAVWidgetsmod.sip b/python/sip/QtAVWidgets/QtAVWidgetsmod.sip index 0df00da0c..f42fa3781 100644 --- a/python/sip/QtAVWidgets/QtAVWidgetsmod.sip +++ b/python/sip/QtAVWidgets/QtAVWidgetsmod.sip @@ -3,6 +3,7 @@ %Import QtGui/QtGuimod.sip %Import QtWidgets/QtWidgetsmod.sip %Import QtOpenGL/QtOpenGLmod.sip +%Import QtOpenGLWidgets/QtOpenGLWidgetsmod.sip %Import QtAV/QtAVmod.sip %Timeline {QtAVWidgets_1_11_0 QtAVWidgets_1_12_0} @@ -35,7 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA %Include global.sip %If (FULL_QTWIDGETS_API) -%Include GLWidgetRenderer2.sip %Include GraphicsItemRenderer.sip // NOTE: We don't expose QOpenGLWidget because it is present in Qt >= 5.4.0 %Include OpenGLWidgetRenderer.sip diff --git a/src/libQtAV.pro b/src/libQtAV.pro index c6cbcc374..eaf2419db 100644 --- a/src/libQtAV.pro +++ b/src/libQtAV.pro @@ -3,7 +3,7 @@ MODULE_INCNAME = QtAV # for mac framework. also used in install_sdk.pro TARGET = QtAV QT += core gui #CONFIG *= ltcg -greaterThan(QT_MAJOR_VERSION, 5): QT += opengl +greaterThan(QT_MAJOR_VERSION, 5): QT += opengl openglwidgets greaterThan(QT_MAJOR_VERSION, 4) { contains(QT_CONFIG, opengl) { CONFIG *= config_opengl diff --git a/widgets/QtAVWidgets/OpenGLWidgetRenderer.h b/widgets/QtAVWidgets/OpenGLWidgetRenderer.h index dffc65548..6620762d2 100644 --- a/widgets/QtAVWidgets/OpenGLWidgetRenderer.h +++ b/widgets/QtAVWidgets/OpenGLWidgetRenderer.h @@ -24,7 +24,7 @@ #include #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) -#include +#include #else #include #endif //QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) From 7f99878b00da1219aa5f3e0b61d19cccbe4b2387 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Mon, 3 Oct 2022 14:21:22 -0500 Subject: [PATCH 12/12] Update for Qt 6 --- src/filter/X11FilterContext.cpp | 2 +- src/output/OutputSet.h | 2 ++ src/utils/BlockingQueue.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/filter/X11FilterContext.cpp b/src/filter/X11FilterContext.cpp index 849d1fb08..8e3d84d36 100644 --- a/src/filter/X11FilterContext.cpp +++ b/src/filter/X11FilterContext.cpp @@ -182,7 +182,7 @@ void X11FilterContext::drawPlainText(const QPointF &pos, const QString &text) this->plain = true; QFontMetrics fm(font); - text_q = QImage(fm.width(text), fm.height(), QImage::Format_ARGB32); + text_q = QImage(fm.horizontalAdvance(text), fm.height(), QImage::Format_ARGB32); text_q.fill(0); painter->begin(&text_q); painter->translate(0, 0); diff --git a/src/output/OutputSet.h b/src/output/OutputSet.h index b410d6161..0fc614d3d 100644 --- a/src/output/OutputSet.h +++ b/src/output/OutputSet.h @@ -22,6 +22,8 @@ #ifndef QTAV_OUTPUTSET_H #define QTAV_OUTPUTSET_H +#include + #include #include #include diff --git a/src/utils/BlockingQueue.h b/src/utils/BlockingQueue.h index f729e8da3..ea906c9df 100644 --- a/src/utils/BlockingQueue.h +++ b/src/utils/BlockingQueue.h @@ -23,6 +23,8 @@ #ifndef QTAV_BLOCKINGQUEUE_H #define QTAV_BLOCKINGQUEUE_H +#include + #include #include #include