File indexing completed on 2024-03-24 17:02:25

0001 /*
0002     SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 #include <QSharedPointer>
0011 #include <QVector>
0012 #include <optional>
0013 
0014 #include <kpipewire_export.h>
0015 
0016 struct zkde_screencast_unstable_v1;
0017 
0018 namespace KWayland
0019 {
0020 namespace Client
0021 {
0022 class PlasmaWindow;
0023 class Registry;
0024 class Output;
0025 }
0026 }
0027 
0028 class ScreencastingPrivate;
0029 class ScreencastingSourcePrivate;
0030 class ScreencastingStreamPrivate;
0031 class KPIPEWIRE_EXPORT ScreencastingStream : public QObject
0032 {
0033     Q_OBJECT
0034 public:
0035     ScreencastingStream(QObject *parent);
0036     ~ScreencastingStream() override;
0037 
0038     quint32 nodeId() const;
0039 
0040 Q_SIGNALS:
0041     void created(quint32 nodeid);
0042     void failed(const QString &error);
0043     void closed();
0044 
0045 private:
0046     friend class Screencasting;
0047     QScopedPointer<ScreencastingStreamPrivate> d;
0048 };
0049 
0050 class KPIPEWIRE_EXPORT Screencasting : public QObject
0051 {
0052     Q_OBJECT
0053 public:
0054     explicit Screencasting(QObject *parent = nullptr);
0055     ~Screencasting() override;
0056 
0057     enum CursorMode {
0058         Hidden = 1,
0059         Embedded = 2,
0060         Metadata = 4,
0061     };
0062     Q_ENUM(CursorMode);
0063 
0064     ScreencastingStream *createOutputStream(const QString &outputName, CursorMode mode);
0065     ScreencastingStream *createOutputStream(KWayland::Client::Output *output, CursorMode mode);
0066     ScreencastingStream *createRegionStream(const QRect &region, qreal scaling, CursorMode mode);
0067     ScreencastingStream *createWindowStream(KWayland::Client::PlasmaWindow *window, CursorMode mode);
0068     ScreencastingStream *createWindowStream(const QString &uuid, CursorMode mode);
0069     ScreencastingStream *createVirtualMonitorStream(const QString &name, const QSize &size, qreal scale, CursorMode mode);
0070 
0071     void destroy();
0072 
0073 Q_SIGNALS:
0074     void initialized();
0075     void removed();
0076     void sourcesChanged();
0077 
0078 private:
0079     QScopedPointer<ScreencastingPrivate> d;
0080 };