Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qplatformlibcameraintegration.cpp
Go to the documentation of this file.
1
// Copyright (C) 2026 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
include
"qplatformlibcameraintegration_p.h"
5
6
#
include
<
QtMultimedia
/
private
/
qplatformlibcameraplugin_p
.
h
>
7
8
#
include
<
QtCore
/
qapplicationstatic
.
h
>
9
#
include
<
QtCore
/
private
/
qfactoryloader_p
.
h
>
10
11
QT_BEGIN_NAMESPACE
12
13
namespace
QLibCamera
{
14
15
Q_STATIC_LOGGING_CATEGORY(
qLcMediaPlugin
,
"qt.multimedia.plugin"
)
16
17
QPlatformLibCameraIntegration
::
QPlatformLibCameraIntegration
(
QObject
*
parent
) :
QObject
(
parent
) { }
18
QPlatformLibCameraIntegration
::~
QPlatformLibCameraIntegration
() =
default
;
19
20
namespace
{
21
22
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, libCameraLoader,
23
(QPlatformLibCameraPlugin_iid, QLatin1String(
"/libcamera"
)))
24
25
struct
LibCameraInstanceHolder
26
{
27
LibCameraInstanceHolder() { init(); }
28
29
void
init()
30
{
31
qCDebug(qLcMediaPlugin) <<
"Loading libcamera plugin"
;
32
QObject *factoryObject = libCameraLoader()->instance(0);
33
if
(
auto
*factory = qobject_cast<QPlatformLibCameraPlugin *>(factoryObject))
34
instance = factory->create();
35
36
if
(!instance)
37
qCWarning(qLcMediaPlugin)
38
<<
"libcamera plugin failed to load; falling back to the platform's default "
39
"camera support"
;
40
}
41
42
std::unique_ptr<QPlatformLibCameraIntegration> instance;
43
};
44
45
Q_APPLICATION_STATIC(LibCameraInstanceHolder, s_libCameraInstanceHolder);
46
47
}
// namespace
48
49
QPlatformLibCameraIntegration
*
libCameraIntegration
()
50
{
51
return
s_libCameraInstanceHolder->instance.get();
52
}
53
54
}
// namespace QLibCamera
55
56
QT_END_NAMESPACE
57
58
#
include
"moc_qplatformlibcameraintegration_p.cpp"
QLibCamera
Definition
qplatformlibcameraintegration.cpp:13
QLibCamera::libCameraIntegration
QPlatformLibCameraIntegration * libCameraIntegration()
Definition
qplatformlibcameraintegration.cpp:49
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtmultimedia
src
multimedia
platform
qplatformlibcameraintegration.cpp
Generated on
for Qt by
1.18.0