File indexing completed on 2024-04-28 09:21:51

0001 /*
0002     SPDX-FileCopyrightText: 2022 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 #include "pipewireproduce_p.h"
0009 #include <QRunnable>
0010 
0011 struct gbm_device;
0012 struct AVFormatContext;
0013 class PipeWireProduce;
0014 
0015 class PipeWireRecordProduce : public PipeWireProduce
0016 {
0017     Q_OBJECT
0018 public:
0019     PipeWireRecordProduce(PipeWireBaseEncodedStream::Encoder encoder, uint nodeId, uint fd, const Fraction &framerate, const QString &output);
0020 
0021     void processFrame(const PipeWireFrame &frame) override;
0022     void processPacket(AVPacket *packet) override;
0023     int64_t framePts(const std::optional<std::chrono::nanoseconds> &presentationTimestamp) override;
0024     void aboutToEncode(PipeWireFrame &frame) override;
0025     bool setupFormat() override;
0026     void cleanup() override;
0027 
0028 private:
0029     const QString m_output;
0030     AVFormatContext *m_avFormatContext = nullptr;
0031     QImage m_frameWithoutMetadataCursor;
0032 };
0033 
0034 struct PipeWireRecordPrivate {
0035     QString m_output;
0036 };