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 "definitions.h"
31 #include "ui_recmonitor_ui.h"
40 #include <KRestrictedLine>
42 #include <kdeversion.h>
44 #include <kcapacitybar.h>
47 class MltDeviceCapture;
50 class RecMonitor : public AbstractMonitor, public Ui::RecMonitor_UI
55 explicit RecMonitor(Kdenlive::MONITORID name, MonitorManager *manager, QWidget *parent = 0);
56 virtual ~RecMonitor();
58 AbstractRender *abstractRender();
59 void analyseFrames(bool analyse);
60 enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2, BLACKMAGIC = 3};
63 virtual void mousePressEvent(QMouseEvent * event);
64 virtual void mouseDoubleClickEvent(QMouseEvent * event);
67 KDateTime m_captureTime;
68 /** @brief Provide feedback about dvgrab operations */
71 /** @brief Keeps a brief (max ten items) history of warning or error messages
72 * (currently only used for BLACKMAGIC). */
74 QString m_capturePath;
76 KCapacityBar *m_freeSpace;
83 QProcess *m_captureProcess;
84 QProcess *m_displayProcess;
86 /** did the user capture something ? */
89 QStringList m_captureArgs;
90 QStringList m_displayArgs;
92 QAction *m_playAction;
95 QAction *m_stopAction;
96 QAction *m_discAction;
98 MonitorManager *m_manager;
99 MltDeviceCapture *m_captureDevice;
100 VideoContainer *m_videoBox;
101 QAction *m_addCapturedClip;
102 QAction *m_previewSettings;
105 void checkDeviceAvailability();
106 QPixmap mergeSideBySide(const QPixmap& pix, const QString &txt);
107 void manageCapturedFiles();
108 /** @brief Build MLT producer for device, using path as profile. */
109 void buildMltDevice(const QString &path);
110 /** @brief Create string containing an XML playlist for v4l capture. */
111 const QString getV4lXmlPlaylist(MltVideoProfile profile, bool *isXml);
114 void slotStartPreview(bool play = true);
116 void slotProcessStatus(QProcess::ProcessState status);
117 void slotVideoDeviceChanged(int ix);
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(bool enable);
131 void refreshRecMonitor(bool visible);
135 void slotStopCapture();
136 void slotUpdateCaptureFolder(const QString ¤tProjectFolder);
137 void slotMouseSeek(int eventDelta, bool fast);
138 void slotSwitchFullScreen();
141 void renderPosition(int);
142 void durationChanged(int);
143 void addProjectClip(KUrl);
144 void addProjectClipList(KUrl::List);
145 void showConfigDialog(int, int);