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 QGSTREAMERMEDIADEVICES_H |
5 | #define QGSTREAMERMEDIADEVICES_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/qplatformvideodevices_p.h> |
19 | #include <gst/gst.h> |
20 | #include <qaudiodevice.h> |
21 | #include <vector> |
22 | |
23 | #include <common/qgst_handle_types_p.h> |
24 | #include <common/qgst_bus_observer_p.h> |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | class QGstreamerVideoDevices final : public QPlatformVideoDevices, |
29 | private QGstreamerBusMessageFilter |
30 | { |
31 | public: |
32 | explicit QGstreamerVideoDevices(QPlatformMediaIntegration *integration); |
33 | ~QGstreamerVideoDevices(); |
34 | |
35 | QList<QCameraDevice> videoDevices() const override; |
36 | GstDevice *videoDevice(const QByteArray &id) const; |
37 | |
38 | void addDevice(QGstDeviceHandle); |
39 | void removeDevice(QGstDeviceHandle); |
40 | |
41 | private: |
42 | bool processBusMessage(const QGstreamerMessage &message) override; |
43 | |
44 | struct QGstRecordDevice |
45 | { |
46 | QGstDeviceHandle gstDevice; |
47 | QByteArray id; |
48 | }; |
49 | |
50 | quint64 m_idGenerator = 0; |
51 | std::vector<QGstRecordDevice> m_videoSources; |
52 | |
53 | QGstDeviceMonitorHandle m_deviceMonitor; |
54 | QGstBusObserver m_busObserver; |
55 | }; |
56 | |
57 | QT_END_NAMESPACE |
58 | |
59 | #endif |
60 |