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
qpipewire_instance.cpp
Go to the documentation of this file.
1
// Copyright (C) 2025 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
"qpipewire_instance_p.h"
5
6
#
include
<
QtMultimedia
/
private
/
qtmultimediaglobal_p
.
h
>
7
8
#
include
"qpipewire_support_p.h"
9
#
if
QT_CONFIG
(
pipewire_symbolloader
)
10
#
include
"qpipewire_symbolloader_p.h"
11
#
endif
12
13
#
include
<
QtCore
/
qmutex
.
h
>
14
#
include
<
mutex
>
15
16
QT_BEGIN_NAMESPACE
17
18
namespace
QtPipeWire
{
19
20
Q_LOGGING_CATEGORY
(
lcPipewire
,
"qt.multimedia.pipewire"
);
21
22
namespace
{
23
24
struct
InstanceHolder
25
{
26
QMutex mutex;
27
std
::weak_ptr<
QPipeWireInstance
> instance;
28
};
29
30
Q_GLOBAL_STATIC(InstanceHolder, s_pipeWireInstance);
31
32
}
// namespace
33
34
std
::shared_ptr<
QPipeWireInstance
>
QPipeWireInstance
::instance()
35
{
36
std
::lock_guard guard{ s_pipeWireInstance->mutex };
37
std
::shared_ptr<
QPipeWireInstance
> ret = s_pipeWireInstance->instance.lock();
38
if
(!ret) {
39
ret =
std
::make_shared<
QPipeWireInstance
>();
40
s_pipeWireInstance->instance = ret;
41
}
42
return
ret;
43
}
44
45
bool
QPipeWireInstance
::
isLoaded
()
46
{
47
#
if
QT_CONFIG
(
pipewire_symbolloader
)
48
return
qPipewireIsLoaded();
49
#
else
50
return
1;
51
#
endif
52
}
53
54
QPipeWireInstance
::
QPipeWireInstance
()
55
{
56
pw_init(
nullptr
,
nullptr
);
57
58
qCDebug(lcPipewire) <<
"PipeWire initialized: compiled against"
<< pw_get_headers_version()
59
<<
" running "
<< pw_get_library_version();
60
}
61
62
QPipeWireInstance
::~
QPipeWireInstance
()
63
{
64
if
(
pw_check_library_version
(
0
,
3
,
49
)
)
65
pw_deinit();
66
}
67
68
}
// namespace QtPipeWire
69
70
QT_END_NAMESPACE
QtPipeWire::QPipeWireInstance
Definition
qpipewire_instance_p.h:30
QtPipeWire::QPipeWireInstance::QPipeWireInstance
QPipeWireInstance()
Definition
qpipewire_instance.cpp:54
QtPipeWire::QPipeWireInstance::isLoaded
static bool isLoaded()
Definition
qpipewire_instance.cpp:45
QtPipeWire::QPipeWireInstance::~QPipeWireInstance
~QPipeWireInstance()
Definition
qpipewire_instance.cpp:62
QtPipeWire
Definition
qpipewire_async_support.cpp:10
QtPipeWire::Q_LOGGING_CATEGORY
Q_LOGGING_CATEGORY(lcPipewire, "qt.multimedia.pipewire")
QtPipeWire::Q_DECLARE_LOGGING_CATEGORY
Q_DECLARE_LOGGING_CATEGORY(lcPipewire)
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
pw_check_library_version
bool pw_check_library_version(int major, int minor, int micro)
qtmultimedia
src
multimedia
pipewire
qpipewire_instance.cpp
Generated on
for Qt by
1.16.1