1 | // Copyright (C) 2016 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 QPULSEHELPER_H |
5 | #define QPULSEHELPER_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 "qaudiodevice.h" |
19 | #include <qaudioformat.h> |
20 | #include <pulse/pulseaudio.h> |
21 | #include <QtCore/QLoggingCategory> |
22 | #include <QtCore/qdebug.h> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | Q_DECLARE_LOGGING_CATEGORY(qLcPulseAudioOut) |
27 | Q_DECLARE_LOGGING_CATEGORY(qLcPulseAudioIn) |
28 | Q_DECLARE_LOGGING_CATEGORY(qLcPulseAudioEngine) |
29 | |
30 | struct PAOperationDeleter |
31 | { |
32 | void operator()(pa_operation *op) const { pa_operation_unref(o: op); } |
33 | }; |
34 | |
35 | using PAOperationUPtr = std::unique_ptr<pa_operation, PAOperationDeleter>; |
36 | |
37 | namespace QPulseAudioInternal |
38 | { |
39 | pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format); |
40 | QAudioFormat sampleSpecToAudioFormat(const pa_sample_spec &spec); |
41 | pa_channel_map channelMapForAudioFormat(const QAudioFormat &format); |
42 | QAudioFormat::ChannelConfig channelConfigFromMap(const pa_channel_map &map); |
43 | |
44 | QUtf8StringView currentError(const pa_context *); |
45 | QUtf8StringView currentError(const pa_stream *); |
46 | |
47 | } // namespace QPulseAudioInternal |
48 | |
49 | QDebug operator<<(QDebug, pa_stream_state_t); |
50 | QDebug operator<<(QDebug, pa_sample_format); |
51 | QDebug operator<<(QDebug, pa_context_state_t); |
52 | |
53 | QT_END_NAMESPACE |
54 | |
55 | #endif |
56 |