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
qplatformaudiodevices_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 QPLATFORMAUDIODEVICES_H
5#define QPLATFORMAUDIODEVICES_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 <QtCore/qlist.h>
19#include <QtCore/qobject.h>
20#include <QtMultimedia/private/qaudiodevice_p.h>
21#include <QtMultimedia/private/qcachedvalue_p.h>
22#include <QtMultimedia/private/qtmultimediaglobal_p.h>
23#include <memory>
24
25QT_BEGIN_NAMESPACE
26
27class QPlatformAudioSource;
28class QPlatformAudioSink;
29class QAudioFormat;
30
31class Q_MULTIMEDIA_EXPORT QPlatformAudioDevices : public QObject
32{
33 Q_OBJECT
34
35 QT_DEFINE_TAG_STRUCT(PrivateTag);
36
37public:
38 QPlatformAudioDevices();
39 ~QPlatformAudioDevices() override;
40
41 static std::unique_ptr<QPlatformAudioDevices> create();
42
43 QList<QAudioDevice> audioInputs() const;
44 QList<QAudioDevice> audioOutputs() const;
45
46 virtual QPlatformAudioSource *createAudioSource(const QAudioDevice &, const QAudioFormat &,
47 QObject *parent);
48 virtual QPlatformAudioSink *createAudioSink(const QAudioDevice &, const QAudioFormat &,
49 QObject *parent);
50
51 QPlatformAudioSource *audioInputDevice(QAudioFormat, const QAudioDevice &, QObject *parent);
52 QPlatformAudioSink *audioOutputDevice(QAudioFormat, const QAudioDevice &, QObject *parent);
53
54 void initVideoDevicesConnection();
55 virtual QLatin1String backendName() const { return QLatin1String{ "null" }; }
56
57protected:
58 virtual QList<QAudioDevice> findAudioInputs() const { return {}; }
59 virtual QList<QAudioDevice> findAudioOutputs() const { return {}; }
60
61 void onAudioInputsChanged();
62 void onAudioOutputsChanged();
63
64 void updateAudioInputsCache();
65 void updateAudioOutputsCache();
66
67Q_SIGNALS:
68 void audioInputsChanged(PrivateTag);
69 void audioOutputsChanged(PrivateTag);
70
71private:
72 mutable QCachedValue<QList<QAudioDevice>> m_audioInputs;
73 mutable QCachedValue<QList<QAudioDevice>> m_audioOutputs;
74};
75
76QT_END_NAMESPACE
77
78
79#endif // QPLATFORMAUDIODEVICES_H
The QAudioFormat class stores audio stream parameter information.