| 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() override; |
| 34 | |
| 35 | GstDevice *videoDevice(const QByteArray &id) const; |
| 36 | |
| 37 | void addDevice(QGstDeviceHandle); |
| 38 | void removeDevice(QGstDeviceHandle); |
| 39 | |
| 40 | protected: |
| 41 | QList<QCameraDevice> findVideoInputs() const override; |
| 42 | |
| 43 | private: |
| 44 | bool processBusMessage(const QGstreamerMessage &message) override; |
| 45 | |
| 46 | struct QGstRecordDevice |
| 47 | { |
| 48 | QGstDeviceHandle gstDevice; |
| 49 | QByteArray id; |
| 50 | }; |
| 51 | |
| 52 | quint64 m_idGenerator = 0; |
| 53 | std::vector<QGstRecordDevice> m_videoSources; |
| 54 | |
| 55 | QGstDeviceMonitorHandle m_deviceMonitor; |
| 56 | QGstBusObserver m_busObserver; |
| 57 | }; |
| 58 | |
| 59 | QT_END_NAMESPACE |
| 60 | |
| 61 | #endif |
| 62 |
