From 1d4128f08e30cec31b94500840c7eca8ebc579cb Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Mon, 11 Oct 2021 20:03:50 +0200 Subject: [PATCH] [qt] Fix qtmultimedia with gstreamer on windows (#20555) * apply patches to make qtmultimedia work with gestreamer on windows * version stuff * remove libnice from ci.baseline * move gstreamer on osx as fail to baseline * add supports field to qtmultimedia. Qt does not officially support x86 on windows * version stuff * remove duplicated patch * version stuff * add upstream patch to fix x86-windows * [skip actions] version stuff --- ports/qtbase/fix_qthread_max.patch | 13 +++ ports/qtbase/portfile.cmake | 1 + ports/qtbase/vcpkg.json | 2 +- ports/qtmultimedia/3c74340.diff | 128 +++++++++++++++++++++++++ ports/qtmultimedia/FindGObject.patch | 20 ++++ ports/qtmultimedia/FindGStreamer.patch | 36 +++++++ ports/qtmultimedia/portfile.cmake | 6 +- ports/qtmultimedia/remove_unistd.patch | 24 +++++ ports/qtmultimedia/vcpkg.json | 6 ++ scripts/ci.baseline.txt | 9 +- versions/baseline.json | 4 +- versions/q-/qtbase.json | 5 + versions/q-/qtmultimedia.json | 5 + 13 files changed, 247 insertions(+), 12 deletions(-) create mode 100644 ports/qtbase/fix_qthread_max.patch create mode 100644 ports/qtmultimedia/3c74340.diff create mode 100644 ports/qtmultimedia/FindGObject.patch create mode 100644 ports/qtmultimedia/FindGStreamer.patch create mode 100644 ports/qtmultimedia/remove_unistd.patch diff --git a/ports/qtbase/fix_qthread_max.patch b/ports/qtbase/fix_qthread_max.patch new file mode 100644 index 0000000000..9138c3c889 --- /dev/null +++ b/ports/qtbase/fix_qthread_max.patch @@ -0,0 +1,13 @@ +diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h +index 5dc4d2222..1696dbc80 100644 +--- a/src/corelib/thread/qthread.h ++++ b/src/corelib/thread/qthread.h +@@ -120,7 +120,7 @@ public: + bool wait(QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)); + bool wait(unsigned long time) + { +- if (time == std::numeric_limits::max()) ++ if (time == (std::numeric_limits::max)()) + return wait(QDeadlineTimer(QDeadlineTimer::Forever)); + return wait(QDeadlineTimer(time)); + } diff --git a/ports/qtbase/portfile.cmake b/ports/qtbase/portfile.cmake index 60a2472544..fb3eca7c34 100644 --- a/ports/qtbase/portfile.cmake +++ b/ports/qtbase/portfile.cmake @@ -17,6 +17,7 @@ set(${PORT}_PATCHES fix_cmake_build.patch harfbuzz.patch fix_egl.patch + fix_qthread_max.patch ) if(NOT VCPKG_USE_HEAD_VERSION AND NOT QT_IS_LATEST) diff --git a/ports/qtbase/vcpkg.json b/ports/qtbase/vcpkg.json index 25f24be83c..56b49db009 100644 --- a/ports/qtbase/vcpkg.json +++ b/ports/qtbase/vcpkg.json @@ -1,7 +1,7 @@ { "name": "qtbase", "version-semver": "6.2.0", - "port-version": 1, + "port-version": 2, "description": "Qt Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.", "homepage": "https://www.qt.io/", "dependencies": [ diff --git a/ports/qtmultimedia/3c74340.diff b/ports/qtmultimedia/3c74340.diff new file mode 100644 index 0000000000..05935f6237 --- /dev/null +++ b/ports/qtmultimedia/3c74340.diff @@ -0,0 +1,128 @@ +From 3c7434025c5e14c2b3027a13ce90aab49712156c Mon Sep 17 00:00:00 2001 +From: André de la Rocha +Date: Wed, 06 Oct 2021 02:45:14 +0200 +Subject: [PATCH] Fix function declarations + +Adding missing QT_WIN_CALLBACK / QT_FASTCALL + +Pick-to: 6.2 +Change-Id: I5ba5a6341a988f162b9562c9fd328b9d90c6e1ab +Reviewed-by: Lars Knoll +--- + +diff --git a/src/multimedia/platform/windows/qwindowsmediadevices.cpp b/src/multimedia/platform/windows/qwindowsmediadevices.cpp +index 067c2bb..a525569 100644 +--- a/src/multimedia/platform/windows/qwindowsmediadevices.cpp ++++ b/src/multimedia/platform/windows/qwindowsmediadevices.cpp +@@ -190,7 +190,7 @@ + } + }; + +-LRESULT deviceNotificationWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ++LRESULT QT_WIN_CALLBACK deviceNotificationWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) + { + if (message == WM_DEVICECHANGE) { + auto b = (PDEV_BROADCAST_HDR)lParam; +diff --git a/src/multimedia/platform/windows/qwindowsmediadevices_p.h b/src/multimedia/platform/windows/qwindowsmediadevices_p.h +index 29e214d..0dc06a4 100644 +--- a/src/multimedia/platform/windows/qwindowsmediadevices_p.h ++++ b/src/multimedia/platform/windows/qwindowsmediadevices_p.h +@@ -65,7 +65,7 @@ + class QWindowsEngine; + class CMMNotificationClient; + +-LRESULT deviceNotificationWndProc(HWND, UINT, WPARAM, LPARAM); ++LRESULT QT_WIN_CALLBACK deviceNotificationWndProc(HWND, UINT, WPARAM, LPARAM); + + class QWindowsMediaDevices : public QPlatformMediaDevices + { +@@ -88,7 +88,7 @@ + HDEVNOTIFY m_videoDeviceNotification; + + friend CMMNotificationClient; +- friend LRESULT deviceNotificationWndProc(HWND, UINT, WPARAM, LPARAM); ++ friend LRESULT QT_WIN_CALLBACK deviceNotificationWndProc(HWND, UINT, WPARAM, LPARAM); + }; + + QT_END_NAMESPACE +diff --git a/src/multimedia/video/qvideoframeconversionhelper_avx2.cpp b/src/multimedia/video/qvideoframeconversionhelper_avx2.cpp +index c17f8a6..cada965 100644 +--- a/src/multimedia/video/qvideoframeconversionhelper_avx2.cpp ++++ b/src/multimedia/video/qvideoframeconversionhelper_avx2.cpp +@@ -114,17 +114,17 @@ + convert_to_ARGB32_avx2<0, 1, 2, 3>(frame, output); + } + +-void qt_convert_ABGR8888_to_ARGB32_avx2(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_ABGR8888_to_ARGB32_avx2(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_avx2<0, 3, 2, 1>(frame, output); + } + +-void qt_convert_RGBA8888_to_ARGB32_avx2(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_RGBA8888_to_ARGB32_avx2(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_avx2<3, 0, 1, 2>(frame, output); + } + +-void qt_convert_BGRA8888_to_ARGB32_avx2(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_BGRA8888_to_ARGB32_avx2(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_avx2<3, 2, 1, 0>(frame, output); + } +diff --git a/src/multimedia/video/qvideoframeconversionhelper_sse2.cpp b/src/multimedia/video/qvideoframeconversionhelper_sse2.cpp +index 8c0092e..68abf04 100644 +--- a/src/multimedia/video/qvideoframeconversionhelper_sse2.cpp ++++ b/src/multimedia/video/qvideoframeconversionhelper_sse2.cpp +@@ -96,22 +96,22 @@ + + } + +-void qt_convert_ARGB8888_to_ARGB32_sse2(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_ARGB8888_to_ARGB32_sse2(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_sse2<0, 1, 2, 3>(frame, output); + } + +-void qt_convert_ABGR8888_to_ARGB32_sse2(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_ABGR8888_to_ARGB32_sse2(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_sse2<0, 3, 2, 1>(frame, output); + } + +-void qt_convert_RGBA8888_to_ARGB32_sse2(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_RGBA8888_to_ARGB32_sse2(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_sse2<3, 0, 1, 2>(frame, output); + } + +-void qt_convert_BGRA8888_to_ARGB32_sse2(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_BGRA8888_to_ARGB32_sse2(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_sse2<3, 2, 1, 0>(frame, output); + } +diff --git a/src/multimedia/video/qvideoframeconversionhelper_ssse3.cpp b/src/multimedia/video/qvideoframeconversionhelper_ssse3.cpp +index c1acb9b..a5dfdda 100644 +--- a/src/multimedia/video/qvideoframeconversionhelper_ssse3.cpp ++++ b/src/multimedia/video/qvideoframeconversionhelper_ssse3.cpp +@@ -105,17 +105,17 @@ + convert_to_ARGB32_ssse3<0, 1, 2, 3>(frame, output); + } + +-void qt_convert_ABGR8888_to_ARGB32_ssse3(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_ABGR8888_to_ARGB32_ssse3(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_ssse3<0, 3, 2, 1>(frame, output); + } + +-void qt_convert_RGBA8888_to_ARGB32_ssse3(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_RGBA8888_to_ARGB32_ssse3(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_ssse3<3, 0, 1, 2>(frame, output); + } + +-void qt_convert_BGRA8888_to_ARGB32_ssse3(const QVideoFrame &frame, uchar *output) ++void QT_FASTCALL qt_convert_BGRA8888_to_ARGB32_ssse3(const QVideoFrame &frame, uchar *output) + { + convert_to_ARGB32_ssse3<3, 2, 1, 0>(frame, output); + } diff --git a/ports/qtmultimedia/FindGObject.patch b/ports/qtmultimedia/FindGObject.patch new file mode 100644 index 0000000000..d8af8a7b58 --- /dev/null +++ b/ports/qtmultimedia/FindGObject.patch @@ -0,0 +1,20 @@ +diff --git a/cmake/FindGObject.cmake b/cmake/FindGObject.cmake +index dc207a2..19a8a67 100644 +--- a/cmake/FindGObject.cmake ++++ b/cmake/FindGObject.cmake +@@ -27,13 +27,13 @@ + GLIB2::GLIB2 + ) + else() +- find_path(GGObject_INCLUDE_DIR ++ find_path(GObject_INCLUDE_DIR + NAMES gobject.h + PATH_SUFFIXES glib-2.0/gobject/ + ) + find_library(GObject_LIBRARY NAMES gobject-2.0) + if (GObject_LIBRARY AND GObject_INCLUDE_DIR) +- add_library(GObject::GObject IMPORTED) ++ add_library(GObject::GObject INTERFACE IMPORTED) + target_include_directories(GObject::GObject INTERFACE + ${GObject_INCLUDE_DIR} + ) diff --git a/ports/qtmultimedia/FindGStreamer.patch b/ports/qtmultimedia/FindGStreamer.patch new file mode 100644 index 0000000000..f958c4150d --- /dev/null +++ b/ports/qtmultimedia/FindGStreamer.patch @@ -0,0 +1,36 @@ +From 375d2c0ccb602df38ef8f49c5b3e0bf09c24bf46 Mon Sep 17 00:00:00 2001 +From: Joerg Bornemann +Date: Mon, 13 Sep 2021 10:50:03 +0200 +Subject: Fix build without pkg-config support + +Fix several issues in cmake/Find* in the code path that's hit when +pkg-config is not used. + +Pick-to: 6.2 +Task-number: QTBUG-96401 +Change-Id: Iac6af560976ba6408d877027ed44a0354d32d2b7 +Reviewed-by: Alexey Edelev +Reviewed-by: Doris Verria +--- + cmake/FindGStreamer.cmake | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +(limited to 'cmake/FindGStreamer.cmake') + +diff --git a/cmake/FindGStreamer.cmake b/cmake/FindGStreamer.cmake +index 0624c1a77..c3becd731 100644 +--- a/cmake/FindGStreamer.cmake ++++ b/cmake/FindGStreamer.cmake +@@ -53,8 +53,8 @@ function(find_gstreamer_component component prefix header library) + endif() + if(GStreamer_${component}_LIBRARY AND GStreamer_${component}_INCLUDE_DIR) + add_library(GStreamer::${component} INTERFACE IMPORTED) +- target_include_directories(GStreamer::${component} INTERFACE GStreamer_${component}_INCLUDE_DIR) +- target_link_libraries(GStreamer::${component} INTERFACE GStreamer_${component}_LIBRARY) ++ target_include_directories(GStreamer::${component} INTERFACE ${GStreamer_${component}_INCLUDE_DIR}) ++ target_link_libraries(GStreamer::${component} INTERFACE ${GStreamer_${component}_LIBRARY}) + endif() + mark_as_advanced(GStreamer_${component}_INCLUDE_DIR GStreamer_${component}_LIBRARY) + endif() +-- +cgit v1.2.1 diff --git a/ports/qtmultimedia/portfile.cmake b/ports/qtmultimedia/portfile.cmake index 35d706187b..45b1e99b8a 100644 --- a/ports/qtmultimedia/portfile.cmake +++ b/ports/qtmultimedia/portfile.cmake @@ -1,7 +1,11 @@ set(SCRIPT_PATH "${CURRENT_INSTALLED_DIR}/share/qtbase") include("${SCRIPT_PATH}/qt_install_submodule.cmake") -set(${PORT}_PATCHES fix_windows_header_include.patch) +set(${PORT}_PATCHES fix_windows_header_include.patch + FindGObject.patch + FindGStreamer.patch + remove_unistd.patch + 3c74340.diff) #Maybe TODO: ALSA + PulseAudio? (Missing Ports) diff --git a/ports/qtmultimedia/remove_unistd.patch b/ports/qtmultimedia/remove_unistd.patch new file mode 100644 index 0000000000..0f6d3ab15c --- /dev/null +++ b/ports/qtmultimedia/remove_unistd.patch @@ -0,0 +1,24 @@ +diff --git a/src/multimedia/platform/gstreamer/audio/qgstreameraudiosink.cpp b/src/multimedia/platform/gstreamer/audio/qgstreameraudiosink.cpp +index d4806b23a..f985a973b 100644 +--- a/src/multimedia/platform/gstreamer/audio/qgstreameraudiosink.cpp ++++ b/src/multimedia/platform/gstreamer/audio/qgstreameraudiosink.cpp +@@ -45,7 +45,6 @@ + #include "qgstreameraudiosink_p.h" + #include "qgstreameraudiodevice_p.h" + #include +-#include + + #include + #include +diff --git a/src/multimedia/platform/gstreamer/audio/qgstreameraudiosource.cpp b/src/multimedia/platform/gstreamer/audio/qgstreameraudiosource.cpp +index 51fc26c42..3b04a77bb 100644 +--- a/src/multimedia/platform/gstreamer/audio/qgstreameraudiosource.cpp ++++ b/src/multimedia/platform/gstreamer/audio/qgstreameraudiosource.cpp +@@ -45,7 +45,6 @@ + #include "qgstreameraudiosource_p.h" + #include "qgstreameraudiodevice_p.h" + #include +-#include + + #include + Q_DECLARE_OPAQUE_POINTER(GstSample *); diff --git a/ports/qtmultimedia/vcpkg.json b/ports/qtmultimedia/vcpkg.json index f354e57afa..ac882b76dd 100644 --- a/ports/qtmultimedia/vcpkg.json +++ b/ports/qtmultimedia/vcpkg.json @@ -1,6 +1,7 @@ { "name": "qtmultimedia", "version-semver": "6.2.0", + "port-version": 1, "description": "Qt Multimedia", "homepage": "https://www.qt.io/", "dependencies": [ @@ -11,6 +12,11 @@ "gui", "network" ] + }, + { + "name": "qtshadertools", + "host": true, + "default-features": false } ], "default-features": [ diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index a8543d49ca..1b69b56d9a 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -413,6 +413,7 @@ graphqlparser:arm-uwp=fail graphqlparser:x64-uwp=fail gsl:arm-uwp=fail gsl:x64-uwp=fail +gstreamer:x64-osx=fail gtk:x64-windows-static=fail gtk:x64-windows-static-md=fail gts:x64-osx=fail @@ -647,14 +648,6 @@ libmpeg2:x64-uwp=fail libmupdf:x64-osx=fail libmysql:x86-windows=fail libmysql:arm64-windows=fail -#The official website of libnice https://nice.freedesktop.org cannot be accessed -libnice:x86-windows=skip -libnice:x64-windows=skip -libnice:x64-windows-static=skip -libnice:x64-uwp=skip -libnice:arm64-windows=skip -libnice:x64-linux=skip -libnice:x64-osx=skip libopenmpt:x64-linux=fail libopenmpt:x64-osx=fail libopusenc:arm-uwp=fail diff --git a/versions/baseline.json b/versions/baseline.json index f50c2f5fd3..074755bb4a 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5562,7 +5562,7 @@ }, "qtbase": { "baseline": "6.2.0", - "port-version": 1 + "port-version": 2 }, "qtcharts": { "baseline": "6.2.0", @@ -5610,7 +5610,7 @@ }, "qtmultimedia": { "baseline": "6.2.0", - "port-version": 0 + "port-version": 1 }, "qtnetworkauth": { "baseline": "6.2.0", diff --git a/versions/q-/qtbase.json b/versions/q-/qtbase.json index 657fa7a5e6..c7b1a0fa7f 100644 --- a/versions/q-/qtbase.json +++ b/versions/q-/qtbase.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e7c78fd7fe6600eb96712f151670efc765bf5c31", + "version-semver": "6.2.0", + "port-version": 2 + }, { "git-tree": "01075dfd8097c54bd832400553958c2ff9bebf31", "version-semver": "6.2.0", diff --git a/versions/q-/qtmultimedia.json b/versions/q-/qtmultimedia.json index 7d485febd1..91d75b2b4d 100644 --- a/versions/q-/qtmultimedia.json +++ b/versions/q-/qtmultimedia.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e632d54bc7aea99a619c091cd43ea42e16ccefc2", + "version-semver": "6.2.0", + "port-version": 1 + }, { "git-tree": "3ddc9abc52e8df720dd1799b3ecaabe36bb5b7f3", "version-semver": "6.2.0",