/*
    SPDX-FileCopyrightText: 2023 Aleix Pol Gonzalez <aleixpol@kde.org>

    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#pragma once

#include "pipewireencodedstream.h"
#include "pipewireproduce_p.h"

class PipeWireEncodeProduce : public PipeWireProduce
{
    Q_OBJECT
public:
    PipeWireEncodeProduce(PipeWireBaseEncodedStream::Encoder encoder,
                          uint nodeId,
                          quint64 objectSerial,
                          uint fd,
                          const Fraction &framerate,
                          PipeWireEncodedStream *stream);

    void processPacket(AVPacket *packet) override;
    void processFrame(const PipeWireFrame &frame) override;
    // A live encoded stream has no fixed container, so it can rebuild the
    // encoder when the source is resized mid-stream.
    bool supportsResize() const override
    {
        return true;
    }

Q_SIGNALS:
    void newPacket(const PipeWireEncodedStream::Packet &packetData);

private:
    PipeWireEncodedStream *const m_encodedStream;
    QSize m_size;
    PipeWireCursor m_cursor;
};
