]> git.sesse.net Git - kdenlive/commitdiff
Fix jogshuttle triggering pause and external wheel not working: http://kdenlive.org...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 19 Nov 2012 21:47:51 +0000 (22:47 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 19 Nov 2012 21:47:51 +0000 (22:47 +0100)
src/jogaction.cpp
src/jogshuttle.cpp
src/jogshuttle.h
src/kdenlivesettingsdialog.cpp
src/renderer.cpp

index 13bbb2091e6e7196e916efbbfd61bc0a43391f66..9453556ff78ce30a7403f6b223eaec7781a00723 100644 (file)
@@ -24,7 +24,8 @@
 #include <klocalizedstring.h>
 
 // TODO(fleury): this should probably be a user configuration parameter (at least the max speed).
-const double SPEEDS[] = {0.0, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0};
+//const double SPEEDS[] = {0.0, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0};
+const double SPEEDS[] = {0.0, 1.0, 2.0, 4.0, 5.0, 8.0, 16.0, 60.0};
 const size_t SPEEDS_SIZE = sizeof(SPEEDS) / sizeof(double);
 
 JogShuttleAction::JogShuttleAction (const JogShuttle* jogShuttle, const QStringList& actionMap, QObject * parent)
index 8446076e95da3e74a9186a29b5f0dd867ecabb1e..16fd171f4d0e17ce80a982a84c1647716de610db 100644 (file)
@@ -73,7 +73,7 @@ void ShuttleThread::init(QObject *parent, QString device)
     stop_me = false;
     m_isWorking = false;
     shuttlevalue = 0xffff;
-    shuttlechange = false;
+    shuttlecounter = 0;
     jogvalue = 0xffff;
 }
 
@@ -149,15 +149,17 @@ void ShuttleThread::shuttle(int value)
     //gettimeofday( &last_shuttle, 0 );
     //need_synthetic_shuttle = value != 0;
 
-    if (value == shuttlevalue)
+    if (value == shuttlevalue) {
+       shuttlecounter = 1;
         return;
+    }
 
     if (value > MAX_SHUTTLE_RANGE || value < -MAX_SHUTTLE_RANGE) {
         fprintf(stderr, "Jog Shuttle returned value of %d (should be between -%d ad +%d)", value, MAX_SHUTTLE_RANGE, MAX_SHUTTLE_RANGE);
         return;
     }
     shuttlevalue = value;
-    shuttlechange = true;
+    shuttlecounter = 1;
     QApplication::postEvent(m_parent, new QEvent((QEvent::Type) (JOG_STOP + value)));
 }
 
@@ -184,14 +186,16 @@ void ShuttleThread::jog(unsigned int value)
             QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_BACK1));
         else if ((forward && !wrap) || (rewind && wrap))
             QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_FWD1));
-        else if (!forward && !rewind && !shuttlechange)
+        else if (!forward && !rewind && shuttlecounter > 2) {
             // An event without changing the jog value is sent after each shuttle change.
             // As the shuttle rest position does not get a shuttle event, only a non-position-changing jog event.
             // Hence we stop on this when we see 2 non-position-changing jog events in a row.
+           shuttlecounter = 0;
             QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_STOP));
+       }
     }
     jogvalue = value;
-    shuttlechange = false;
+    if (shuttlecounter > 0) shuttlecounter++;
 }
 
 
index 2c28d88fc1238e1d6e9b78d1610a9a7002410153..34673fa65348c697c1b622ae749606273a1c8f64 100644 (file)
@@ -37,7 +37,7 @@ public:
     void init(QObject *parent, QString device);
     QObject *m_parent;
     int shuttlevalue;
-    bool shuttlechange;
+    int shuttlecounter;
     unsigned short jogvalue;
     bool isWorking();
     bool stop_me;
index 7afa59472bc36cbd4e965c6f0c52974499c4f92f..58d713769f8bd6de11b58c5d3b02a74cd44f2e7a 100644 (file)
@@ -533,7 +533,7 @@ void KdenliveSettingsDialog::slotCheckShuttle(int state)
         int fd;
         for (int i = 0; i < 30; i++) {
             QString filename = baseName + QString::number(i);
-            kDebug() << "/// CHECKING OFR: " << filename;
+            kDebug() << "/// CHECKING device: " << filename;
 
             char name[256] = "unknown";
             fd = KDE_open((char *) filename.toUtf8().data(), O_RDONLY);
index c08488d2e2660326eb90b0fe1486a5598ee0a040..72625b5bc94464c4dbbb7efe466c565f533a124a 100644 (file)
@@ -1581,6 +1581,7 @@ void Render::play(double speed)
         return;
     // if (speed == 0.0) m_mltProducer->set("out", m_mltProducer->get_length() - 1);
     m_mltProducer->set_speed(speed);
+    if (speed != 0) m_mltConsumer->set("refresh", 1);
 }
 
 void Render::play(const GenTime & startTime)