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
qplatformvideodevices_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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#ifndef QPLATFORMVIDEODEVICES_H
4#define QPLATFORMVIDEODEVICES_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <QtMultimedia/private/qcachedvalue_p.h>
18#include <QtMultimedia/private/qtmultimediaglobal_p.h>
19#include <QtMultimedia/qcameradevice.h>
20#include <QtMultimedia/qmediarecorder.h>
21#include <QtCore/qobject.h>
22
23QT_BEGIN_NAMESPACE
24
25class QCameraDevice;
26class QPlatformMediaIntegration;
27
28// Implementations should use constructor to setup device-changed notification
29// listeners. Actual device enumeration should happen in findVideoInputs().
30// This allows device enumeration be deferred until user starts using QMediaDevices
31// functionality.
32class Q_MULTIMEDIA_EXPORT QPlatformVideoDevices : public QObject
33{
34 Q_OBJECT
35
36 QT_DEFINE_TAG_STRUCT(PrivateTag);
37public:
38 QPlatformVideoDevices(QPlatformMediaIntegration *integration);
39
40 ~QPlatformVideoDevices() override;
41
42 QList<QCameraDevice> videoInputs() const;
43
44protected:
45 // Implementation must be thread safe. Can be called from any thread as a result of
46 // QMediaDevices::videoInputs().
47 virtual QList<QCameraDevice> findVideoInputs() const = 0;
48
49 // Thread-safe.
50 // Called by the platform-implementation to signal that findVideoInputs() will return a new list
51 // of devices.
52 void onVideoInputsChanged();
53
54 // Thread-safe. Called by platform-implementation.
55 void updateVideoInputsCache();
56
57Q_SIGNALS:
58 void videoInputsChanged(PrivateTag);
59
60protected:
61 QPlatformMediaIntegration *m_integration = nullptr;
62 mutable QCachedValue<QList<QCameraDevice>> m_videoInputs;
63};
64
65QT_END_NAMESPACE
66
67#endif
Combined button and popup list for selecting options.