]> git.sesse.net Git - kdenlive/commitdiff
Fix timeline corruption when reloading clip
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 13 Jan 2011 22:57:04 +0000 (22:57 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 13 Jan 2011 22:57:04 +0000 (22:57 +0000)
svn path=/trunk/kdenlive/; revision=5319

src/customtrackview.cpp
src/projectlist.cpp
src/renderer.cpp

index 3b6e48e3fee6377aab0988f4bb9a1dc6c63e6ea6..17ba812b6c54a64723cf835625cdc7f854071453 100644 (file)
@@ -4044,7 +4044,7 @@ void CustomTrackView::slotUpdateClip(const QString &clipId, bool reload)
             if (clip->clipProducer() == clipId) {
                 ItemInfo info = clip->info();
                 info.track = m_document->tracksCount() - clip->track();
-                if (reload && !m_document->renderer()->mltUpdateClip(info, clip->xml(), clip->baseClip()->producer())) {
+                if (reload && !m_document->renderer()->mltUpdateClip(info, clip->xml(), clip->baseClip()->producer(info.track))) {
                     emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", info.startPos.frames(m_document->fps()), info.track), ErrorMessage);
                 }
                 clip->refreshClip(true);
index 09d3200ae31b0edc3f5c86971518bf82fdf2770e..ff3b6acc350078275dbbd188647b3e5145277e65 100644 (file)
@@ -414,18 +414,28 @@ void ProjectList::slotReloadClip(const QString &id)
         }
         item = static_cast <ProjectItem *>(selected.at(i));
         if (item) {
-            if (item->clipType() == TEXT) {
+            CLIPTYPE t = item->clipType();
+            if (t == TEXT) {
                 if (!item->referencedClip()->getProperty("xmltemplate").isEmpty())
                     regenerateTemplate(item);
-            } else if (item->clipType() != COLOR && item->clipType() != SLIDESHOW && item->referencedClip() &&  item->referencedClip()->checkHash() == false) {
+            } else if (t != COLOR && t != SLIDESHOW && item->referencedClip() &&  item->referencedClip()->checkHash() == false) {
                 item->referencedClip()->setPlaceHolder(true);
                 item->setProperty("file_hash", QString());
-            } else if (item->clipType() == IMAGE) {
+            } else if (t == IMAGE) {
                 item->referencedClip()->producer()->set("force_reload", 1);
             }
-            //requestClipInfo(item->toXml(), item->clipId(), true);
-            // Clear the file_hash value, which will cause a complete reload of the clip
-            emit getFileProperties(item->toXml(), item->clipId(), m_listView->iconSize().height(), true);
+
+            QDomElement e = item->toXml();
+            // Make sure we get the correct producer length if it was adjusted in timeline
+            if (t == COLOR || t == IMAGE || t == SLIDESHOW || t == TEXT) {
+                int length = QString(item->referencedClip()->producerProperty("length")).toInt();
+                if (length > 0 && !e.hasAttribute("length")) {
+                    e.setAttribute("length", length);
+                    e.setAttribute("out", length - 1);
+                }
+            }
+            
+            emit getFileProperties(e, item->clipId(), m_listView->iconSize().height(), true);
         }
     }
 }
index d7b7a1ee1152138e77bbc79332625ed85b010e1d..37316771e6fdefc5f71b9ccafc0a661ddf85b9fb 100644 (file)
@@ -1766,7 +1766,8 @@ bool Render::mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *pr
         mlt_service_unlock(service.get_service());
         return false;
     }
-    Mlt::Producer *clip2 = prod->cut(info.cropStart.frames(m_fps), (info.cropDuration + info.cropStart).frames(m_fps));
+
+    Mlt::Producer *clip2 = prod->cut(info.cropStart.frames(m_fps), (info.cropDuration + info.cropStart).frames(m_fps) - 1);
     trackPlaylist.insert_at(info.startPos.frames(m_fps), clip2, 1);
     delete clip2;