Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qplatformsurfacecapture_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
4#ifndef QPLATFORMSURFACECAPTURE_H
5#define QPLATFORMSURFACECAPTURE_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
19#include "qscreen.h"
20#include "qcapturablewindow.h"
21#include "qpointer.h"
22#include "private/qerrorinfo_p.h"
23
24#include <optional>
25#include <variant>
26
28
29class QVideoFrame;
30
31class Q_MULTIMEDIA_EXPORT QPlatformSurfaceCapture : public QPlatformVideoSource
32{
34
35public:
36 enum Error {
38 InternalError = 1,
39 CapturingNotSupported = 2,
40 CaptureFailed = 4,
41 NotFound = 5,
42 };
43
44 using ScreenSource = QPointer<QScreen>;
46
47 using Source = std::variant<ScreenSource, WindowSource>;
48
49 explicit QPlatformSurfaceCapture(Source initialSource);
50
51 void setActive(bool active) override;
52 bool isActive() const override;
53
54 void setSource(Source source);
55
56 template<typename Type>
57 Type source() const {
58 return *q_check_ptr(std::get_if<Type>(&m_source));
59 }
60
61 Source source() const { return m_source; }
62
63 Error error() const;
64 QString errorString() const final;
65
66protected:
67 virtual bool setActiveInternal(bool) = 0;
68
69 bool checkScreenWithError(ScreenSource &screen);
70
71public Q_SLOTS:
72 void updateError(Error error, const QString &errorString);
73
75 void sourceChanged(WindowSource);
76 void sourceChanged(ScreenSource);
77 void errorOccurred(Error error, QString errorString);
78
80 QErrorInfo<Error> m_error;
81 Source m_source;
82 bool m_active = false;
83};
84
86
87#endif // QPLATFORMSURFACECAPTURE_H
bool m_active
bool isActive
\inmodule QtMultimedia
std::variant< ScreenSource, WindowSource > Source
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
GLsizei GLsizei GLchar * source
@ NoError
Definition main.cpp:34
QScreen * screen
[1]
Definition main.cpp:29
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
Definition moc.h:23