]> git.sesse.net Git - kdenlive/blob - src/recmonitor.h
Rename HDMI to Blackmagic in capture settings since Blackmagic cards can capture...
[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 "blackmagic/capture.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 RecMonitor : public QWidget, public Ui::RecMonitor_UI
49 {
50     Q_OBJECT
51
52 public:
53     explicit RecMonitor(QString name, QWidget *parent = 0);
54     virtual ~RecMonitor();
55
56     QString name() const;
57
58     enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2, BLACKMAGIC = 3};
59
60 protected:
61     virtual void mousePressEvent(QMouseEvent * event);
62
63 private:
64     QString m_name;
65     bool m_isActive;
66     KDateTime m_captureTime;
67     /** @brief Provide feedback about dvgrab operations */
68     QLabel m_dvinfo;
69     
70     /** @brief Keeps a brief (max ten items) history of warning or error messages
71      *  (currently only used for BLACKMAGIC). */
72     KComboBox m_logger;
73     QString m_capturePath;
74
75 #if KDE_IS_VERSION(4,2,0)
76     KCapacityBar *m_freeSpace;
77     QTimer m_spaceTimer;
78 #endif
79
80     KUrl m_captureFile;
81     KIcon m_playIcon;
82     KIcon m_pauseIcon;
83
84     QProcess *m_captureProcess;
85     QProcess *m_displayProcess;
86     bool m_isCapturing;
87     /** did the user capture something ? */
88     bool m_didCapture;
89     bool m_isPlaying;
90     QStringList m_captureArgs;
91     QStringList m_displayArgs;
92     QAction *m_recAction;
93     QAction *m_playAction;
94     QAction *m_fwdAction;
95     QAction *m_rewAction;
96     QAction *m_stopAction;
97     QAction *m_discAction;
98     void checkDeviceAvailability();
99     QPixmap mergeSideBySide(const QPixmap& pix, const QString txt);
100     void manageCapturedFiles();
101     CaptureHandler *m_bmCapture;
102     /** @brief Indicates whether we are currently capturing from BLACKMAGIC. */
103     bool m_blackmagicCapturing;
104     void createBlackmagicDevice();
105
106 private slots:
107     void slotStartCapture(bool play = true);
108     void slotStopCapture();
109     void slotRecord();
110     void slotProcessStatus(QProcess::ProcessState status);
111     void slotVideoDeviceChanged(int ix);
112     void slotRewind();
113     void slotForward();
114     void slotDisconnect();
115     //void slotStartGrab(const QRect &rect);
116     void slotConfigure();
117     void slotReadDvgrabInfo();
118     void slotUpdateFreeSpace();
119     void slotGotBlackmagicFrameNumber(ulong ix);
120     void slotGotBlackmagicMessage(const QString &message);
121
122 public slots:
123     void refreshRecMonitor(bool visible);
124     void stop();
125     void start();
126     void activateRecMonitor();
127     void slotPlay();
128     void slotUpdateCaptureFolder(const QString currentProjectFolder);
129
130 signals:
131     void renderPosition(int);
132     void durationChanged(int);
133     void addProjectClip(KUrl);
134     void showConfigDialog(int, int);
135 };
136
137 #endif