From 6d1366a846381c333e8414e3044a78df6d493c2b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Mon, 17 Mar 2008 21:50:49 +0000 Subject: [PATCH] Initial support for Jog Shuttle devices svn path=/branches/KDE4/; revision=2069 --- src/CMakeLists.txt | 2 + src/jogshuttle.cpp | 261 +++++++++++++++++++++++++++++ src/jogshuttle.h | 76 +++++++++ src/kdenlivesettings.kcfg | 48 +++++- src/kdenlivesettingsdialog.cpp | 46 +++-- src/kdenlivesettingsdialog.h | 3 + src/mainwindow.cpp | 60 ++++++- src/mainwindow.h | 8 + src/monitor.cpp | 20 ++- src/monitor.h | 4 +- src/monitormanager.cpp | 12 +- src/monitormanager.h | 4 +- src/recmonitor.cpp | 20 +-- src/widgets/configcapture_ui.ui | 159 ++++++++---------- src/widgets/configenv_ui.ui | 14 +- src/widgets/configjogshuttle_ui.ui | 113 +++++++++++++ src/widgets/recmonitor_ui.ui | 4 +- 17 files changed, 712 insertions(+), 142 deletions(-) create mode 100644 src/jogshuttle.cpp create mode 100644 src/jogshuttle.h create mode 100644 src/widgets/configjogshuttle_ui.ui diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d8e437eb..1abfcfab 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,6 +43,7 @@ kde4_add_ui_files(kdenlive_UI widgets/renderwidget_ui.ui widgets/saveprofile_ui.ui widgets/transitionsettings_ui.ui + widgets/configjogshuttle_ui.ui ) set(kdenlive_SRCS @@ -93,6 +94,7 @@ set(kdenlive_SRCS abstractclipitem.cpp transitionsettings.cpp recmonitor.cpp + jogshuttle.cpp ) kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc ) diff --git a/src/jogshuttle.cpp b/src/jogshuttle.cpp new file mode 100644 index 00000000..6988045a --- /dev/null +++ b/src/jogshuttle.cpp @@ -0,0 +1,261 @@ +/*************************************************************************** + * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) * + * Based on code by Arendt David * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + + + +#define DELAY 10 + +#define KEY 1 +#define KEY1 256 +#define KEY2 257 +#define KEY3 258 +#define KEY4 259 +#define KEY5 260 +#define KEY6 261 +#define KEY7 262 +#define KEY8 263 +#define KEY9 264 +#define KEY10 265 +#define KEY11 266 +#define KEY12 267 +#define KEY13 268 +#define KEY14 269 +#define KEY15 270 + +#define JOGSHUTTLE 2 +#define JOG 7 +#define SHUTTLE 8 + +#define JOG_BACK1 10001 +#define JOG_FWD1 10002 +#define JOG_FWD 10003 +#define JOG_FWD_SLOW 10004 +#define JOG_FWD_FAST 10005 +#define JOG_BACK 10006 +#define JOG_BACK_SLOW 10007 +#define JOG_BACK_FAST 10008 +#define JOG_STOP 10009 + + +#include +#include +#include + +#include +#include +#include +#include + +#include + + + +#include "jogshuttle.h" + + +/*unsigned short jogvalue = 0xffff; +int shuttlevalue = 0xffff; +struct timeval last_shuttle; +int need_synthetic_shuttle; +*/ + +void ShuttleThread::init(QObject *parent, QString device) { + m_parent = parent; + m_device = device; + stop_me = false; + m_isWorking = false; + shuttlevalue = 0xffff; + jogvalue = 0xffff; +} + +bool ShuttleThread::isWorking() { + return m_isWorking; +} + +void ShuttleThread::run() { + kDebug() << "------- STARTING SHUTTLE: " << m_device; + + EV ev; + FILE * fd = fopen((char *) m_device.toUtf8().data(), "r"); + + if (!fd) { + fprintf(stderr, "Can't open file\n"); + exit(1); + } + + while (!stop_me) { + while (fread(&ev, sizeof(ev), 1, fd) == 1) handle_event(ev); + } + + +} + +void ShuttleThread::handle_event(EV ev) { + switch (ev.type) { + case KEY : + key(ev.code, ev.value); + break; + case JOGSHUTTLE : + jogshuttle(ev.code, ev.value); + break; + } +} + +void ShuttleThread::key(unsigned short code, unsigned int value) { + if (value == 0) { + // Button release (ignored) + return; + } + + code -= KEY1 - 1; + + // Bound check! + if (code > 16) + return; + + kDebug() << "Button PRESSED: " << code; + QApplication::postEvent(m_parent, new QEvent((QEvent::Type)(20000 + code))); + +} + +void ShuttleThread::shuttle(int value) { + //gettimeofday( &last_shuttle, 0 ); + //need_synthetic_shuttle = value != 0; + + if (value == shuttlevalue) + return; + shuttlevalue = value; + switch (value) { + case - 7 : + case - 6 : + case - 5 : + case - 4 : + case - 3 : + QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_BACK_FAST)); + break; // Reverse fast + case - 2 : + QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_BACK)); + break; // Reverse + case - 1 : + QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_BACK_SLOW)); + break; // Reverse slow + case 0 : + QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_STOP)); + break; // Stop! + case 1 : + QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_FWD_SLOW)); + break; // Forward slow + case 2 : + QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_FWD)); + break; // Normal play + case 3 : + case 4 : + case 5 : + case 6 : + case 7 : + QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_FWD_FAST)); + break; // Fast forward + } + +} + +void ShuttleThread::jog(unsigned int value) { + // We should generate a synthetic event for the shuttle going + // to the home position if we have not seen one recently + //check_synthetic(); + + if (jogvalue != 0xffff) { + if (value < jogvalue) + QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_BACK1)); + else if (value > jogvalue) + QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_FWD1)); + } + jogvalue = value; +} + + +void ShuttleThread::jogshuttle(unsigned short code, unsigned int value) { + switch (code) { + case JOG : + jog(value); + break; + case SHUTTLE : + shuttle(value); + break; + } +} + + +JogShuttle::JogShuttle(QString device, QObject *parent): QObject(parent) { + initDevice(device); +} + +JogShuttle::~JogShuttle() { + if (m_shuttleProcess.isRunning()) m_shuttleProcess.exit(); +} + +void JogShuttle::initDevice(QString device) { + if (m_shuttleProcess.isRunning()) return; + m_shuttleProcess.init(this, device); + m_shuttleProcess.start(QThread::LowestPriority); +} + +void JogShuttle::stopDevice() { + if (m_shuttleProcess.isRunning()) m_shuttleProcess.stop_me = true; +} + +void JogShuttle::customEvent(QEvent* e) { + switch (e->type()) { + case JOG_BACK1: + emit rewind1(); + break; + case JOG_FWD1: + emit forward1(); + break; + case JOG_BACK: + emit rewind(-1); + break; + case JOG_FWD: + emit forward(1); + break; + case JOG_BACK_SLOW: + emit rewind(-0.5); + break; + case JOG_FWD_SLOW: + emit forward(0.5); + break; + case JOG_BACK_FAST: + emit rewind(-2); + break; + case JOG_FWD_FAST: + emit forward(2); + break; + case JOG_STOP: + emit stop(); + break; + default: + emit button(e->type() - 20000); + } +} + + + +// #include "jogshuttle.moc" + diff --git a/src/jogshuttle.h b/src/jogshuttle.h new file mode 100644 index 00000000..29384599 --- /dev/null +++ b/src/jogshuttle.h @@ -0,0 +1,76 @@ +/*************************************************************************** + * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) * + * Based on code by Arendt David * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef SHUTTLE_H +#define SHUTTLE_H + +#include +#include + +#include + + +typedef struct input_event EV; + +class ShuttleThread : public QThread { + +public: + virtual void run(); + void init(QObject *parent, QString device); + QObject *m_parent; + int shuttlevalue; + unsigned short jogvalue; + bool isWorking(); + bool stop_me; + +private: + QString m_device; + bool m_isWorking; + void handle_event(EV ev); + void jogshuttle(unsigned short code, unsigned int value); + void jog(unsigned int value); + void shuttle(int value); + void key(unsigned short code, unsigned int value); +}; + + +class JogShuttle: public QObject { +Q_OBJECT public: + JogShuttle(QString device, QObject * parent = 0); + ~JogShuttle(); + void stopDevice(); + void initDevice(QString device); + +protected: + virtual void customEvent(QEvent * e); + +private: + ShuttleThread m_shuttleProcess; + +signals: + void rewind1(); + void forward1(); + void rewind(double); + void forward(double); + void stop(); + void button(int); +}; + +#endif diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index 6e02f045..ff442bb7 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -52,6 +52,11 @@ /tmp/ + + + + $HOME + @@ -60,11 +65,6 @@ 0 - - - $HOME - - 0 @@ -121,6 +121,44 @@ + + + + false + + + + + /dev/input/event0 + + + + + 1 + + + + + 2 + + + + + 0 + + + + + 0 + + + + + 0 + + + + diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index adcb99bd..4a73a877 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -43,22 +43,36 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent): KConfigDialog( m_configEnv.rendererpathurl->lineEdit()->setObjectName("kcfg_rendererpath"); m_configEnv.tmppathurl->setMode(KFile::Directory); m_configEnv.tmppathurl->lineEdit()->setObjectName("kcfg_currenttmpfolder"); + m_configEnv.capturefolderurl->setMode(KFile::Directory); + m_configEnv.capturefolderurl->lineEdit()->setObjectName("kcfg_capturefolder"); page2 = addPage(p2, i18n("Environnement"), "terminal"); QWidget *p4 = new QWidget; m_configCapture.setupUi(p4); - m_configCapture.capturefolderurl->setMode(KFile::Directory); - m_configCapture.capturefolderurl->lineEdit()->setObjectName("kcfg_capturefolder"); page4 = addPage(p4, i18n("Capture"), "audio-card"); - connect(m_configCapture.kcfg_video4vdevice, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands())); - connect(m_configCapture.kcfg_video4adevice, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands())); - connect(m_configCapture.kcfg_video4vformat, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands())); - connect(m_configCapture.kcfg_video4aformat, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands())); - connect(m_configCapture.kcfg_video4vencoding, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands())); - connect(m_configCapture.kcfg_video4aencoding, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands())); - connect(m_configCapture.kcfg_video4size, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands())); - connect(m_configCapture.kcfg_video4rate, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands())); + QWidget *p5 = new QWidget; + m_configShuttle.setupUi(p5); + page5 = addPage(p5, i18n("JogShuttle"), "input-mouse"); + + QStringList actions; + actions << i18n("Do nothing"); + actions << i18n("Play / Pause"); + actions << i18n("Cut"); + m_configShuttle.kcfg_shuttle1->addItems(actions); + m_configShuttle.kcfg_shuttle2->addItems(actions); + m_configShuttle.kcfg_shuttle3->addItems(actions); + m_configShuttle.kcfg_shuttle4->addItems(actions); + m_configShuttle.kcfg_shuttle5->addItems(actions); + + connect(m_configCapture.kcfg_video4vdevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); + connect(m_configCapture.kcfg_video4adevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); + connect(m_configCapture.kcfg_video4vformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); + connect(m_configCapture.kcfg_video4aformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); + connect(m_configCapture.kcfg_video4vencoding, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); + connect(m_configCapture.kcfg_video4aencoding, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); + connect(m_configCapture.kcfg_video4size, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); + connect(m_configCapture.kcfg_video4rate, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); QStringList profilesNames = ProfilesDialog::getProfileNames(); m_configMisc.profiles_list->addItems(profilesNames); @@ -74,14 +88,14 @@ KdenliveSettingsDialog::~KdenliveSettingsDialog() {} void KdenliveSettingsDialog::rebuildVideo4Commands() { QString captureCommand; - if (!m_configCapture.kcfg_video4adevice->text().isEmpty()) captureCommand = "-f " + m_configCapture.kcfg_video4aformat->text() + " -i " + m_configCapture.kcfg_video4adevice->text(); + if (!m_configCapture.kcfg_video4adevice->text().isEmpty()) captureCommand = "-f " + m_configCapture.kcfg_video4aformat->text() + " -i " + m_configCapture.kcfg_video4adevice->text(); - captureCommand += " -f " + m_configCapture.kcfg_video4vformat->text() + " -s " + m_configCapture.kcfg_video4size->text() + " -r " + QString::number(m_configCapture.kcfg_video4rate->value()) + " -i " + m_configCapture.kcfg_video4vdevice->text() + " -f " + m_configCapture.kcfg_video4vencoding->text(); - m_configCapture.kcfg_video4capture->setText(captureCommand); + captureCommand += " -f " + m_configCapture.kcfg_video4vformat->text() + " -s " + m_configCapture.kcfg_video4size->text() + " -r " + QString::number(m_configCapture.kcfg_video4rate->value()) + " -i " + m_configCapture.kcfg_video4vdevice->text() + " -f " + m_configCapture.kcfg_video4vencoding->text(); + m_configCapture.kcfg_video4capture->setText(captureCommand); - QString playbackCommand; - playbackCommand = "-f " + m_configCapture.kcfg_video4vencoding->text(); - m_configCapture.kcfg_video4playback->setText(playbackCommand); + QString playbackCommand; + playbackCommand = "-f " + m_configCapture.kcfg_video4vencoding->text(); + m_configCapture.kcfg_video4playback->setText(playbackCommand); } bool KdenliveSettingsDialog::hasChanged() { diff --git a/src/kdenlivesettingsdialog.h b/src/kdenlivesettingsdialog.h index 975e1a54..cd82bf13 100644 --- a/src/kdenlivesettingsdialog.h +++ b/src/kdenlivesettingsdialog.h @@ -29,6 +29,7 @@ #include "ui_configenv_ui.h" #include "ui_configdisplay_ui.h" #include "ui_configcapture_ui.h" +#include "ui_configjogshuttle_ui.h" class KdenliveSettingsDialog : public KConfigDialog { Q_OBJECT @@ -49,10 +50,12 @@ private: KPageWidgetItem *page2; KPageWidgetItem *page3; KPageWidgetItem *page4; + KPageWidgetItem *page5; Ui::ConfigEnv_UI m_configEnv; Ui::ConfigMisc_UI m_configMisc; Ui::ConfigDisplay_UI m_configDisplay; Ui::ConfigCapture_UI m_configCapture; + Ui::ConfigJogShuttle_UI m_configShuttle; QStringList m_mltProfilesList; QStringList m_customProfilesList; bool m_isCustomProfile; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 02c20ee7..899ce884 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -66,7 +66,7 @@ MainWindow::MainWindow(QWidget *parent) : KXmlGuiWindow(parent), - m_activeDocument(NULL), m_activeTimeline(NULL), m_renderWidget(NULL) { + m_activeDocument(NULL), m_activeTimeline(NULL), m_renderWidget(NULL), m_jogProcess(NULL) { parseProfiles(); m_commandStack = new QUndoGroup; @@ -82,7 +82,6 @@ MainWindow::MainWindow(QWidget *parent) m_timelineArea->setCornerWidget(closeTabButton); connect(m_timelineArea, SIGNAL(currentChanged(int)), this, SLOT(activateDocument())); - initEffects::parseEffectFiles(&m_audioEffects, &m_videoEffects); m_monitorManager = new MonitorManager(); @@ -242,6 +241,8 @@ MainWindow::MainWindow(QWidget *parent) setAutoSaveSettings(); newFile(); + + activateShuttleDevice(); } //virtual @@ -258,6 +259,52 @@ bool MainWindow::queryClose() { } } +void MainWindow::activateShuttleDevice() { + if (m_jogProcess) delete m_jogProcess; + m_jogProcess = NULL; + if (KdenliveSettings::enableshuttle() == false) return; + m_jogProcess = new JogShuttle(KdenliveSettings::shuttledevice()); + connect(m_jogProcess, SIGNAL(rewind1()), m_monitorManager, SLOT(slotRewindOneFrame())); + connect(m_jogProcess, SIGNAL(forward1()), m_monitorManager, SLOT(slotForwardOneFrame())); + connect(m_jogProcess, SIGNAL(rewind(double)), m_monitorManager, SLOT(slotRewind(double))); + connect(m_jogProcess, SIGNAL(forward(double)), m_monitorManager, SLOT(slotForward(double))); + connect(m_jogProcess, SIGNAL(stop()), m_monitorManager, SLOT(slotPlay())); + connect(m_jogProcess, SIGNAL(button(int)), this, SLOT(slotShuttleButton(int))); +} + +void MainWindow::slotShuttleButton(int code) { + switch (code) { + case 5: + slotShuttleAction(KdenliveSettings::shuttle1()); + break; + case 6: + slotShuttleAction(KdenliveSettings::shuttle2()); + break; + case 7: + slotShuttleAction(KdenliveSettings::shuttle3()); + break; + case 8: + slotShuttleAction(KdenliveSettings::shuttle4()); + break; + case 9: + slotShuttleAction(KdenliveSettings::shuttle5()); + break; + } +} + +void MainWindow::slotShuttleAction(int code) { + switch (code) { + case 0: + return; + case 1: + m_monitorManager->slotPlay(); + break; + default: + m_monitorManager->slotPlay(); + break; + } +} + void MainWindow::slotFullScreen() { //KToggleFullScreenAction::setFullScreen(this, actionCollection()->action("fullscreen")->isChecked()); } @@ -733,6 +780,7 @@ void MainWindow::updateConfiguration() { } timeline_buttons_ui.buttonAudio->setDown(KdenliveSettings::audiothumbnails()); timeline_buttons_ui.buttonVideo->setDown(KdenliveSettings::videothumbnails()); + activateShuttleDevice(); } void MainWindow::slotSwitchVideoThumbs() { @@ -811,4 +859,12 @@ void MainWindow::slotGotProgressInfo(KUrl url, int progress) { } } +void MainWindow::customEvent(QEvent* e) { + if (e->type() == QEvent::User) { + // The timeline playing position changed... + kDebug() << "RECIEVED JOG EVEMNT!!!"; + } +} + + #include "mainwindow.moc" diff --git a/src/mainwindow.h b/src/mainwindow.h index d8cf446c..4a98c20b 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -47,6 +48,7 @@ #include "transitionsettings.h" #include "ui_timelinebuttons_ui.h" #include "renderwidget.h" +#include "jogshuttle.h" class MainWindow : public KXmlGuiWindow { Q_OBJECT @@ -58,6 +60,7 @@ public: protected: virtual bool queryClose(); + virtual void customEvent(QEvent * e); private: KTabWidget* m_timelineArea; @@ -110,9 +113,13 @@ private: RenderWidget *m_renderWidget; Ui::TimelineButtons_UI timeline_buttons_ui; + JogShuttle *m_jogProcess; + KRecentFilesAction *m_fileOpenRecent; void readOptions(); void saveOptions(); + void activateShuttleDevice(); + void slotShuttleAction(int code); public slots: void openFile(const KUrl &url); @@ -153,6 +160,7 @@ private slots: void slotAddAudioEffect(QAction *result); void slotAddCustomEffect(QAction *result); void slotAddProjectClip(KUrl url); + void slotShuttleButton(int code); }; #endif diff --git a/src/monitor.cpp b/src/monitor.cpp index 5ac13d2a..d22a90bd 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -133,20 +133,24 @@ void Monitor::slotSeek(int pos) { m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(m_position)); } -void Monitor::slotRewind() { +void Monitor::slotRewind(double speed) { if (!m_isActive) m_monitorManager->activateMonitor(m_name); - double speed = render->playSpeed(); - if (speed >= 0) render->play(-2); - else render->play(speed * 2); + if (speed == 0) { + double currentspeed = render->playSpeed(); + if (currentspeed >= 0) render->play(-2); + else render->play(currentspeed * 2); + } else render->play(speed); m_playAction->setChecked(true); m_playAction->setIcon(m_pauseIcon); } -void Monitor::slotForward() { +void Monitor::slotForward(double speed) { if (!m_isActive) m_monitorManager->activateMonitor(m_name); - double speed = render->playSpeed(); - if (speed <= 1) render->play(2); - else render->play(speed * 2); + if (speed == 0) { + double currentspeed = render->playSpeed(); + if (currentspeed <= 1) render->play(2); + else render->play(currentspeed * 2); + } else render->play(speed); m_playAction->setChecked(true); m_playAction->setIcon(m_pauseIcon); } diff --git a/src/monitor.h b/src/monitor.h index 39e7e2ff..3ae530b4 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -89,8 +89,8 @@ public slots: void start(); void activateMonitor(); void slotPlay(); - void slotForward(); - void slotRewind(); + void slotForward(double speed = 0); + void slotRewind(double speed = 0); void slotRewindOneFrame(); void slotForwardOneFrame(); void saveSceneList(QString path, QDomElement e = QDomElement()); diff --git a/src/monitormanager.cpp b/src/monitormanager.cpp index aff20087..9c163f07 100644 --- a/src/monitormanager.cpp +++ b/src/monitormanager.cpp @@ -79,14 +79,14 @@ void MonitorManager::slotPlay() { else m_projectMonitor->slotPlay(); } -void MonitorManager::slotRewind() { - if (m_activeMonitor == "clip") m_clipMonitor->slotRewind(); - else m_projectMonitor->slotRewind(); +void MonitorManager::slotRewind(double speed) { + if (m_activeMonitor == "clip") m_clipMonitor->slotRewind(speed); + else m_projectMonitor->slotRewind(speed); } -void MonitorManager::slotForward() { - if (m_activeMonitor == "clip") m_clipMonitor->slotForward(); - else m_projectMonitor->slotForward(); +void MonitorManager::slotForward(double speed) { + if (m_activeMonitor == "clip") m_clipMonitor->slotForward(speed); + else m_projectMonitor->slotForward(speed); } void MonitorManager::slotRewindOneFrame() { diff --git a/src/monitormanager.h b/src/monitormanager.h index e8f5aa77..a33af55c 100644 --- a/src/monitormanager.h +++ b/src/monitormanager.h @@ -40,8 +40,8 @@ public: public slots: void activateMonitor(QString name = QString::null); void slotPlay(); - void slotRewind(); - void slotForward(); + void slotRewind(double speed = 0); + void slotForward(double speed = 0); void slotRewindOneFrame(); void slotForwardOneFrame(); diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index bdb3fb68..5203bc92 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -83,17 +83,17 @@ RecMonitor::RecMonitor(QString name, QWidget *parent) displayProcess->setEnvironment(env); if (KdenliveSettings::video4capture().isEmpty()) { - QString captureCommand; - if (!KdenliveSettings::video4adevice().isEmpty()) captureCommand = "-f " + KdenliveSettings::video4aformat() + " -i " + KdenliveSettings::video4adevice(); + QString captureCommand; + if (!KdenliveSettings::video4adevice().isEmpty()) captureCommand = "-f " + KdenliveSettings::video4aformat() + " -i " + KdenliveSettings::video4adevice(); - captureCommand += " -f " + KdenliveSettings::video4vformat() + " -s " + KdenliveSettings::video4size() + " -r " + QString::number(KdenliveSettings::video4rate()) + " -i " + KdenliveSettings::video4vdevice() + " -f " + KdenliveSettings::video4vencoding(); - KdenliveSettings::setVideo4capture(captureCommand); + captureCommand += " -f " + KdenliveSettings::video4vformat() + " -s " + KdenliveSettings::video4size() + " -r " + QString::number(KdenliveSettings::video4rate()) + " -i " + KdenliveSettings::video4vdevice() + " -f " + KdenliveSettings::video4vencoding(); + KdenliveSettings::setVideo4capture(captureCommand); } if (KdenliveSettings::video4playback().isEmpty()) { - QString playbackCommand; - playbackCommand = "-f " + KdenliveSettings::video4vencoding(); - KdenliveSettings::setVideo4playback(playbackCommand); + QString playbackCommand; + playbackCommand = "-f " + KdenliveSettings::video4vencoding(); + KdenliveSettings::setVideo4playback(playbackCommand); } kDebug() << "/////// BUILDING MONITOR, ID: " << ui.video_frame->winId(); } @@ -227,7 +227,7 @@ void RecMonitor::slotStartCapture(bool play) { m_captureArgs << "--format" << "hdv" << "-i" << "capture" << "-"; m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-"; } else { - m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << "-"; + m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << "-"; m_displayArgs << KdenliveSettings::video4playback().simplified().split(' ') << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-"; } @@ -288,8 +288,8 @@ void RecMonitor::slotRecord() { m_captureArgs << "--format" << "hdv" << "-i" << "capture" << "-"; m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-"; } else { - m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << "-y" << m_captureFile.path() << "-f" << KdenliveSettings::video4vencoding() << "-"; - m_displayArgs << KdenliveSettings::video4playback().simplified().split(' ') << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-"; + m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << "-y" << m_captureFile.path() << "-f" << KdenliveSettings::video4vencoding() << "-"; + m_displayArgs << KdenliveSettings::video4playback().simplified().split(' ') << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-"; } captureProcess->setStandardOutputProcess(displayProcess); diff --git a/src/widgets/configcapture_ui.ui b/src/widgets/configcapture_ui.ui index 647a8136..559f1435 100644 --- a/src/widgets/configcapture_ui.ui +++ b/src/widgets/configcapture_ui.ui @@ -31,17 +31,7 @@ - - - - Capture folder - - - - - - - + @@ -137,6 +127,19 @@ Video4Linux2 / FFmpeg + + + + + 0 + 0 + + + + /dev/video0 + + + @@ -151,28 +154,21 @@ - - - - Device - - - - - + + - + 0 0 - /dev/video0 + Format - - + + 0 @@ -180,7 +176,7 @@ - Format + Encoding @@ -197,36 +193,40 @@ - - + + - + 0 0 - Encoding + ogg - - + + + + Device + + + + + 0 0 - - ogg - - - + + - Audio + /dev/dsp @@ -237,20 +237,6 @@ - - - - Device - - - - - - - /dev/dsp - - - @@ -264,16 +250,17 @@ - - - - - 0 - 0 - + + + + Device + + + + - oss + Audio @@ -290,16 +277,6 @@ - - - - - 0 - 0 - - - - @@ -314,6 +291,13 @@ + + + + Frame rate + + + @@ -321,10 +305,10 @@ - - + + - Frame rate + Capture params @@ -335,16 +319,12 @@ - - - - Capture params - - - + + + @@ -352,8 +332,18 @@ - - + + + + + 0 + 0 + + + + oss + + kcfg_video4vdevice @@ -384,7 +374,7 @@ - + Qt::Vertical @@ -410,11 +400,6 @@ QLineEdit
klineedit.h
- - KUrlRequester - QFrame -
kurlrequester.h
-
diff --git a/src/widgets/configenv_ui.ui b/src/widgets/configenv_ui.ui index 716850a6..2c2b4947 100644 --- a/src/widgets/configenv_ui.ui +++ b/src/widgets/configenv_ui.ui @@ -5,8 +5,8 @@ 0 0 - 394 - 203 + 416 + 238
@@ -55,6 +55,16 @@ + + + + Capture folder + + + + + +
diff --git a/src/widgets/configjogshuttle_ui.ui b/src/widgets/configjogshuttle_ui.ui new file mode 100644 index 00000000..0c2dafaa --- /dev/null +++ b/src/widgets/configjogshuttle_ui.ui @@ -0,0 +1,113 @@ + + ConfigJogShuttle_UI + + + + 0 + 0 + 299 + 260 + + + + + + + Enable Jog Shuttle device + + + + + + + Device path + + + + + + + /dev/input/event1 + + + + + + + Button 1 + + + + + + + + + + Button 2 + + + + + + + + + + Button 3 + + + + + + + + + + Button 4 + + + + + + + + + + Button 5 + + + + + + + + + + Qt::Vertical + + + + 20 + 56 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KLineEdit + QLineEdit +
klineedit.h
+
+
+ + +
diff --git a/src/widgets/recmonitor_ui.ui b/src/widgets/recmonitor_ui.ui index 21b41a2b..e04a324f 100644 --- a/src/widgets/recmonitor_ui.ui +++ b/src/widgets/recmonitor_ui.ui @@ -56,12 +56,12 @@ - Firewire / dvgrab + Firewire - Video4Linux / ffmpeg + Video4Linux -- 2.39.2