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
"qpipewire_symbolloader_p.h"
7
#
include
"qpipewire_support_p.h"
8
9
#
include
<
QtCore
/
qmutex
.
h
>
10
#
include
<
mutex
>
11
12
QT_BEGIN_NAMESPACE
13
14
namespace
QtPipeWire
{
15
16
Q_LOGGING_CATEGORY
(
lcPipewire
,
"qt.multimedia.pipewire"
);
17
18
namespace
{
19
20
struct
InstanceHolder
21
{
22
QMutex mutex;
23
std
::weak_ptr<
QPipeWireInstance
> instance;
24
};
25
26
Q_GLOBAL_STATIC(InstanceHolder, s_pipeWireInstance);
27
28
}
// namespace
29
30
std
::shared_ptr<
QPipeWireInstance
>
QPipeWireInstance
::instance()
31
{
32
std
::lock_guard guard{ s_pipeWireInstance->mutex };
33
std
::shared_ptr<
QPipeWireInstance
> ret = s_pipeWireInstance->instance.lock();
34
if
(!ret) {
35
ret =
std
::make_shared<
QPipeWireInstance
>();
36
s_pipeWireInstance->instance = ret;
37
}
38
return
ret;
39
}
40
41
bool
QPipeWireInstance
::
isLoaded
()
42
{
43
return
qPipewireIsLoaded();
44
}
45
46
QPipeWireInstance
::
QPipeWireInstance
()
47
{
48
pw_init(
nullptr
,
nullptr
);
49
50
qCDebug(lcPipewire) <<
"PipeWire initialized: compiled against"
<< pw_get_headers_version()
51
<<
" running "
<< pw_get_library_version();
52
}
53
54
QPipeWireInstance
::~
QPipeWireInstance
()
55
{
56
if
(
pw_check_library_version
(
0
,
3
,
49
)
)
57
pw_deinit();
58
}
59
60
}
// namespace QtPipeWire
61
62
QT_END_NAMESPACE
QtPipeWire::QPipeWireInstance
Definition
qpipewire_instance_p.h:30
QtPipeWire::QPipeWireInstance::QPipeWireInstance
QPipeWireInstance()
Definition
qpipewire_instance.cpp:46
QtPipeWire::QPipeWireInstance::isLoaded
static bool isLoaded()
Definition
qpipewire_instance.cpp:41
QtPipeWire::QPipeWireInstance::~QPipeWireInstance
~QPipeWireInstance()
Definition
qpipewire_instance.cpp:54
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.14.0