File indexing completed on 2024-04-14 15:33:31

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