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
qavaudiosessionmanager_p.h
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
#
ifndef
QAVAUDIOSESSIONMANAGER_P_H
5
#
define
QAVAUDIOSESSIONMANAGER_P_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtMultimedia
/
qtmultimediaexports
.
h
>
19
20
#
include
<
QtCore
/
qobject
.
h
>
21
#
include
<
QtCore
/
qmutex
.
h
>
22
#
include
<
QtCore
/
private
/
qcore_mac_p
.
h
>
23
24
#
include
<
array
>
25
#
include
<
cstdint
>
26
#
include
<
memory
>
27
#
include
<
utility
>
28
#
include
<
vector
>
29
30
#
import
<
AVFoundation
/
AVAudioSession
.
h
>
31
32
QT_BEGIN_NAMESPACE
33
34
namespace
QtMultimediaPrivate
{
35
36
struct
SessionRequirement
37
{
38
bool
needsRecord
=
false
;
39
AVAudioSessionCategoryOptions
options
= 0;
40
};
41
42
// On iOS, this activates the single, process-wide shared AVAudioSession. Other code in
43
// the same process that also manages AVAudioSession may conflict with this activation.
44
class
Q_MULTIMEDIA_EXPORT QAVAudioSessionManager
final
:
public
QObject
45
{
46
Q_OBJECT
47
public
:
48
static
QAVAudioSessionManager
*
instance
();
49
50
QAVAudioSessionManager
();
51
~
QAVAudioSessionManager
()
override
;
52
53
enum
class
TokenId
:
std
::
uint64_t
{};
54
55
class
Q_MULTIMEDIA_EXPORT
ActivationToken
56
{
57
public
:
58
ActivationToken
() =
default
;
59
ActivationToken
(
ActivationToken
&&
other
)
noexcept
;
60
ActivationToken
&
operator
=(
ActivationToken
&&
other
)
noexcept
;
61
~
ActivationToken
();
62
63
Q_DISABLE_COPY
(
ActivationToken
)
64
65
private
:
66
friend
class
QAVAudioSessionManager
;
67
ActivationToken
(
QAVAudioSessionManager
*
manager
,
std
::
shared_ptr
<
bool
>
destroyed
,
68
TokenId
tokenId
);
69
70
void
release
();
71
72
QAVAudioSessionManager
*
m_manager
=
nullptr
;
73
std
::
shared_ptr
<
bool
>
m_destroyed
;
74
TokenId
m_tokenId
{};
75
};
76
77
ActivationToken
activate
(
SessionRequirement
requirement
);
78
79
// Reasserts activation of the shared AVAudioSession using the configuration derived from
80
// currently live ActivationTokens, without changing which tokens are live. Intended for use
81
// by QAVAudioSessionRecovery only, after the OS itself deactivated the session (e.g. an
82
// interruption or media services reset) while our own set of clients hasn't changed.
83
bool
reassertActivation
();
84
85
Q_SIGNALS
:
86
void
interruptionBegan
();
87
void
interruptionEnded
(
bool
shouldResume
);
88
void
mediaServicesWereLost
();
89
void
mediaServicesWereReset
();
90
91
private
:
92
friend
class
ActivationToken
;
93
94
void
releaseActivation
(
TokenId
tokenId
);
95
bool
applyRequirementsLocked
();
96
97
QMutex
m_activationMutex
;
98
std
::
vector
<
std
::
pair
<
TokenId
,
SessionRequirement
>>
m_requirements
;
99
std
::
uint64_t
m_tokenIdAllocator
= 0;
100
101
std
::
array
<
QMacNotificationObserver
, 3>
m_observers
;
102
103
const
std
::
shared_ptr
<
bool
>
m_destroyed
=
std
::
make_shared
<
bool
>(
false
);
104
};
105
106
}
// namespace QtMultimediaPrivate
107
108
QT_END_NAMESPACE
109
110
#
endif
// QAVAUDIOSESSIONMANAGER_P_H
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QtMultimediaPrivate::impl
Definition
qaudiosystem_p.h:257
QtMultimediaPrivate::SessionRequirement
Definition
qavaudiosessionmanager_p.h:37
QtMultimediaPrivate::SessionRequirement::options
AVAudioSessionCategoryOptions options
Definition
qavaudiosessionmanager_p.h:39
QtMultimediaPrivate::SessionRequirement::needsRecord
bool needsRecord
Definition
qavaudiosessionmanager_p.h:38
qtmultimedia
src
multimedia
coreaudio
qavaudiosessionmanager_p.h
Generated on
for Qt by
1.16.1