File indexing completed on 2024-04-28 08:44:08
0001 /* 0002 SPDX-FileCopyrightText: 2011 Jean-Baptiste Mardelle <jb@kdenlive.org> 0003 0004 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include "definitions.h" 0010 0011 #include <cstdint> 0012 0013 #include <QImage> 0014 #include <QObject> 0015 #include <QWidget> 0016 0017 class MonitorManager; 0018 0019 class AbstractRender : public QObject 0020 { 0021 Q_OBJECT public : 0022 0023 /** @brief Build an abstract MLT Renderer 0024 * @param name A unique identifier for this renderer 0025 * @param winid The parent widget identifier (required for SDL display). Set to 0 for OpenGL rendering 0026 * @param profile The MLT profile used for the renderer (default one will be used if empty). */ 0027 explicit AbstractRender(Kdenlive::MonitorId name, QWidget *parent = nullptr) 0028 : QObject(parent) 0029 , sendFrameForAnalysis(false) 0030 , analyseAudio(false) 0031 , m_id(name) 0032 { 0033 } 0034 0035 /** @brief Destroy the MLT Renderer. */ 0036 ~AbstractRender() override = default; 0037 0038 /** @brief This property is used to decide if the renderer should convert it's frames to QImage for use in other Kdenlive widgets. */ 0039 bool sendFrameForAnalysis; 0040 0041 /** @brief This property is used to decide if the renderer should send audio data for monitoring. */ 0042 bool analyseAudio; 0043 0044 Kdenlive::MonitorId id() const { return m_id; } 0045 0046 /** @brief Someone needs us to send again a frame. */ 0047 virtual void sendFrameUpdate() = 0; 0048 0049 private: 0050 Kdenlive::MonitorId m_id; 0051 0052 Q_SIGNALS: 0053 /** @brief The renderer refreshed the current frame. */ 0054 void frameUpdated(const QImage &); 0055 0056 /** @brief This signal contains the audio of the current frame. */ 0057 void audioSamplesSignal(const audioShortVector &, int, int, int); 0058 /** @brief Scopes are ready to receive a new frame. */ 0059 void scopesClear(); 0060 }; 0061 0062 class AbstractMonitor : public QWidget 0063 { 0064 Q_OBJECT 0065 public: 0066 AbstractMonitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *parent = nullptr); 0067 Kdenlive::MonitorId id() { return m_id; } 0068 ~AbstractMonitor() override; 0069 bool isActive() const; 0070 virtual void mute(bool mute) = 0; 0071 0072 public Q_SLOTS: 0073 virtual void stop() = 0; 0074 virtual void start() = 0; 0075 virtual void slotPlay() = 0; 0076 virtual void slotRewind(double speed = 0) = 0; 0077 virtual void slotForward(double speed = 0, bool allowNormalPlay = false) = 0; 0078 virtual void refreshMonitorIfActive(bool directUpdate = false) = 0; 0079 virtual void slotMouseSeek(int eventDelta, uint modifiers) = 0; 0080 bool slotActivateMonitor(); 0081 virtual void slotSwitchFullScreen(bool minimizeOnly = false) = 0; 0082 0083 protected: 0084 Kdenlive::MonitorId m_id; 0085 MonitorManager *m_monitorManager; 0086 0087 Q_SIGNALS: 0088 /** @brief Send a frame for analysis or title background display. */ 0089 void frameUpdated(const QImage &); 0090 /** @brief This signal contains the audio of the current frame. */ 0091 void audioSamplesSignal(const audioShortVector &, int, int, int); 0092 /** @brief Scopes are ready to receive a new frame. */ 0093 void scopesClear(); 0094 };