Nesta página

Qt Multimedia no Windows

Esta página aborda considerações sobre o uso d Qt Multimedia no Windows.

Notas sobre COM

Qt Multimedia utiliza APIs COM da plataforma Windows. Isso requer que o COM seja inicializado nas threads que acessam as APIs d Qt Multimedia. Embora as APIs d Qt Multimedia inicializem automaticamente o COM conforme necessário, recomendamos inicializar a instância do QGuiApplication a partir da thread principal durante a inicialização do aplicativo, antes de fazer qualquer chamada às APIs d Qt Multimedia. Isso garante que o apartamento de thread único principal (STA principal) seja inicializado antes que as APIs Qt Multimedia sejam chamadas a partir de qualquer thread. Isso também garante que o STA principal não seja desinicializado até que todos os outros apartamentos tenham sido encerrados.

Qt Multimedia As APIs que exigem COM inicializarão a thread como um apartamento de thread único chamando ` CoInitializeEx(nullptr, COINIT_APARTMENT_THREADED)`, e ` CoUninitialize ` não será chamado até que a thread seja encerrada. Isso se aplica também à thread principal do aplicativo, onde ` CoUninitialize ` é chamado durante a destruição de variáveis estáticas.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.