]> git.sesse.net Git - kdenlive/blob - src/recmonitor.h
Some update for decklink capture & use mlt_threads for proxies
[kdenlive] / src / recmonitor.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
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.                                   *
8  *                                                                         *
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.                          *
13  *                                                                         *
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  ***************************************************************************/
19
20 /**
21 * @class RecMonitor
22 * @brief Records video via dvgrab, video4linux and recordmydesktop
23 * @author Jean-Baptiste Mardelle
24 */
25
26 #ifndef RECMONITOR_H
27 #define RECMONITOR_H
28
29 #include "abstractmonitor.h"
30 #include "ui_recmonitor_ui.h"
31
32 #include <QToolBar>
33 #include <QTimer>
34 #include <QProcess>
35 #include <QImage>
36
37 #include <KIcon>
38 #include <KAction>
39 #include <KRestrictedLine>
40 #include <KDateTime>
41 #include <kdeversion.h>
42 #include <KComboBox>
43
44 #if KDE_IS_VERSION(4,2,0)
45 #include <kcapacitybar.h>
46 #endif
47
48 class MonitorManager;
49 class MltDeviceCapture;
50 class AbstractRender;
51
52 class RecMonitor : public AbstractMonitor, public Ui::RecMonitor_UI
53 {
54     Q_OBJECT
55
56 public:
57     explicit RecMonitor(QString name, MonitorManager *manager, QWidget *parent = 0);
58     virtual ~RecMonitor();
59
60     const QString name() const;
61     AbstractRender *abstractRender();
62     void analyseFrames(bool analyse);
63     enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2, BLACKMAGIC = 3};
64
65 protected:
66     virtual void mousePressEvent(QMouseEvent * event);
67
68 private:
69     QString m_name;
70     KDateTime m_captureTime;
71     /** @brief Provide feedback about dvgrab operations */
72     QLabel m_dvinfo;
73     
74     /** @brief Keeps a brief (max ten items) history of warning or error messages
75      *  (currently only used for BLACKMAGIC). */
76     KComboBox m_logger;
77     QString m_capturePath;
78
79 #if KDE_IS_VERSION(4,2,0)
80     KCapacityBar *m_freeSpace;
81     QTimer m_spaceTimer;
82 #endif
83
84     KUrl m_captureFile;
85     KIcon m_playIcon;
86     KIcon m_pauseIcon;
87
88     QProcess *m_captureProcess;
89     QProcess *m_displayProcess;
90     bool m_isCapturing;
91     /** did the user capture something ? */
92     bool m_didCapture;
93     bool m_isPlaying;
94     QStringList m_captureArgs;
95     QStringList m_displayArgs;
96     QAction *m_recAction;
97     QAction *m_playAction;
98     QAction *m_fwdAction;
99     QAction *m_rewAction;
100     QAction *m_stopAction;
101     QAction *m_discAction;
102
103     MonitorManager *m_manager;
104     MltDeviceCapture *m_captureDevice;
105     VideoPreviewContainer *m_videoBox;
106     bool m_analyse;
107     void checkDeviceAvailability();
108     QPixmap mergeSideBySide(const QPixmap& pix, const QString txt);
109     void manageCapturedFiles();
110     /** @brief Build MLT producer for device, using path as profile. */
111     void buildMltDevice(const QString &path);
112
113 private slots:
114     void slotStartPreview(bool play = true);
115     void slotRecord();
116     void slotProcessStatus(QProcess::ProcessState status);
117     void slotVideoDeviceChanged(int ix);
118     void slotRewind();
119     void slotForward();
120     void slotDisconnect();
121     //void slotStartGrab(const QRect &rect);
122     void slotConfigure();
123     void slotReadDvgrabInfo();
124     void slotUpdateFreeSpace();
125     void slotSetInfoMessage(const QString &message);
126     void slotDroppedFrames(int dropped);
127     /** @brief Change setting for preview while recording. */
128     void slotChangeRecordingPreview(int ix);
129
130 public slots:
131     void refreshRecMonitor(bool visible);
132     void slotPlay();
133     void stop();
134     void start();
135     void slotStopCapture();
136     void slotUpdateCaptureFolder(const QString currentProjectFolder);
137
138 signals:
139     void renderPosition(int);
140     void durationChanged(int);
141     void addProjectClip(KUrl);
142     void showConfigDialog(int, int);
143 };
144
145 #endif