]> git.sesse.net Git - kdenlive/commitdiff
Merge branch 'master' of git://anongit.kde.org/kdenlive
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 23 Feb 2013 16:17:28 +0000 (17:17 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 23 Feb 2013 16:17:28 +0000 (17:17 +0100)
src/clipitem.cpp
src/clipitem.h
src/customtrackview.cpp

index 9c7a9a178d8d11bd33d4e2af7cdc75b0289aa3de..83b387bedd6732791239b3c02ac2bd2ec592bb70 100644 (file)
@@ -349,12 +349,16 @@ const QString ClipItem::adjustKeyframes(QString keyframes, int offset)
     return result.join(";");
 }
 
-bool ClipItem::checkKeyFrames()
+bool ClipItem::checkKeyFrames(int width, int height, int previousDuration, int cutPos)
 {
     bool clipEffectsModified = false;
     QLocale locale;
     // go through all effects this clip has
     for (int ix = 0; ix < m_effectList.count(); ++ix) {
+       // Check geometry params
+       resizeGeometries(ix, width, height, previousDuration, cutPos == -1 ? 0 : cutPos, cropDuration().frames(m_fps) - 1);
+
+       // Check keyframe params
         QStringList keyframeParams = keyframes(ix);
         QStringList newKeyFrameParams;
         bool effModified = false;
@@ -499,6 +503,22 @@ void ClipItem::setSelectedEffect(const int ix)
     }
 }
 
+void ClipItem::resizeGeometries(const int index, int width, int height, int previousDuration, int start, int duration)
+{
+    QString geom;
+    QDomElement effect = m_effectList.at(index);
+    QDomNodeList params = effect.elementsByTagName("parameter");
+
+    for (int i = 0; i < params.count(); i++) {
+        QDomElement e = params.item(i).toElement();
+        if (!e.isNull() && e.attribute("type") == "geometry") {
+            geom = e.attribute("value");
+           Mlt::Geometry geometry(geom.toUtf8().data(), previousDuration, width, height);
+           e.setAttribute("value", geometry.serialise(start, start + duration));
+       }
+    }
+}
+
 QStringList ClipItem::keyframes(const int index)
 {
     QStringList result;
index 9303cba88ec1d4e357b7433779220e0cd94b195f..084326892d6fdb255085656209b273e71a9cde09 100644 (file)
@@ -138,10 +138,14 @@ public:
     void initEffect(QDomElement effect, int diff = 0, int offset = 0);
 
     /** @brief Gets all keyframes.
-    * @param index Number of the effect
+    * @param index Index of the effect
     * @return a list of strings of keyframes (one string per param) */
     QStringList keyframes(const int index);
 
+    /** @brief Adjust all geometry keyframes.
+    * @param index Index of the effect */
+    void resizeGeometries(const int index, int width, int height, int previousDuration, int start, int duration);
+
     /** @brief Sets params with keyframes and updates the visible keyframes.
     * @param ix Number of the effect
     * @param keyframes a list of strings of keyframes (one string per param), which should be used */
@@ -159,8 +163,9 @@ public:
     /** @brief Adjust keyframes to the new clip. */
     const QString adjustKeyframes(QString keyframes, int offset);
     /** @brief Makes sure all keyframes are in the clip's cropped duration.
+     * @param cutPos the frame number where the new clip starts
     * @return Whether or not changes were made */
-    bool checkKeyFrames();
+    bool checkKeyFrames(int width, int height, int previousDuration, int cutPos = -1);
     QPixmap startThumb() const;
     QPixmap endThumb() const;
     void setVideoOnly(bool force);
index 81746b57cfc4af3057808de4ffe1949a12e99daf..a0447fae517f6c286b0b237b375844c222fc4c95 100644 (file)
@@ -2470,10 +2470,10 @@ ClipItem *CustomTrackView::cutClip(ItemInfo info, GenTime cutTime, bool cut, Eff
         item->resizeEnd(cutPos);
         scene()->addItem(dup);
            
-        if (item->checkKeyFrames())
+        if (item->checkKeyFrames(m_document->width(), m_document->height(), info.cropDuration.frames(m_document->fps())))
             slotRefreshEffects(item);
 
-        if (dup->checkKeyFrames())
+        if (dup->checkKeyFrames(m_document->width(), m_document->height(), info.cropDuration.frames(m_document->fps()), cutTime.frames(m_document->fps())))
             slotRefreshEffects(dup);
 
         item->baseClip()->addReference();