File indexing completed on 2024-05-12 05:38:09

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 "screencasting.h"
0010 #include <QObject>
0011 
0012 class ScreencastingStream;
0013 struct ScreencastingRequestPrivate;
0014 
0015 /**
0016  * Allows us to request a stream for a window identified by its universally
0017  * unique identifier.
0018  *
0019  * We will get a PipeWire node id that can be fed to any pipewire player, be it
0020  * the PipeWireSourceItem, GStreamer's pipewiresink or any other.
0021  */
0022 class ScreencastingRequest : public QObject
0023 {
0024     Q_OBJECT
0025     /**
0026      * The unique identifier of the window we want to cast.
0027      *
0028      * @see PlasmaWindow::uuid
0029      * @see PlasmaWindow::stackingOrderUuids
0030      * @see PlasmaWindowModel::Uuid
0031      * @see TasksModel::WinIdList
0032      */
0033     Q_PROPERTY(QString uuid READ uuid WRITE setUuid NOTIFY uuidChanged)
0034 
0035     /**
0036      * The output name as define in Screen.name
0037      */
0038     Q_PROPERTY(QString outputName READ outputName WRITE setOutputName NOTIFY outputNameChanged)
0039 
0040     /** The offered nodeId to give to a source */
0041     Q_PROPERTY(quint32 nodeId READ nodeId NOTIFY nodeIdChanged)
0042 public:
0043     ScreencastingRequest(QObject *parent = nullptr);
0044     ~ScreencastingRequest();
0045 
0046     void setUuid(const QString &uuid);
0047     QString uuid() const;
0048     void setOutputName(const QString &outputName);
0049     QString outputName() const;
0050     quint32 nodeId() const;
0051 
0052 Q_SIGNALS:
0053     void nodeIdChanged(quint32 nodeId);
0054     void uuidChanged(const QString &uuid);
0055     void outputNameChanged(const QString &outputNames);
0056 
0057 private:
0058     void adopt(ScreencastingStream *stream);
0059     void setNodeid(uint nodeId);
0060 
0061     std::unique_ptr<ScreencastingRequestPrivate> d;
0062 };