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 "abstractmonitor.h"
30 #include "blackmagic/capture.h"
31 #include "ui_recmonitor_ui.h"
40 #include <KRestrictedLine>
42 #include <kdeversion.h>
45 #if KDE_IS_VERSION(4,2,0)
46 #include <kcapacitybar.h>
50 class MltDeviceCapture;
53 class RecMonitor : public AbstractMonitor, public Ui::RecMonitor_UI
58 explicit RecMonitor(QString name, MonitorManager *manager, QWidget *parent = 0);
59 virtual ~RecMonitor();
61 const QString name() const;
62 AbstractRender *abstractRender();
63 void analyseFrames(bool analyse);
64 enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2, BLACKMAGIC = 3};
67 virtual void mousePressEvent(QMouseEvent * event);
71 KDateTime m_captureTime;
72 /** @brief Provide feedback about dvgrab operations */
75 /** @brief Keeps a brief (max ten items) history of warning or error messages
76 * (currently only used for BLACKMAGIC). */
78 QString m_capturePath;
80 #if KDE_IS_VERSION(4,2,0)
81 KCapacityBar *m_freeSpace;
89 QProcess *m_captureProcess;
90 QProcess *m_displayProcess;
92 /** did the user capture something ? */
95 QStringList m_captureArgs;
96 QStringList m_displayArgs;
98 QAction *m_playAction;
100 QAction *m_rewAction;
101 QAction *m_stopAction;
102 QAction *m_discAction;
105 CaptureHandler *m_bmCapture;
106 /** @brief Indicates whether we are currently capturing from BLACKMAGIC. */
107 bool m_blackmagicCapturing;
108 MonitorManager *m_manager;
109 MltDeviceCapture *m_captureDevice;
110 VideoPreviewContainer *m_videoBox;
112 void checkDeviceAvailability();
113 QPixmap mergeSideBySide(const QPixmap& pix, const QString txt);
114 void manageCapturedFiles();
115 void createBlackmagicDevice();
118 void slotStartCapture(bool play = true);
120 void slotProcessStatus(QProcess::ProcessState status);
121 void slotVideoDeviceChanged(int ix);
124 void slotDisconnect();
125 //void slotStartGrab(const QRect &rect);
126 void slotConfigure();
127 void slotReadDvgrabInfo();
128 void slotUpdateFreeSpace();
129 void slotGotBlackmagicFrameNumber(ulong ix);
130 void slotGotBlackmagicMessage(const QString &message);
133 void refreshRecMonitor(bool visible);
137 void slotStopCapture();
138 void slotUpdateCaptureFolder(const QString currentProjectFolder);
141 void renderPosition(int);
142 void durationChanged(int);
143 void addProjectClip(KUrl);
144 void showConfigDialog(int, int);