1 /***************************************************************************
2 * Copyright (C) 2007 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 ***************************************************************************/
22 * @brief Records video via dvgrab, video4linux and recordmydesktop
23 * @author Jean-Baptiste Mardelle
29 #include "blackmagic/capture.h"
30 #include "ui_recmonitor_ui.h"
39 #include <KRestrictedLine>
41 #include <kdeversion.h>
44 #if KDE_IS_VERSION(4,2,0)
45 #include <kcapacitybar.h>
48 class RecMonitor : public QWidget, public Ui::RecMonitor_UI
53 explicit RecMonitor(QString name, QWidget *parent = 0);
54 virtual ~RecMonitor();
58 enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2, BLACKMAGIC = 3};
61 virtual void mousePressEvent(QMouseEvent * event);
66 KDateTime m_captureTime;
67 /** @brief Provide feedback about dvgrab operations */
70 /** @brief Keeps a brief (max ten items) history of warning or error messages
71 * (currently only used for BLACKMAGIC). */
73 QString m_capturePath;
75 #if KDE_IS_VERSION(4,2,0)
76 KCapacityBar *m_freeSpace;
84 QProcess *m_captureProcess;
85 QProcess *m_displayProcess;
87 /** did the user capture something ? */
90 QStringList m_captureArgs;
91 QStringList m_displayArgs;
93 QAction *m_playAction;
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();
107 void slotStartCapture(bool play = true);
108 void slotStopCapture();
110 void slotProcessStatus(QProcess::ProcessState status);
111 void slotVideoDeviceChanged(int ix);
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);
123 void refreshRecMonitor(bool visible);
126 void activateRecMonitor();
128 void slotUpdateCaptureFolder(const QString currentProjectFolder);
131 void renderPosition(int);
132 void durationChanged(int);
133 void addProjectClip(KUrl);
134 void showConfigDialog(int, int);