]> git.sesse.net Git - kdenlive/commitdiff
Fix changing duration of image, color and text clips
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 19 Feb 2011 23:28:16 +0000 (23:28 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 19 Feb 2011 23:28:16 +0000 (23:28 +0000)
svn path=/trunk/kdenlive/; revision=5434

src/mainwindow.cpp
src/renderer.cpp

index d9e824d483796f041de44f7a911bf447e9bdcf79..c3494a6749adee8cfeb0afc2b76fe219234dc2a1 100644 (file)
@@ -3178,6 +3178,10 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip)
             if (dia_ui->outPoint() != clip->duration().frames(m_activeDocument->fps()) - 1) {
                 // duration changed, we need to update duration
                 newprops.insert("out", QString::number(dia_ui->outPoint()));
+                int currentLength = QString(clip->producerProperty("length")).toInt();
+                if (currentLength <= dia_ui->outPoint())
+                        newprops.insert("length", QString::number(dia_ui->outPoint() + 1));
+                else newprops.insert("length", clip->producerProperty("length"));
             }
             if (!path.isEmpty()) {
                 // we are editing an external file, asked if we want to detach from that file or save the result to that title file.
index ca03e6221d8c2f1e0b73d56c112edf92f5b93c97..ca524f9ede1f4048ffad7e638b139a7c789fd0c3 100644 (file)
@@ -631,12 +631,14 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int
     }
     
     int clipOut = 0;
+    int duration = 0;
     if (xml.hasAttribute("out")) clipOut = xml.attribute("out").toInt();
     
     // setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger
     if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW) {
         int length;
         if (xml.hasAttribute("length")) {
+            if (clipOut > 0) duration = clipOut + 1;
             length = xml.attribute("length").toInt();
             clipOut = length - 1;
         }
@@ -664,8 +666,8 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int
     int frameNumber = xml.attribute("thumbnail", "0").toInt();
     if (frameNumber != 0) producer->seek(frameNumber);
 
-    filePropertyMap["duration"] = QString::number(producer->get_playtime());
-    //kDebug() << "///////  PRODUCER: " << url.path() << " IS: " << producer.get_playtime();
+    filePropertyMap["duration"] = QString::number(duration > 0 ? duration : producer->get_playtime());
+    //kDebug() << "///////  PRODUCER: " << url.path() << " IS: " << producer->get_playtime();
 
     Mlt::Frame *frame = producer->get_frame();