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
qwindowcapture.h
Go to the documentation of this file.
1// Copyright (C) 2023 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 QWINDOWCAPTURE_H
5#define QWINDOWCAPTURE_H
6
7#include <QtMultimedia/qtmultimediaexports.h>
8#include <QtMultimedia/qcapturablewindow.h>
9#include <QtCore/qobject.h>
10#include <QtCore/qlist.h>
11
13
14class QPlatformSurfaceCapture;
15
16class Q_MULTIMEDIA_EXPORT QWindowCapture : public QObject
17{
18 Q_OBJECT
19 Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
20 Q_PROPERTY(QCapturableWindow window READ window WRITE setWindow NOTIFY windowChanged)
21 Q_PROPERTY(Error error READ error NOTIFY errorChanged)
22 Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
23 Q_PROPERTY(std::optional<qreal> frameRate READ frameRate WRITE setFrameRate RESET resetFrameRate NOTIFY frameRateChanged)
24
25public:
26 enum Error {
27 NoError = 0,
28 InternalError = 1,
29 CapturingNotSupported = 2,
30 CaptureFailed = 4,
31 NotFound = 5,
32 };
33 Q_ENUM(Error)
34
35 explicit QWindowCapture(QObject *parent = nullptr);
36 ~QWindowCapture() override;
37
38 Q_INVOKABLE static QList<QCapturableWindow> capturableWindows();
39
40 QMediaCaptureSession *captureSession() const;
41
42 void setWindow(QCapturableWindow window);
43
44 QCapturableWindow window() const;
45
46 bool isActive() const;
47
48 Error error() const;
49 QString errorString() const;
50
51 void setFrameRate(std::optional<qreal> frameRate);
52 std::optional<qreal> frameRate() const;
53 void resetFrameRate();
54
55public Q_SLOTS:
56 void setActive(bool active);
57 void start() { setActive(true); }
58 void stop() { setActive(false); }
59
60Q_SIGNALS:
61 void activeChanged(bool);
62 void windowChanged(QCapturableWindow window);
63 void errorChanged();
64 void errorOccurred(QWindowCapture::Error error, const QString &errorString);
65 void frameRateChanged();
66
67private:
68 void setCaptureSession(QMediaCaptureSession *captureSession);
69 QPlatformSurfaceCapture *platformWindowCapture() const;
70
71 friend class QMediaCaptureSession;
72 Q_DISABLE_COPY(QWindowCapture)
73 Q_DECLARE_PRIVATE(QWindowCapture)
74};
75
76QT_END_NAMESPACE
77
78#endif // QWINDOWCAPTURE_H
QPointer< QAudioBufferInput > audioBufferInput
QPointer< QVideoFrameInput > videoFrameInput
QPointer< QImageCapture > imageCapture
void setVideoSink(QVideoSink *sink)
static QMediaCaptureSessionPrivate * get(QMediaCaptureSession *session)
QPointer< QScreenCapture > screenCapture
QPointer< QWindowCapture > windowCapture
QPointer< QMediaRecorder > recorder
\inmodule QtMultimedia
\inmodule QtMultimedia
Combined button and popup list for selecting options.