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 QPLATFORMMEDIADEVICES_H
5#define QPLATFORMMEDIADEVICES_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 <private/qtmultimediaglobal_p.h>
19#include <qlist.h>
20#include <qobject.h>
21#include <mutex>
22
23QT_BEGIN_NAMESPACE
24
25class QMediaDevices;
26class QAudioDevice;
27class QCameraDevice;
28class QPlatformAudioSource;
29class QPlatformAudioSink;
30class QAudioFormat;
31class QPlatformMediaIntegration;
32
33class Q_MULTIMEDIA_EXPORT QPlatformMediaDevices : public QObject
34{
35 Q_OBJECT
36public:
37 QPlatformMediaDevices();
38 ~QPlatformMediaDevices() override;
39
40 static void setDevices(QPlatformMediaDevices *);
41 static QPlatformMediaDevices *instance();
42
43 virtual QList<QAudioDevice> audioInputs() const;
44 virtual QList<QAudioDevice> audioOutputs() const;
45
46 virtual QPlatformAudioSource *createAudioSource(const QAudioDevice &, QObject *parent);
47 virtual QPlatformAudioSink *createAudioSink(const QAudioDevice &, QObject *parent);
48
49 QPlatformAudioSource *audioInputDevice(const QAudioFormat &format,
50 const QAudioDevice &deviceInfo, QObject *parent);
51 QPlatformAudioSink *audioOutputDevice(const QAudioFormat &format,
52 const QAudioDevice &deviceInfo, QObject *parent);
53
54 virtual void prepareAudio();
55
56 void initVideoDevicesConnection();
57
58Q_SIGNALS:
59 void audioInputsChanged();
60 void audioOutputsChanged();
61 void videoInputsChanged();
62
63private:
64 std::once_flag m_videoDevicesConnectionFlag;
65};
66
67QT_END_NAMESPACE
68
69
70#endif // QPLATFORMMEDIADEVICES_H
71

source code of qtmultimedia/src/multimedia/platform/qplatformmediadevices_p.h