]> git.sesse.net Git - kdenlive/commitdiff
Manage clip crop start when importing geometry keyframes from a clip
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 5 Nov 2012 00:26:48 +0000 (01:26 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 5 Nov 2012 00:26:48 +0000 (01:26 +0100)
src/customtrackview.cpp

index fbb9a020ec186c2d4d9e4413c1afc9ffacceb484..57869bb2107b16c334d38c1df8963c2abb9d95a2 100644 (file)
@@ -7632,7 +7632,23 @@ void CustomTrackView::slotImportClipKeyframes(GRAPHICSRECTITEM type)
        return;
     }
     QString keyframeData = ui.data_list->itemData(ui.data_list->currentIndex()).toString();
-    QStringList keyframeList = keyframeData.split(';', QString::SkipEmptyParts);
+    
+    int offset = item->cropStart().frames(m_document->fps());
+    Mlt::Geometry geometry(keyframeData.toUtf8().data(), item->baseClip()->maxDuration().frames(m_document->fps()), m_document->mltProfile().width, m_document->mltProfile().height);
+    Mlt::Geometry newGeometry(QString().toUtf8().data(), item->baseClip()->maxDuration().frames(m_document->fps()), m_document->mltProfile().width, m_document->mltProfile().height);
+    Mlt::GeometryItem gitem;
+    geometry.fetch(&gitem, offset);
+    gitem.frame(0);
+    newGeometry.insert(gitem);
+    int pos = offset + 1;
+    while (!geometry.next_key(&gitem, pos)) {
+       pos = gitem.frame();
+       gitem.frame(pos - offset);
+       pos++;
+       newGeometry.insert(gitem);
+    }
+    QStringList keyframeList = QString(newGeometry.serialise()).split(';', QString::SkipEmptyParts);
+    
     QString result;
     if (ui.import_position->isChecked()) {
        if (ui.import_size->isChecked()) {