1 /***************************************************************************
2 * Copyright (C) 2011 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef ABSTRACTMONITOR_H
21 #define ABSTRACTMONITOR_H
23 #include "definitions.h"
36 class AbstractRender: public QObject
40 /** @brief Build an abstract MLT Renderer
41 * @param name A unique identifier for this renderer
42 * @param winid The parent widget identifier (required for SDL display). Set to 0 for OpenGL rendering
43 * @param profile The MLT profile used for the renderer (default one will be used if empty). */
44 explicit AbstractRender(Kdenlive::MonitorId name, QWidget *parent = 0)
46 sendFrameForAnalysis(false),
52 /** @brief Destroy the MLT Renderer. */
53 virtual ~AbstractRender() {}
55 /** @brief This property is used to decide if the renderer should convert it's frames to QImage for use in other Kdenlive widgets. */
56 bool sendFrameForAnalysis;
58 /** @brief This property is used to decide if the renderer should send audio data for monitoring. */
61 const QString &name() const {return m_name;}
63 /** @brief Someone needs us to send again a frame. */
64 virtual void sendFrameUpdate() = 0;
70 /** @brief The renderer refreshed the current frame. */
71 void frameUpdated(const QImage &);
73 /** @brief This signal contains the audio of the current frame. */
74 void audioSamplesSignal(const QVector<int16_t>&,int,int,int);
79 class VideoSurface : public QWidget
83 VideoSurface(QWidget *parent = 0);
86 void refreshMonitor();
89 virtual void paintEvent ( QPaintEvent * event );
93 class AbstractMonitor : public QWidget
97 AbstractMonitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *parent = 0);
98 Kdenlive::MonitorId id() {return m_id;}
99 virtual ~AbstractMonitor();
100 virtual AbstractRender *abstractRender() = 0;
101 bool isActive() const;
102 VideoContainer *videoBox;
103 VideoSurface *videoSurface;
104 void createVideoSurface();
108 virtual void stop() = 0;
109 virtual void start() = 0;
110 virtual void slotPlay() = 0;
111 virtual void slotMouseSeek(int eventDelta, bool fast) = 0;
112 bool slotActivateMonitor(bool forceRefresh = false);
113 virtual void slotSwitchFullScreen() = 0;
116 Kdenlive::MonitorId m_id;
117 MonitorManager *m_monitorManager;
120 class VideoContainer : public QFrame
124 explicit VideoContainer(AbstractMonitor *monitor, QWidget *parent = 0);
125 void switchFullScreen();
128 virtual void mouseDoubleClickEvent(QMouseEvent * event);
129 virtual void mouseReleaseEvent(QMouseEvent *event);
130 void keyPressEvent(QKeyEvent *event);
131 virtual void wheelEvent(QWheelEvent * event);
134 Qt::WindowFlags m_baseFlags;
135 AbstractMonitor *m_monitor;