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
33 class VideoPreviewContainer : public QFrame
37 VideoPreviewContainer(QWidget *parent = 0);
38 ~VideoPreviewContainer();
39 /** @brief Set the image to be displayed, will be put in the queue. */
40 void setImage(QImage img);
41 /** @brief Start the display refresh timer. */
43 /** @brief Stop the display refresh timer. */
45 /** @brief Set the display ratio for this display. */
46 void setRatio(double ratio);
49 virtual void paintEvent(QPaintEvent */*event*/);
50 virtual void resizeEvent(QResizeEvent * event);
53 /** @brief The display aspect ratio for profile. */
55 /** @brief When true, the whole widget surface will be repainted, useful when resizing widget. */
57 /** @brief The rectangle defining the area for painting our image. */
59 /** @brief The queue of images to be displayed. */
60 QList <QImage *> m_imageQueue;
61 /** @brief We refresh the image with a timer, since this widget is only for preview during capture. */
62 QTimer m_refreshTimer;
63 /** @brief Re-calculate the display zone after a resize or aspect ratio change. */
64 void updateDisplayZone();
69 class AbstractRender: public QObject
73 /** @brief Build an abstract MLT Renderer
74 * @param name A unique identifier for this renderer
75 * @param winid The parent widget identifier (required for SDL display). Set to 0 for OpenGL rendering
76 * @param profile The MLT profile used for the renderer (default one will be used if empty). */
77 AbstractRender(const QString &name, QWidget *parent = 0):QObject(parent), sendFrameForAnalysis(false), m_name(name) {};
79 /** @brief Destroy the MLT Renderer. */
80 virtual ~AbstractRender() {};
82 /** @brief This property is used to decide if the renderer should convert it's frames to QImage for use in other Kdenlive widgets. */
83 bool sendFrameForAnalysis;
85 const QString &name() const {return m_name;};
87 /** @brief Someone needs us to send again a frame. */
88 virtual void sendFrameUpdate() = 0;
94 /** @brief The renderer refreshed the current frame. */
95 void frameUpdated(QImage);
97 /** @brief This signal contains the audio of the current frame. */
98 void audioSamplesSignal(QVector<int16_t>, int, int, int);
101 class AbstractMonitor : public QWidget
105 AbstractMonitor(QWidget *parent = 0): QWidget(parent) {};
106 virtual ~AbstractMonitor() {};
107 virtual AbstractRender *abstractRender() = 0;
108 virtual const QString name() const = 0;
111 virtual void stop() = 0;
112 virtual void start() = 0;