depends: qt: update to 6.5.3

This commit is contained in:
tobtoht 2023-09-28 15:44:21 +02:00
parent 9c57ac7488
commit c9af89066b
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
7 changed files with 84 additions and 115 deletions

View file

@ -1,9 +1,9 @@
package=native_qt package=native_qt
$(package)_version=6.5.2 $(package)_version=6.5.3
$(package)_download_path=https://download.qt.io/official_releases/qt/6.5/$($(package)_version)/submodules $(package)_download_path=https://download.qt.io/official_releases/qt/6.5/$($(package)_version)/submodules
$(package)_suffix=everywhere-src-$($(package)_version).tar.xz $(package)_suffix=everywhere-src-$($(package)_version).tar.xz
$(package)_file_name=qtbase-$($(package)_suffix) $(package)_file_name=qtbase-$($(package)_suffix)
$(package)_sha256_hash=3db4c729b4d80a9d8fda8dd77128406353baff4755ca619177eda4cddae71269 $(package)_sha256_hash=df2f4a230be4ea04f9798f2c19ab1413a3b8ec6a80bef359f50284235307b546
$(package)_qt_libs=corelib network widgets gui plugins testlib $(package)_qt_libs=corelib network widgets gui plugins testlib
$(package)_patches = dont_hardcode_pwd.patch $(package)_patches = dont_hardcode_pwd.patch
$(package)_patches += fast_fixed_dtoa_no_optimize.patch $(package)_patches += fast_fixed_dtoa_no_optimize.patch
@ -13,16 +13,16 @@ $(package)_patches += rcc_hardcode_timestamp.patch
$(package)_patches += root_CMakeLists.txt $(package)_patches += root_CMakeLists.txt
$(package)_qttools_file_name=qttools-$($(package)_suffix) $(package)_qttools_file_name=qttools-$($(package)_suffix)
$(package)_qttools_sha256_hash=551ffb22751d8fd4d88e9ebd55b9131f4ca55341ee497fdbbba4da8d10d94341 $(package)_qttools_sha256_hash=fc91d32b3f696725bbb48b0df240c25b606bbee3bd22627cfcbee876a6405e37
$(package)_qtsvg_file_name=qtsvg-$($(package)_suffix) $(package)_qtsvg_file_name=qtsvg-$($(package)_suffix)
$(package)_qtsvg_sha256_hash=48b4cc1093af2e0ab3bea30f60651bddd877a2335d16e7207879a2e9e81963a3 $(package)_qtsvg_sha256_hash=fc41c47b69ca1f80473cd4b11996394155781105345392961d064d04f95d5bef
$(package)_qtmultimedia_file_name=qtmultimedia-$($(package)_suffix) $(package)_qtmultimedia_file_name=qtmultimedia-$($(package)_suffix)
$(package)_qtmultimedia_sha256_hash=948f00aa679e92839a2a71bd07245a92cc849af486607417ee4c334b2b998975 $(package)_qtmultimedia_sha256_hash=ed64f3d2bb98c20cd12df19dbf84dc0233d9fcb2078fea812adf42eef9a0ff27
$(package)_qtshadertools_file_name=qtshadertools-$($(package)_suffix) $(package)_qtshadertools_file_name=qtshadertools-$($(package)_suffix)
$(package)_qtshadertools_sha256_hash=ca3fb0db8576c59b9c38bb4b271cc6e10aebeb54e2121f429f4ee80671fc0a3d $(package)_qtshadertools_sha256_hash=201b7b3a409f048e78c5defb90a70af423166313ad4386f8e6b83990ae0f3573
$(package)_extra_sources += $($(package)_qttools_file_name) $(package)_extra_sources += $($(package)_qttools_file_name)
$(package)_extra_sources += $($(package)_qtsvg_file_name) $(package)_extra_sources += $($(package)_qtsvg_file_name)

View file

@ -1,13 +1,12 @@
package=qt package=qt
$(package)_version=6.5.2 $(package)_version=6.5.3
$(package)_download_path=https://download.qt.io/official_releases/qt/6.5/$($(package)_version)/submodules $(package)_download_path=https://download.qt.io/official_releases/qt/6.5/$($(package)_version)/submodules
$(package)_suffix=everywhere-src-$($(package)_version).tar.xz $(package)_suffix=everywhere-src-$($(package)_version).tar.xz
$(package)_file_name=qtbase-$($(package)_suffix) $(package)_file_name=qtbase-$($(package)_suffix)
$(package)_sha256_hash=3db4c729b4d80a9d8fda8dd77128406353baff4755ca619177eda4cddae71269 $(package)_sha256_hash=df2f4a230be4ea04f9798f2c19ab1413a3b8ec6a80bef359f50284235307b546
$(package)_darwin_dependencies=native_cctools native_qt openssl $(package)_darwin_dependencies=native_cctools native_qt openssl
$(package)_mingw32_dependencies=openssl native_qt $(package)_mingw32_dependencies=openssl native_qt
$(package)_linux_dependencies=openssl native_qt freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm libxcb_util_cursor dbus $(package)_linux_dependencies=openssl native_qt freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm libxcb_util_cursor dbus
$(package)_patches += dont_hardcode_pwd.patch
$(package)_patches += fast_fixed_dtoa_no_optimize.patch $(package)_patches += fast_fixed_dtoa_no_optimize.patch
$(package)_patches += guix_cross_lib_path.patch $(package)_patches += guix_cross_lib_path.patch
$(package)_patches += qtbase-moc-ignore-gcc-macro.patch $(package)_patches += qtbase-moc-ignore-gcc-macro.patch
@ -23,19 +22,19 @@ $(package)_patches += toolchain.cmake
#$(package)_patches += fix-static-fontconfig-static-linking.patch #$(package)_patches += fix-static-fontconfig-static-linking.patch
$(package)_qttools_file_name=qttools-$($(package)_suffix) $(package)_qttools_file_name=qttools-$($(package)_suffix)
$(package)_qttools_sha256_hash=551ffb22751d8fd4d88e9ebd55b9131f4ca55341ee497fdbbba4da8d10d94341 $(package)_qttools_sha256_hash=fc91d32b3f696725bbb48b0df240c25b606bbee3bd22627cfcbee876a6405e37
$(package)_qtsvg_file_name=qtsvg-$($(package)_suffix) $(package)_qtsvg_file_name=qtsvg-$($(package)_suffix)
$(package)_qtsvg_sha256_hash=48b4cc1093af2e0ab3bea30f60651bddd877a2335d16e7207879a2e9e81963a3 $(package)_qtsvg_sha256_hash=fc41c47b69ca1f80473cd4b11996394155781105345392961d064d04f95d5bef
$(package)_qtwebsockets_file_name=qtwebsockets-$($(package)_suffix) $(package)_qtwebsockets_file_name=qtwebsockets-$($(package)_suffix)
$(package)_qtwebsockets_sha256_hash=204bd7b0dffb54c934abc6cf0eb5e3016f11b3c9721a67b4875a6b21bb8b5c76 $(package)_qtwebsockets_sha256_hash=04e2ae17594d56cf2930c99dbd2a97eb88ff514b445c17ff7b86e8978fc7a7c3
$(package)_qtmultimedia_file_name=qtmultimedia-$($(package)_suffix) $(package)_qtmultimedia_file_name=qtmultimedia-$($(package)_suffix)
$(package)_qtmultimedia_sha256_hash=948f00aa679e92839a2a71bd07245a92cc849af486607417ee4c334b2b998975 $(package)_qtmultimedia_sha256_hash=ed64f3d2bb98c20cd12df19dbf84dc0233d9fcb2078fea812adf42eef9a0ff27
$(package)_qtshadertools_file_name=qtshadertools-$($(package)_suffix) $(package)_qtshadertools_file_name=qtshadertools-$($(package)_suffix)
$(package)_qtshadertools_sha256_hash=ca3fb0db8576c59b9c38bb4b271cc6e10aebeb54e2121f429f4ee80671fc0a3d $(package)_qtshadertools_sha256_hash=201b7b3a409f048e78c5defb90a70af423166313ad4386f8e6b83990ae0f3573
$(package)_extra_sources += $($(package)_qttools_file_name) $(package)_extra_sources += $($(package)_qttools_file_name)
$(package)_extra_sources += $($(package)_qtsvg_file_name) $(package)_extra_sources += $($(package)_qtsvg_file_name)
@ -171,7 +170,6 @@ endef
define $(package)_preprocess_cmds define $(package)_preprocess_cmds
cp $($(package)_patch_dir)/root_CMakeLists.txt CMakeLists.txt && \ cp $($(package)_patch_dir)/root_CMakeLists.txt CMakeLists.txt && \
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \ patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \ patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \ patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \

View file

@ -1,25 +1,16 @@
commit 0e953866fc4672486e29e1ba6d83b4207e7b2f0b diff --git a/qtbase/configure b/qtbase/configure
Author: fanquake <fanquake@gmail.com> index e57707dc..d8f6c934 100755
Date: Tue Aug 18 15:09:06 2020 +0800
Don't hardcode pwd path
Let a man use his builtins if he wants to! Also, removes the unnecessary
assumption that pwd lives under /bin/pwd.
See #15581.
--- a/qtbase/configure --- a/qtbase/configure
+++ b/qtbase/configure +++ b/qtbase/configure
@@ -34,9 +34,9 @@ @@ -9,9 +9,9 @@
# the directory of this script is the "source tree" # the directory of this script is the "source tree"
relpath=`dirname $0` relpath=`dirname "$0"`
-relpath=`(cd "$relpath"; /bin/pwd)` -relpath=`(cd "$relpath"; /bin/pwd)`
+relpath=`(cd "$relpath"; pwd)` +relpath=`(cd "$relpath"; pwd)`
# the current directory is the "build tree" or "object tree" # the current directory is the "build tree" or "object tree"
-outpath=`/bin/pwd` -outpath=`/bin/pwd`
+outpath=`pwd` +outpath=`pwd`
outpathPrefix=$outpath
# do this early so we don't store it in config.status # do this early so we don't store it in config.status
CFG_TOPLEVEL=

View file

@ -1,25 +0,0 @@
commit 0e953866fc4672486e29e1ba6d83b4207e7b2f0b
Author: fanquake <fanquake@gmail.com>
Date: Tue Aug 18 15:09:06 2020 +0800
Don't hardcode pwd path
Let a man use his builtins if he wants to! Also, removes the unnecessary
assumption that pwd lives under /bin/pwd.
See #15581.
--- a/qtbase/configure
+++ b/qtbase/configure
@@ -34,9 +34,9 @@
# the directory of this script is the "source tree"
relpath=`dirname $0`
-relpath=`(cd "$relpath"; /bin/pwd)`
+relpath=`(cd "$relpath"; pwd)`
# the current directory is the "build tree" or "object tree"
-outpath=`/bin/pwd`
+outpath=`pwd`
# do this early so we don't store it in config.status
CFG_TOPLEVEL=

View file

@ -41,16 +41,16 @@ index 2f4633c34..35a276cb4 100644
set(WMF_LIBRARIES ${WMF_STRMIIDS_LIBRARY} ${WMF_AMSTRMID_LIBRARY} ${WMF_DMOGUIDS_LIBRARY} ${WMF_UUID_LIBRARY} set(WMF_LIBRARIES ${WMF_STRMIIDS_LIBRARY} ${WMF_AMSTRMID_LIBRARY} ${WMF_DMOGUIDS_LIBRARY} ${WMF_UUID_LIBRARY}
diff --git a/src/multimedia/configure.cmake b/src/multimedia/configure.cmake diff --git a/src/multimedia/configure.cmake b/src/multimedia/configure.cmake
index 7fdb0af3a..868e91ba4 100644 index 609806507..40b1b9b36 100644
--- a/src/multimedia/configure.cmake --- a/src/multimedia/configure.cmake
+++ b/src/multimedia/configure.cmake +++ b/src/multimedia/configure.cmake
@@ -24,7 +24,6 @@ qt_find_package(WrapPulseAudio PROVIDED_TARGETS WrapPulseAudio::WrapPulseAudio M @@ -24,7 +24,6 @@ qt_find_package(WrapPulseAudio PROVIDED_TARGETS WrapPulseAudio::WrapPulseAudio M
qt_find_package(WMF PROVIDED_TARGETS WMF::WMF MODULE_NAME multimedia QMAKE_LIB wmf) qt_find_package(WMF PROVIDED_TARGETS WMF::WMF MODULE_NAME multimedia QMAKE_LIB wmf)
qt_find_package(EGL) qt_find_package(EGL)
-qt_find_package(FFmpeg OPTIONAL_COMPONENTS AVCODEC AVFORMAT AVUTIL AVDEVICE SWRESAMPLE SWSCALE PROVIDED_TARGETS FFmpeg::avcodec FFmpeg::avformat FFmpeg::avutil FFmpeg::avdevice FFmpeg::swresample FFmpeg::swscale MODULE_NAME multimedia QMAKE_LIB ffmpeg) -qt_find_package(FFmpeg OPTIONAL_COMPONENTS AVCODEC AVFORMAT AVUTIL AVDEVICE SWRESAMPLE SWSCALE PROVIDED_TARGETS FFmpeg::avcodec FFmpeg::avformat FFmpeg::avutil FFmpeg::avdevice FFmpeg::swresample FFmpeg::swscale MODULE_NAME multimedia QMAKE_LIB ffmpeg)
qt_find_package(VAAPI COMPONENTS VA DRM PROVIDED_TARGETS VAAPI::VA VAAPI::DRM MODULE_NAME multimedia QMAKE_LIB vaapi) qt_find_package(VAAPI COMPONENTS VA DRM PROVIDED_TARGETS VAAPI::VAAPI MODULE_NAME multimedia QMAKE_LIB vaapi)
#### Tests #### Tests
@@ -76,7 +75,7 @@ qt_feature("ffmpeg" PRIVATE @@ -76,7 +75,7 @@ qt_feature("ffmpeg" PRIVATE
LABEL "FFmpeg" LABEL "FFmpeg"

View file

@ -23,6 +23,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_C_FLAGS "@cmake_c_flags@") set(CMAKE_C_FLAGS "@cmake_c_flags@")
set(CMAKE_CXX_FLAGS "@cmake_cxx_flags@") set(CMAKE_CXX_FLAGS "@cmake_cxx_flags@")
set(CMAKE_OBJC_FLAGS "@cmake_c_flags@")
set(CMAKE_OBJCXX_FLAGS "@cmake_cxx_flags@")
set(CMAKE_INSTALL_NAME_TOOL @target@-install_name_tool) set(CMAKE_INSTALL_NAME_TOOL @target@-install_name_tool)
endif() endif()

View file

@ -670,10 +670,10 @@ index 000000000..e34005bbf
+#endif +#endif
diff --git a/src/plugins/multimedia/v4l2/qffmpegmediaintegration.cpp b/src/plugins/multimedia/v4l2/qffmpegmediaintegration.cpp diff --git a/src/plugins/multimedia/v4l2/qffmpegmediaintegration.cpp b/src/plugins/multimedia/v4l2/qffmpegmediaintegration.cpp
new file mode 100644 new file mode 100644
index 000000000..c07c0ebc7 index 000000000..44d81e489
--- /dev/null --- /dev/null
+++ b/src/plugins/multimedia/v4l2/qffmpegmediaintegration.cpp +++ b/src/plugins/multimedia/v4l2/qffmpegmediaintegration.cpp
@@ -0,0 +1,130 @@ @@ -0,0 +1,123 @@
+// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+ +
@ -722,8 +722,6 @@ index 000000000..c07c0ebc7
+ +
+QFFmpegMediaIntegration::QFFmpegMediaIntegration() +QFFmpegMediaIntegration::QFFmpegMediaIntegration()
+{ +{
+ m_formatsInfo = new QFFmpegMediaFormatInfo();
+
+#if QT_CONFIG(linux_v4l) +#if QT_CONFIG(linux_v4l)
+ m_videoDevices = std::make_unique<QV4L2CameraDevices>(this); + m_videoDevices = std::make_unique<QV4L2CameraDevices>(this);
+#endif +#endif
@ -741,14 +739,9 @@ index 000000000..c07c0ebc7
+#endif +#endif
+} +}
+ +
+QFFmpegMediaIntegration::~QFFmpegMediaIntegration() +QPlatformMediaFormatInfo *QFFmpegMediaIntegration::createFormatInfo()
+{ +{
+ delete m_formatsInfo; + return new QFFmpegMediaFormatInfo();
+}
+
+QPlatformMediaFormatInfo *QFFmpegMediaIntegration::formatInfo()
+{
+ return m_formatsInfo;
+} +}
+ +
+QMaybe<QPlatformMediaCaptureSession *> QFFmpegMediaIntegration::createCaptureSession() +QMaybe<QPlatformMediaCaptureSession *> QFFmpegMediaIntegration::createCaptureSession()
@ -806,10 +799,10 @@ index 000000000..c07c0ebc7
+#include "qffmpegmediaintegration.moc" +#include "qffmpegmediaintegration.moc"
diff --git a/src/plugins/multimedia/v4l2/qffmpegmediaintegration_p.h b/src/plugins/multimedia/v4l2/qffmpegmediaintegration_p.h diff --git a/src/plugins/multimedia/v4l2/qffmpegmediaintegration_p.h b/src/plugins/multimedia/v4l2/qffmpegmediaintegration_p.h
new file mode 100644 new file mode 100644
index 000000000..8b44da741 index 000000000..905c3efd5
--- /dev/null --- /dev/null
+++ b/src/plugins/multimedia/v4l2/qffmpegmediaintegration_p.h +++ b/src/plugins/multimedia/v4l2/qffmpegmediaintegration_p.h
@@ -0,0 +1,43 @@ @@ -0,0 +1,45 @@
+// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+ +
@ -837,17 +830,19 @@ index 000000000..8b44da741
+{ +{
+public: +public:
+ QFFmpegMediaIntegration(); + QFFmpegMediaIntegration();
+ ~QFFmpegMediaIntegration();
+ +
+ static QFFmpegMediaIntegration *instance() { return static_cast<QFFmpegMediaIntegration *>(QPlatformMediaIntegration::instance()); } + static QFFmpegMediaIntegration *instance()
+ QPlatformMediaFormatInfo *formatInfo() override; + {
+ return static_cast<QFFmpegMediaIntegration *>(QPlatformMediaIntegration::instance());
+ }
+ +
+ QMaybe<QPlatformMediaCaptureSession *> createCaptureSession() override; + QMaybe<QPlatformMediaCaptureSession *> createCaptureSession() override;
+ QMaybe<QPlatformCamera *> createCamera(QCamera *) override; + QMaybe<QPlatformCamera *> createCamera(QCamera *) override;
+ QMaybe<QPlatformImageCapture *> createImageCapture(QImageCapture *) override; + QMaybe<QPlatformImageCapture *> createImageCapture(QImageCapture *) override;
+ QMaybe<QPlatformVideoSink *> createVideoSink(QVideoSink *sink) override; + QMaybe<QPlatformVideoSink *> createVideoSink(QVideoSink *sink) override;
+ +
+ QFFmpegMediaFormatInfo *m_formatsInfo = nullptr; +protected:
+ QPlatformMediaFormatInfo *createFormatInfo() override;
+}; +};
+ +
+QT_END_NAMESPACE +QT_END_NAMESPACE
@ -1037,10 +1032,10 @@ index 000000000..cbaa810d7
+#endif +#endif
diff --git a/src/plugins/multimedia/v4l2/qv4l2camera.cpp b/src/plugins/multimedia/v4l2/qv4l2camera.cpp diff --git a/src/plugins/multimedia/v4l2/qv4l2camera.cpp b/src/plugins/multimedia/v4l2/qv4l2camera.cpp
new file mode 100644 new file mode 100644
index 000000000..0f7a8c91a index 000000000..b635a7fce
--- /dev/null --- /dev/null
+++ b/src/plugins/multimedia/v4l2/qv4l2camera.cpp +++ b/src/plugins/multimedia/v4l2/qv4l2camera.cpp
@@ -0,0 +1,940 @@ @@ -0,0 +1,949 @@
+// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+ +
@ -1069,28 +1064,38 @@ index 000000000..0f7a8c91a
+ +
+QT_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE
+ +
+Q_LOGGING_CATEGORY(qLV4L2Camera, "qt.multimedia.ffmpeg.v4l2camera"); +static Q_LOGGING_CATEGORY(qLV4L2Camera, "qt.multimedia.ffmpeg.v4l2camera");
+
+static bool areCamerasEqual(QList<QCameraDevice> a, QList<QCameraDevice> b) {
+ auto areCamerasDataEqual = [](const QCameraDevice& a, const QCameraDevice& b) {
+ Q_ASSERT(QCameraDevicePrivate::handle(a));
+ Q_ASSERT(QCameraDevicePrivate::handle(b));
+ return *QCameraDevicePrivate::handle(a) == *QCameraDevicePrivate::handle(b);
+ };
+
+ return std::equal(a.cbegin(), a.cend(), b.cbegin(), b.cend(), areCamerasDataEqual);
+}
+ +
+QV4L2CameraDevices::QV4L2CameraDevices(QPlatformMediaIntegration *integration) +QV4L2CameraDevices::QV4L2CameraDevices(QPlatformMediaIntegration *integration)
+ : QPlatformVideoDevices(integration) + : QPlatformVideoDevices(integration)
+{ +{
+ deviceWatcher.addPath(QLatin1String("/dev")); + m_deviceWatcher.addPath(QLatin1String("/dev"));
+ connect(&deviceWatcher, &QFileSystemWatcher::directoryChanged, this, &QV4L2CameraDevices::checkCameras); + connect(&m_deviceWatcher, &QFileSystemWatcher::directoryChanged, this, &QV4L2CameraDevices::checkCameras);
+ doCheckCameras(); + doCheckCameras();
+} +}
+ +
+QList<QCameraDevice> QV4L2CameraDevices::videoDevices() const +QList<QCameraDevice> QV4L2CameraDevices::videoDevices() const
+{ +{
+ return cameras; + return m_cameras;
+} +}
+ +
+void QV4L2CameraDevices::checkCameras() +void QV4L2CameraDevices::checkCameras()
+{ +{
+ doCheckCameras(); + if (doCheckCameras())
+ videoInputsChanged(); + emit videoInputsChanged();
+} +}
+ +
+const struct { +static const struct {
+ QVideoFrameFormat::PixelFormat fmt; + QVideoFrameFormat::PixelFormat fmt;
+ uint32_t v4l2Format; + uint32_t v4l2Format;
+} formatMap[] = { +} formatMap[] = {
@ -1139,9 +1144,9 @@ index 000000000..0f7a8c91a
+} +}
+ +
+ +
+void QV4L2CameraDevices::doCheckCameras() +bool QV4L2CameraDevices::doCheckCameras()
+{ +{
+ cameras.clear(); + QList<QCameraDevice> newCameras;
+ +
+ QDir dir(QLatin1String("/dev")); + QDir dir(QLatin1String("/dev"));
+ const auto devices = dir.entryList(QDir::System); + const auto devices = dir.entryList(QDir::System);
@ -1154,25 +1159,27 @@ index 000000000..0f7a8c91a
+ continue; + continue;
+ +
+ QByteArray file = QFile::encodeName(dir.filePath(device)); + QByteArray file = QFile::encodeName(dir.filePath(device));
+ int fd = open(file.constData(), O_RDONLY); + const int fd = open(file.constData(), O_RDONLY);
+ if (fd < 0) + if (fd < 0)
+ continue; + continue;
+ +
+ QCameraDevicePrivate *camera = nullptr; + auto fileCloseGuard = qScopeGuard([fd](){ close(fd); });
+
+ v4l2_fmtdesc formatDesc = {}; + v4l2_fmtdesc formatDesc = {};
+ +
+ struct v4l2_capability cap; + struct v4l2_capability cap;
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0) + if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0)
+ goto fail; + continue;
+ +
+ if (cap.device_caps & V4L2_CAP_META_CAPTURE) + if (cap.device_caps & V4L2_CAP_META_CAPTURE)
+ goto fail; + continue;
+ if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) + if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE))
+ goto fail; + continue;
+ if (!(cap.capabilities & V4L2_CAP_STREAMING)) + if (!(cap.capabilities & V4L2_CAP_STREAMING))
+ goto fail; + continue;
+
+ auto camera = std::make_unique<QCameraDevicePrivate>();
+ +
+ camera = new QCameraDevicePrivate;
+ camera->id = file; + camera->id = file;
+ camera->description = QString::fromUtf8((const char *)cap.card); + camera->description = QString::fromUtf8((const char *)cap.card);
+// qCDebug(qLV4L2Camera) << "found camera" << camera->id << camera->description; +// qCDebug(qLV4L2Camera) << "found camera" << camera->id << camera->description;
@ -1193,6 +1200,7 @@ index 000000000..0f7a8c91a
+ frameSize.pixel_format = formatDesc.pixelformat; + frameSize.pixel_format = formatDesc.pixelformat;
+ +
+ while (!ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frameSize)) { + while (!ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frameSize)) {
+ ++frameSize.index;
+ if (frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE) + if (frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE)
+ continue; + continue;
+ +
@ -1206,9 +1214,9 @@ index 000000000..0f7a8c91a
+ frameInterval.height = frameSize.discrete.height; + frameInterval.height = frameSize.discrete.height;
+ +
+ while (!ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frameInterval)) { + while (!ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frameInterval)) {
+ ++frameInterval.index;
+ if (frameInterval.type != V4L2_FRMIVAL_TYPE_DISCRETE) + if (frameInterval.type != V4L2_FRMIVAL_TYPE_DISCRETE)
+ continue; + continue;
+ ++frameInterval.index;
+ float rate = float(frameInterval.discrete.denominator)/float(frameInterval.discrete.numerator); + float rate = float(frameInterval.discrete.denominator)/float(frameInterval.discrete.numerator);
+ if (rate > max) + if (rate > max)
+ max = rate; + max = rate;
@ -1217,15 +1225,14 @@ index 000000000..0f7a8c91a
+ } + }
+ +
+// qCDebug(qLV4L2Camera) << " " << resolution << min << max; +// qCDebug(qLV4L2Camera) << " " << resolution << min << max;
+ ++frameSize.index;
+ +
+ if (min <= max) { + if (min <= max) {
+ QCameraFormatPrivate *fmt = new QCameraFormatPrivate; + auto fmt = std::make_unique<QCameraFormatPrivate>();
+ fmt->pixelFormat = pixelFmt; + fmt->pixelFormat = pixelFmt;
+ fmt->resolution = resolution; + fmt->resolution = resolution;
+ fmt->minFrameRate = min; + fmt->minFrameRate = min;
+ fmt->maxFrameRate = max; + fmt->maxFrameRate = max;
+ camera->videoFormats.append(fmt->create()); + camera->videoFormats.append(fmt.release()->create());
+ camera->photoResolutions.append(resolution); + camera->photoResolutions.append(resolution);
+ } + }
+ } + }
@ -1234,19 +1241,16 @@ index 000000000..0f7a8c91a
+ } + }
+ +
+ // first camera is default + // first camera is default
+ camera->isDefault = first; + camera->isDefault = std::exchange(first, false);
+ first = false;
+ +
+ cameras.append(camera->create()); + newCameras.append(camera.release()->create());
+
+ close(fd);
+ continue;
+
+ fail:
+ if (camera)
+ delete camera;
+ close(fd);
+ } + }
+
+ if (areCamerasEqual(m_cameras, newCameras))
+ return false;
+
+ m_cameras = std::move(newCameras);
+ return true;
+} +}
+ +
+class QV4L2VideoBuffer : public QAbstractVideoBuffer +class QV4L2VideoBuffer : public QAbstractVideoBuffer
@ -1983,10 +1987,10 @@ index 000000000..0f7a8c91a
+QT_END_NAMESPACE +QT_END_NAMESPACE
diff --git a/src/plugins/multimedia/v4l2/qv4l2camera_p.h b/src/plugins/multimedia/v4l2/qv4l2camera_p.h diff --git a/src/plugins/multimedia/v4l2/qv4l2camera_p.h b/src/plugins/multimedia/v4l2/qv4l2camera_p.h
new file mode 100644 new file mode 100644
index 000000000..714b4c1db index 000000000..f5df691c3
--- /dev/null --- /dev/null
+++ b/src/plugins/multimedia/v4l2/qv4l2camera_p.h +++ b/src/plugins/multimedia/v4l2/qv4l2camera_p.h
@@ -0,0 +1,160 @@ @@ -0,0 +1,159 @@
+// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+ +
@ -2014,8 +2018,7 @@ index 000000000..714b4c1db
+ +
+QT_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE
+ +
+class QV4L2CameraDevices : public QObject, +class QV4L2CameraDevices : public QPlatformVideoDevices
+ public QPlatformVideoDevices
+{ +{
+ Q_OBJECT + Q_OBJECT
+public: +public:
@ -2027,10 +2030,10 @@ index 000000000..714b4c1db
+ void checkCameras(); + void checkCameras();
+ +
+private: +private:
+ void doCheckCameras(); + bool doCheckCameras();
+ +
+ QList<QCameraDevice> cameras; + QList<QCameraDevice> m_cameras;
+ QFileSystemWatcher deviceWatcher; + QFileSystemWatcher m_deviceWatcher;
+}; +};
+ +
+struct QV4L2CameraBuffers +struct QV4L2CameraBuffers