summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Dubsky <pavel.dubsky@qt.io>2023-04-25 12:29:49 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-26 11:59:34 +0000
commite95692cbfc2771c50b2413a4ac0bdb9015cc7821 (patch)
tree2be1a367d19c154403c8328280fda9de3321f4fe
parent56c865762f87f721180d313c2afd449d87d6f05e (diff)
downloadqtmultimedia-e95692cbfc2771c50b2413a4ac0bdb9015cc7821.tar.gz
Fix QMediaDevices::videoInputs returning an empty list
When QMediaDevices::videoInputs is called without prior call to QMediaDevices::audioOutputs the returned list is empty but if the latter call is present everything works as it should. The reason is a missing call to CoInitialize inside internal Windows-specific implementation. Task-number: QTBUG-112702 Change-Id: I462d3cf15f65329415539eb1bdde6be65ab9a407 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 1689940a061235545d6cc316fcc924284e7c3f1b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/multimedia/windows/qwindowsvideodevices.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/multimedia/windows/qwindowsvideodevices.cpp b/src/plugins/multimedia/windows/qwindowsvideodevices.cpp
index 878c4730b..409e26a19 100644
--- a/src/plugins/multimedia/windows/qwindowsvideodevices.cpp
+++ b/src/plugins/multimedia/windows/qwindowsvideodevices.cpp
@@ -59,6 +59,8 @@ static HWND createMessageOnlyWindow()
QWindowsVideoDevices::QWindowsVideoDevices(QPlatformMediaIntegration *integration)
: QPlatformVideoDevices(integration)
{
+ CoInitialize(nullptr);
+
m_videoDeviceMsgWindow = createMessageOnlyWindow();
if (m_videoDeviceMsgWindow) {
SetWindowLongPtr(m_videoDeviceMsgWindow, GWLP_USERDATA, (LONG_PTR)this);
@@ -93,6 +95,8 @@ QWindowsVideoDevices::~QWindowsVideoDevices()
DestroyWindow(m_videoDeviceMsgWindow);
UnregisterClass(windowClassName, GetModuleHandle(nullptr));
}
+
+ CoUninitialize();
}
static std::optional<QCameraFormat> createCameraFormat(IMFMediaType *mediaFormat)