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