Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
platform-notes-windows.qdoc
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qtmultimedia-windows.html
6\title Qt Multimedia on Windows
7\brief Platform notes for Windows
8
9This page discusses considerations for using Qt Multimedia on Windows.
10
11\section1 Notes on COM
12
13Qt Multimedia uses COM APIs from the Windows platform. This requires COM
14to be initialized on the threads that access Qt Multimedia APIs.
15Although Qt Multimedia APIs will automatically initialize COM as needed,
16we recommend initializing the QGuiApplication instance from the main
17thread during application startup before making any calls to Qt
18Multimedia APIs. This ensures that the main single threaded apartment
19(main STA) is initialized before Qt Multimedia APIs are called from any
20thread. This also guarantees that the main STA is not uninitialized
21until all other apartments have shut down.
22
23Qt Multimedia APIs that require COM will initialize the thread as a
24single-threaded apartment by calling \c{CoInitializeEx(nullptr,
25COINIT_APARTMENT_THREADED)}, and \c{CoUninitialize} will not be called
26until the thread exits. This applies to the main application thread as
27well, where \c{CoUninitialize} is called during the destruction of
28static variables.
29*/