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