]> git.sesse.net Git - kdenlive/commitdiff
Fix 1 frame offset in image / color clips, fix changing duration of image/color clips
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 22 Dec 2012 21:28:51 +0000 (22:28 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 22 Dec 2012 21:28:51 +0000 (22:28 +0100)
src/clipmanager.cpp
src/docclipbase.cpp
src/projectitem.cpp
src/projectlist.cpp
src/renderer.cpp

index 486050093b77538a89c5feae324a9d234d66e73b..8ae95fbf986ab879ca9a9e07e9cd77274ae592d1 100644 (file)
@@ -574,7 +574,7 @@ void ClipManager::slotAddClipList(const KUrl::List urls, QMap <QString, QString>
             if (type->name().startsWith("image/")) {
                 prod.setAttribute("type", (int) IMAGE);
                 prod.setAttribute("in", 0);
-                prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::image_duration()));
+                prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::image_duration()) - 1);
                 if (KdenliveSettings::autoimagetransparency()) prod.setAttribute("transparency", 1);
                 // Read EXIF metadata for JPEG
                 if (type->is("image/jpeg")) {
@@ -612,7 +612,7 @@ void ClipManager::slotAddClipList(const KUrl::List urls, QMap <QString, QString>
                     if (out > 0)
                         prod.setAttribute("out", out);
                     else
-                        prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::title_duration()));
+                        prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::title_duration()) - 1);
                 } else
                     txtfile.close();
             }
@@ -659,7 +659,7 @@ void ClipManager::slotAddColorClipFile(const QString &name, const QString &color
     uint id = m_clipIdCounter++;
     prod.setAttribute("id", QString::number(id));
     prod.setAttribute("in", "0");
-    prod.setAttribute("out", m_doc->getFramePos(duration));
+    prod.setAttribute("out", m_doc->getFramePos(duration) - 1);
     prod.setAttribute("name", name);
     if (!group.isEmpty()) {
         prod.setAttribute("groupname", group);
index daeb6a57d8a313489b683941fe530d637737bf6b..a96f7f28bfe1a29844bbdfaed7d805624ff7c8ae 100644 (file)
@@ -90,7 +90,7 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin
     } else {
         int out = xml.attribute("out").toInt();
         int in = xml.attribute("in").toInt();
-        setDuration(GenTime(out - in, KdenliveSettings::project_fps()));
+        setDuration(GenTime(out - in + 1, KdenliveSettings::project_fps()));
     }
 
     if (!m_properties.contains("name")) m_properties.insert("name", url.fileName());
@@ -1084,8 +1084,10 @@ void DocClipBase::setProperty(const QString &key, const QString &value)
     if (key == "resource") {
         getFileHash(value);
         if (m_thumbProd) m_thumbProd->updateClipUrl(KUrl(value), m_properties.value("file_hash"));
-    } else if (key == "out") setDuration(GenTime(value.toInt(), KdenliveSettings::project_fps()));
     //else if (key == "transparency") m_clipProducer->set("transparency", value.toInt());
+    } else if (key == "out") {
+       setDuration(GenTime(value.toInt() + 1, KdenliveSettings::project_fps()));
+    }
     else if (key == "colour") {
         setProducerProperty("colour", value.toUtf8().data());
     } else if (key == "templatetext") {
@@ -1317,7 +1319,7 @@ const QString DocClipBase::geometryWithOffset(QString data, int offset)
     if (offset == 0) return data;
     Mlt::Profile *profile = m_baseTrackProducers.at(0)->profile();
     Mlt::Geometry geometry(data.toUtf8().data(), m_properties.value("duration").toInt(), profile->width(), profile->height());
-    Mlt::Geometry newgeometry("", m_properties.value("duration").toInt(), profile->width(), profile->height());
+    Mlt::Geometry newgeometry(NULL, m_properties.value("duration").toInt(), profile->width(), profile->height());
     Mlt::GeometryItem item;
     int pos = 0;
     while (!geometry.next_key(&item, pos)) {
index c26f5ce94b8f330be69914175ce0948c2cc336c3..d1508f2e5556a21ab8c0c26a08420de107d564ba 100644 (file)
@@ -74,6 +74,7 @@ void ProjectItem::buildItem(QSize pixmapSize)
        default:
            setData(0, Qt::DecorationRole, KIcon("video-x-generic").pixmap(pixmapSize));
     }
+    if (m_clipType != UNKNOWN) slotSetToolTip();
     
     setText(0, name);
     setText(1, m_clip->description());
index 12b19abe0ac0f44a22631650fd74f6b3ee5aa17f..35f02b11748f82df7696f7db2664a259ec127027 100644 (file)
@@ -715,10 +715,11 @@ void ProjectList::slotReloadClip(const QString &id)
             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(clip->producerProperty("length")).toInt();
-                if (length > 0 && !e.hasAttribute("length")) {
-                    e.setAttribute("length", length);
-                }
+               int length = QString(clip->producerProperty("length")).toInt();
+               if (length > 0 && !e.hasAttribute("length")) {
+                   e.setAttribute("length", length);
+               }
+               e.setAttribute("duration", clip->getProperty("duration"));
             }
             resetThumbsProducer(clip);
             m_render->getFileProperties(e, item->clipId(), m_listView->iconSize().height(), true);
index 849dd873f1a3bef8cd5cf05ba838429d0ac0d044..85ee9276b531e4e094b15343a2853dfa6f2d4da3 100644 (file)
@@ -815,9 +815,17 @@ void Render::processFileProperties()
                 length = info.xml.attribute("length").toInt();
                 clipOut = length - 1;
             }
-            else length = info.xml.attribute("out").toInt() - info.xml.attribute("in").toInt();
-            producer->set("length", length);
-           duration = length;
+            else length = info.xml.attribute("out").toInt() - info.xml.attribute("in").toInt() + 1;
+           // Pass duration if it was forced
+           if (info.xml.hasAttribute("duration")) {
+               duration = info.xml.attribute("duration").toInt();
+               if (length < duration) {
+                   length = duration;
+                   if (clipOut > 0) clipOut = length - 1;
+               }
+           }
+           if (duration == 0) duration = length;
+           producer->set("length", length);
         }
 
         if (clipOut > 0) producer->set_in_and_out(info.xml.attribute("in").toInt(), clipOut);
@@ -1590,7 +1598,6 @@ void Render::switchPlay(bool play)
     } else if (!play) {
        m_paused = true;
        m_mltProducer->set_speed(0.0);
-       //m_mltProducer->pause();
     }
 }