]> git.sesse.net Git - kdenlive/commitdiff
Fix monitor startup / switching showing no video
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 25 Oct 2011 19:05:01 +0000 (19:05 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 25 Oct 2011 19:05:01 +0000 (19:05 +0000)
svn path=/trunk/kdenlive/; revision=5989

src/docclipbase.cpp
src/mainwindow.cpp
src/monitor.cpp
src/projectlist.cpp
src/projectlist.h
src/renderer.cpp
src/renderer.h

index bc399d6a7b724581e90e375b46af6cc05dc06779..5c06003c432b7a089ff8501fe75b8b691f2b4a11 100644 (file)
@@ -686,8 +686,9 @@ Mlt::Producer *DocClipBase::getProducer(int track)
             // Could not find a valid producer for that clip, check in 
             return NULL;
         }
-        m_baseTrackProducers[track] = cloneProducer(m_baseTrackProducers.at(i));
-        adjustProducerProperties(m_baseTrackProducers.at(track), QString(getId() + '_' + QString::number(track)), false, false);
+        Mlt::Producer *prod = cloneProducer(m_baseTrackProducers.at(i));
+        adjustProducerProperties(prod, QString(getId() + '_' + QString::number(track)), false, false);
+        m_baseTrackProducers[track] = prod;
     }
     return m_baseTrackProducers.at(track);
 }
index e72108fe541a3596ed3627f5801d8e4e1ab62329..3e8e4cdc2e83377e17d18380938e57016dd631fe 100644 (file)
@@ -2091,8 +2091,6 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
     slotGotProgressInfo(QString(), -1);
     m_projectMonitor->adjustRulerSize(trackView->duration());
     m_projectMonitor->slotZoneMoved(trackView->inPoint(), trackView->outPoint());
-    m_clipMonitor->refreshMonitor(true);
-
     progressDialog.progressBar()->setValue(4);
     if (openBackup) slotOpenBackupDialog(url);
 }
@@ -2571,6 +2569,8 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
 #endif
     //Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
     slotUpdateMousePosition(0);
+    m_monitorManager->activateMonitor("clip");
+    m_projectList->slotClipSelected();
     // set tool to select tool
     m_buttonSelectTool->setChecked(true);
 }
index c1c755ca72f1b416e97105db8ecd6749439fa511..0c796086bb9d4ab3d63c08b60b657d181c0ac9c8 100644 (file)
@@ -732,6 +732,7 @@ void Monitor::stop()
 
 void Monitor::start()
 {
+    if (!isVisible()) return;
     if (render) render->start();
     connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
 }
index b45a6dac28d5e9f11cf3f2f770991cbbec751da5..47a4afd234975b08241ae511049eb2c045cfbbeb 100644 (file)
@@ -253,6 +253,10 @@ void ProjectList::setupGeneratorMenu(QMenu *addMenu, QMenu *transcodeMenu, QMenu
     m_menu->insertSeparator(m_deleteButton->defaultAction());
 }
 
+void ProjectList::clearSelection()
+{
+    m_listView->clearSelection();
+}
 
 QByteArray ProjectList::headerInfo() const
 {
index 7aa86310b6154178e31601baa58944559783d495..f4a16f49d1188282d95a79e96a96b47eb42468e3 100644 (file)
@@ -236,8 +236,11 @@ public:
     bool generateImageProxy() const;
     /** @brief Returns a list of the expanded folder ids. */
     QStringList expandedFolders() const;
+    /** @brief Deselect all clips in project tree. */
+    void clearSelection();
 
 public slots:
+    void slotClipSelected();
     void setDocument(KdenliveDoc *doc);
     void updateAllClips(bool displayRatioChanged, bool fpsChanged);
     void slotReplyGetImage(const QString &clipId, const QImage &img);
@@ -344,7 +347,6 @@ private:
     void resetThumbsProducer(DocClipBase *clip);
 
 private slots:
-    void slotClipSelected();
     void slotAddSlideshowClip();
     void slotAddTitleClip();
     void slotAddTitleTemplateClip();
index 8aefda7abce5ccc225746ba92aba7015e7051d07..6c6f7804c423005e45011f89c16fb627aaaf8420 100644 (file)
@@ -1033,7 +1033,20 @@ int Render::setProducer(Mlt::Producer *producer, int position)
     m_mltProducer->set("meta.volume", (double)volume / 100);
     m_fps = m_mltProducer->get_fps();
     blockSignals(false);
-    int error = connectPlaylist();
+    m_mltConsumer->connect(*m_mltProducer);
+    m_mltProducer->set_speed(0);
+    emit durationChanged(m_mltProducer->get_playtime());
+    if (m_mltConsumer->start() == -1) {
+        // ARGH CONSUMER BROKEN!!!!
+        KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
+        if (m_showFrameEvent) delete m_showFrameEvent;
+        m_showFrameEvent = NULL;
+        if (m_pauseEvent) delete m_pauseEvent;
+        m_pauseEvent = NULL;
+        delete m_mltConsumer;
+        m_mltConsumer = NULL;
+        return -1;
+    }
 
     position = m_mltProducer->position();
     m_mltConsumer->set("refresh", 1);
@@ -1043,7 +1056,7 @@ int Render::setProducer(Mlt::Producer *producer, int position)
     m_mltConsumer->wait_for(ev);
     delete ev;
     emit rendererPosition(position);
-    return error;
+    return 0;
 }
 
 int Render::setSceneList(QDomDocument list, int position)
@@ -1165,8 +1178,9 @@ int Render::setSceneList(QString playlist, int position)
     }
 
     kDebug() << "// NEW SCENE LIST DURATION SET TO: " << m_mltProducer->get_playtime();
-    if (error == 0) error = connectPlaylist();
-    else connectPlaylist();
+    m_mltConsumer->connect(*m_mltProducer);
+    m_mltProducer->set_speed(0);
+    emit durationChanged(m_mltProducer->get_playtime());
     fillSlowMotionProducers();
     blockSignals(false);
 
@@ -1269,27 +1283,6 @@ double Render::fps() const
     return m_fps;
 }
 
-int Render::connectPlaylist()
-{
-    if (!m_mltConsumer) return -1;
-    m_mltConsumer->connect(*m_mltProducer);
-    m_mltProducer->set_speed(0);
-    if (m_mltConsumer->start() == -1) {
-        // ARGH CONSUMER BROKEN!!!!
-        KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
-        if (m_showFrameEvent) delete m_showFrameEvent;
-        m_showFrameEvent = NULL;
-        if (m_pauseEvent) delete m_pauseEvent;
-        m_pauseEvent = NULL;
-        delete m_mltConsumer;
-        m_mltConsumer = NULL;
-        return -1;
-    }
-    emit durationChanged(m_mltProducer->get_playtime());
-    return 0;
-}
-
-
 int Render::volume() const
 {
     if (!m_mltConsumer || !m_mltProducer) return -1;
@@ -1329,13 +1322,14 @@ void Render::slotOsdTimeout()
 
 void Render::start()
 {
+    m_refreshTimer.stop();
     QMutexLocker locker(&m_mutex);
     if (m_winid == -1) {
         kDebug() << "-----  BROKEN MONITOR: " << m_name << ", RESTART";
         return;
     }
-
-    if (m_mltConsumer && m_mltConsumer->is_stopped()) {
+    if (!m_mltConsumer) return;
+    if (m_mltConsumer->is_stopped()) {
         if (m_mltConsumer->start() == -1) {
             //KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
             kDebug(QtWarningMsg) << "/ / / / CANNOT START MONITOR";
@@ -1348,6 +1342,7 @@ void Render::start()
 
 void Render::stop()
 {
+    m_refreshTimer.stop();
     QMutexLocker locker(&m_mutex);
     if (m_mltProducer == NULL) return;
     if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
@@ -1363,6 +1358,7 @@ void Render::stop()
 
 void Render::stop(const GenTime & startTime)
 {
+    m_refreshTimer.stop();
     QMutexLocker locker(&m_mutex);
     if (m_mltProducer) {
         if (m_isZoneMode) resetZoneMode();
@@ -1491,15 +1487,6 @@ void Render::seekToFrameDiff(int diff)
 void Render::doRefresh()
 {
     m_refreshTimer.start();
-    /*QMutexLocker locker(&m_mutex);
-    if (m_mltConsumer) {
-        if (m_mltConsumer->is_stopped()) {
-            kDebug()<<"pppppppppppppppp\n\nSTARTING CONSUMER: "<<m_name<<m_mltConsumer->start();
-        }
-        //m_mltProducer->set_speed(1);
-        m_mltConsumer->set("refresh", 1);
-        //m_mltProducer->set_speed(0);
-    }*/
 }
 
 void Render::refresh()
index 0b28916c9b8174c265ef795cf80b276924031e15..eb9f4b03448c6786f565cba5be38fd6879a12300 100644 (file)
@@ -372,7 +372,6 @@ private slots:
     /** @brief Refreshes the monitor display. */
     void refresh();
     void slotOsdTimeout();
-    int connectPlaylist();
     /** @brief Process the clip info requests (in a separate thread). */
     void processFileProperties();