Skip to content

Commit

Permalink
[qt] Fix qtmultimedia with gstreamer on windows (#20555)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Neumann-A committed Oct 11, 2021
1 parent 694b757 commit 1d4128f
Show file tree
Hide file tree
Showing 13 changed files with 247 additions and 12 deletions.
13 changes: 13 additions & 0 deletions ports/qtbase/fix_qthread_max.patch
Original file line number Diff line number Diff line change
@@ -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<unsigned long>::max())
+ if (time == (std::numeric_limits<unsigned long>::max)())
return wait(QDeadlineTimer(QDeadlineTimer::Forever));
return wait(QDeadlineTimer(time));
}
1 change: 1 addition & 0 deletions ports/qtbase/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ports/qtbase/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
128 changes: 128 additions & 0 deletions ports/qtmultimedia/3c74340.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
From 3c7434025c5e14c2b3027a13ce90aab49712156c Mon Sep 17 00:00:00 2001
From: André de la Rocha <andre.rocha@qt.io>
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 <lars.knoll@qt.io>
---

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);
}
20 changes: 20 additions & 0 deletions ports/qtmultimedia/FindGObject.patch
Original file line number Diff line number Diff line change
@@ -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}
)
36 changes: 36 additions & 0 deletions ports/qtmultimedia/FindGStreamer.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 375d2c0ccb602df38ef8f49c5b3e0bf09c24bf46 Mon Sep 17 00:00:00 2001
From: Joerg Bornemann <joerg.bornemann@qt.io>
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 <alexey.edelev@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
---
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
6 changes: 5 additions & 1 deletion ports/qtmultimedia/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
24 changes: 24 additions & 0 deletions ports/qtmultimedia/remove_unistd.patch
Original file line number Diff line number Diff line change
@@ -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 <sys/types.h>
-#include <unistd.h>

#include <private/qgstpipeline_p.h>
#include <private/qgstappsrc_p.h>
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 <sys/types.h>
-#include <unistd.h>

#include <gst/gst.h>
Q_DECLARE_OPAQUE_POINTER(GstSample *);
6 changes: 6 additions & 0 deletions ports/qtmultimedia/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "qtmultimedia",
"version-semver": "6.2.0",
"port-version": 1,
"description": "Qt Multimedia",
"homepage": "https://www.qt.io/",
"dependencies": [
Expand All @@ -11,6 +12,11 @@
"gui",
"network"
]
},
{
"name": "qtshadertools",
"host": true,
"default-features": false
}
],
"default-features": [
Expand Down
9 changes: 1 addition & 8 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5562,7 +5562,7 @@
},
"qtbase": {
"baseline": "6.2.0",
"port-version": 1
"port-version": 2
},
"qtcharts": {
"baseline": "6.2.0",
Expand Down Expand Up @@ -5610,7 +5610,7 @@
},
"qtmultimedia": {
"baseline": "6.2.0",
"port-version": 0
"port-version": 1
},
"qtnetworkauth": {
"baseline": "6.2.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/q-/qtbase.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e7c78fd7fe6600eb96712f151670efc765bf5c31",
"version-semver": "6.2.0",
"port-version": 2
},
{
"git-tree": "01075dfd8097c54bd832400553958c2ff9bebf31",
"version-semver": "6.2.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/q-/qtmultimedia.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e632d54bc7aea99a619c091cd43ea42e16ccefc2",
"version-semver": "6.2.0",
"port-version": 1
},
{
"git-tree": "3ddc9abc52e8df720dd1799b3ecaabe36bb5b7f3",
"version-semver": "6.2.0",
Expand Down

0 comments on commit 1d4128f

Please sign in to comment.