]> git.sesse.net Git - kdenlive/commitdiff
Merge remote-tracking branch 'origin/master' into bugfix/jogshuttle
authorEd Rogalsky <ed.rogalsky@googlemail.com>
Tue, 20 Nov 2012 09:40:20 +0000 (10:40 +0100)
committerEd Rogalsky <ed.rogalsky@googlemail.com>
Tue, 20 Nov 2012 09:40:20 +0000 (10:40 +0100)
src/jogaction.cpp
src/jogshuttle.cpp
src/jogshuttle.h
src/kdenlivesettingsdialog.cpp
src/mainwindow.cpp
src/renderer.cpp
src/trackview.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 1cde287f80e4e780c2ed27bb9f49195736a986ad..f9049511dceefcc568ecf037e33c2fdec5b3ea0c 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 f2523cc93c56ec6e20a38092ac050258541a8aa7..9a6ecc0287c5dbb01483b724f49c492e6dc411c7 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();
     volatile bool stop_me;
index adb12e5848c5cd0f8c96addef90f06325d32073b..c42b1d7946d8a51e13ef2ccd23df9c30822f2155 100644 (file)
@@ -544,7 +544,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 ee580bce7cf228ec777431a6f187fccbb0048ccb..f9d5900be0d2a9cd872b9d3974acde4ae8144caf 100644 (file)
@@ -2193,7 +2193,6 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
     }
     m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
     trackView->setDuration(trackView->duration());
-    trackView->projectView()->initCursorPos(m_projectMonitor->render->seekPosition().frames(doc->fps()));
 
     if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
     slotGotProgressInfo(QString(), -1);
@@ -2583,7 +2582,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     connect(trackView->projectView(), SIGNAL(forceClipProcessing(const QString &)), m_projectList, SLOT(slotForceProcessing(const QString &)));
 
     connect(trackView->projectView(), SIGNAL(importKeyframes(GRAPHICSRECTITEM, const QString&, int)), this, SLOT(slotProcessImportKeyframes(GRAPHICSRECTITEM, const QString&, int)));
-    
+
     connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
     connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
     connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
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)
index b9df353dd99e288215eec4cbbd8c4cd7c8475ed8..e46a750b58f4e8b216f094429818b210de2aa381 100644 (file)
@@ -415,6 +415,12 @@ void TrackView::parseDocument(QDomDocument doc)
     }
     QDomElement infoXml = mlt.firstChildElement("kdenlivedoc");
 
+    QDomElement propsXml = infoXml.firstChildElement("documentproperties");
+    
+    int currentPos = propsXml.attribute("position").toInt();
+    if (currentPos > 0) m_trackview->initCursorPos(currentPos);
+    
+
     // Add guides
     QDomNodeList guides = infoXml.elementsByTagName("guide");
     for (int i = 0; i < guides.count(); i++) {