File indexing completed on 2024-05-05 05:30:18

0001 /*
0002     SPDX-FileCopyrightText: 2023 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 
0011 #include "pipewirebaseencodedstream.h"
0012 #include <kpipewire_export.h>
0013 
0014 struct PipeWireCursor;
0015 class PipeWirePacketPrivate;
0016 
0017 class KPIPEWIRE_EXPORT PipeWireEncodedStream : public PipeWireBaseEncodedStream
0018 {
0019     Q_OBJECT
0020 public:
0021     PipeWireEncodedStream(QObject *parent = nullptr);
0022     ~PipeWireEncodedStream() override;
0023 
0024     class Packet
0025     {
0026     public:
0027         Packet(bool isKey, const QByteArray &data);
0028 
0029         /// Whether the packet represents a key frame
0030         bool isKeyFrame() const;
0031         QByteArray data() const;
0032 
0033         std::shared_ptr<PipeWirePacketPrivate> d;
0034     };
0035 
0036 Q_SIGNALS:
0037     /// will be emitted when the stream initializes as well as when the value changes
0038     void sizeChanged(const QSize &size);
0039     void cursorChanged(const PipeWireCursor &cursor);
0040     void newPacket(const Packet &packet);
0041 
0042 protected:
0043     std::unique_ptr<PipeWireProduce> makeProduce() override;
0044 };