]> git.sesse.net Git - kdenlive/commitdiff
No more duration limit for color, image and title clips
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 1 Jun 2009 18:48:18 +0000 (18:48 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 1 Jun 2009 18:48:18 +0000 (18:48 +0000)
svn path=/trunk/kdenlive/; revision=3474

src/abstractclipitem.cpp
src/abstractclipitem.h
src/clipdurationdialog.cpp
src/clipitem.cpp
src/clipproperties.cpp
src/docclipbase.cpp
src/renderer.cpp

index 07e6a54a6f617fc176e42c1892efe09d00511848..4521e9d74ed9437995294648467520dd37923c61 100644 (file)
@@ -194,11 +194,6 @@ GenTime AbstractClipItem::maxDuration() const
     return m_maxDuration;
 }
 
-void AbstractClipItem::setMaxDuration(const GenTime &max)
-{
-    m_maxDuration = max;
-}
-
 QPainterPath AbstractClipItem::upperRectPart(QRectF br)
 {
     QPainterPath roundRectPathUpper;
index 09b02b54c17e34941fdb711d03af258b2e192306..b3a9f460b6514e8ba0cc80fdf293733974eaa8e7 100644 (file)
@@ -59,7 +59,6 @@ public:
     virtual double fps() const;
     virtual GenTime maxDuration() const;
     virtual void setCropStart(GenTime pos);
-    virtual void setMaxDuration(const GenTime &max);
 
 protected:
     int m_track;
index cfcef5e6cfdc9e8910b679e2fe442afb8f2e7f5a..b1a06c65240ebee54837ba02f193965b232b048c 100644 (file)
@@ -94,8 +94,10 @@ void ClipDurationDialog::slotCheckDuration()
     int dur = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
     GenTime start(pos, m_fps);
     GenTime duration(dur, m_fps);
-    GenTime maxDuration = m_max == GenTime() ? start + m_clip->maxDuration() : qMin(m_max, start + m_clip->maxDuration());
-    if (start + duration > maxDuration) {
+    GenTime maxDuration;
+    if (m_clip->maxDuration() == GenTime()) maxDuration = m_max;
+    else maxDuration = m_max == GenTime() ? start + m_clip->maxDuration() : qMin(m_max, start + m_clip->maxDuration());
+    if (maxDuration != GenTime() && start + duration > maxDuration) {
         m_view.clip_duration->setText(m_tc.getTimecode(maxDuration - start, m_fps));
     }
 }
@@ -107,7 +109,7 @@ void ClipDurationDialog::slotCheckCrop()
     GenTime duration(dur, m_fps);
     GenTime cropStart(crop, m_fps);
     GenTime maxDuration = m_clip->maxDuration();
-    if (cropStart + duration > maxDuration) {
+    if (maxDuration != GenTime() && cropStart + duration > maxDuration) {
         m_view.crop_position->setText(m_tc.getTimecode(maxDuration - duration, m_fps));
     }
 }
@@ -132,7 +134,7 @@ void ClipDurationDialog::slotDurUp()
 {
     int duration = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
     int crop = m_tc.getFrameCount(m_view.crop_position->text(), m_fps);
-    if (duration + crop > m_clip->maxDuration().frames(m_fps)) return;
+    if (m_clip->maxDuration() != GenTime() && duration + crop > m_clip->maxDuration().frames(m_fps)) return;
     duration ++;
     m_view.clip_duration->setText(m_tc.getTimecode(GenTime(duration, m_fps), m_fps));
 }
@@ -149,7 +151,7 @@ void ClipDurationDialog::slotCropUp()
 {
     int crop = m_tc.getFrameCount(m_view.crop_position->text(), m_fps);
     int duration = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
-    if (duration + crop > m_clip->maxDuration().frames(m_fps)) return;
+    if (m_clip->maxDuration() != GenTime() && duration + crop > m_clip->maxDuration().frames(m_fps)) return;
     crop ++;
     m_view.crop_position->setText(m_tc.getTimecode(GenTime(crop, m_fps), m_fps));
 }
index 4f93bef4df350ab6d516d3c57aee295632676641..5a8ab59b968e94829fdef7b344eea75ea2b6f800 100644 (file)
@@ -76,15 +76,6 @@ ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, b
     setAcceptDrops(true);
     m_audioThumbReady = clip->audioThumbCreated();
 
-    /*
-      m_cropStart = xml.attribute("in", 0).toInt();
-      m_maxDuration = xml.attribute("duration", 0).toInt();
-      if (m_maxDuration == 0) m_maxDuration = xml.attribute("out", 0).toInt() - m_cropStart;
-
-      if (duration != -1) m_cropDuration = duration;
-      else m_cropDuration = m_maxDuration;*/
-
-
     setFlags(QGraphicsItem::ItemClipsToShape | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
     setAcceptsHoverEvents(true);
     connect(this , SIGNAL(prepareAudioThumb(double, int, int, int)) , this, SLOT(slotPrepareAudioThumb(double, int, int, int)));
@@ -407,7 +398,7 @@ void ClipItem::refreshClip(bool checkDuration)
     if (checkDuration && (m_maxDuration != m_clip->maxDuration())) {
         m_maxDuration = m_clip->maxDuration();
         if (m_clipType != IMAGE && m_clipType != TEXT && m_clipType != COLOR) {
-            if (m_cropStart + m_cropDuration > m_maxDuration) {
+            if (m_maxDuration != GenTime() && m_cropStart + m_cropDuration > m_maxDuration) {
                 // Clip duration changed, make sure to stay in correct range
                 if (m_cropStart > m_maxDuration) {
                     m_cropStart = GenTime();
@@ -1106,7 +1097,7 @@ void ClipItem::resizeStart(int posx, double /*speed*/)
 void ClipItem::resizeEnd(int posx, double /*speed*/, bool updateKeyFrames)
 {
     const int max = (startPos() - cropStart() + maxDuration()).frames(m_fps);
-    if (posx > max) posx = max;
+    if (posx > max && maxDuration() != GenTime()) posx = max;
     if (posx == endPos().frames(m_fps)) return;
     //kDebug() << "// NEW POS: " << posx << ", OLD END: " << endPos().frames(m_fps);
     const int previous = (cropStart() + duration()).frames(m_fps);
index adb51fa4e5cb6df880ca75ffb1b24053a80140ea..8f1224fe5402be8889936c97408f29f7841a451f 100644 (file)
@@ -505,6 +505,7 @@ void ClipProperties::parseFolder()
 
 void ClipProperties::slotCheckMaxLength()
 {
+    if (m_clip->maxDuration() == GenTime()) return;
     int duration = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
     if (duration > m_clip->maxDuration().frames(m_fps)) {
         m_view.clip_duration->setText(m_tc.getTimecode(m_clip->maxDuration(), m_fps));
index b64517df6496cdd18477906d33089344e4c3c6eb..d9c329a0298c031151a5b085b12edbb563f0e66b 100644 (file)
@@ -230,8 +230,9 @@ const GenTime &DocClipBase::duration() const
 const GenTime DocClipBase::maxDuration() const
 {
     if (m_clipType == COLOR || m_clipType == IMAGE || m_clipType == TEXT || (m_clipType == SLIDESHOW &&  m_properties.value("loop") == "1")) {
-        const GenTime dur(15000, KdenliveSettings::project_fps());
-        return dur;
+        /*const GenTime dur(15000, KdenliveSettings::project_fps());
+        return dur;*/
+        return GenTime();
     }
     return m_duration;
 }
index 4bfa260960da32b59cf2aab062bb8beed3cc6af2..65207372a1da23084d970c2664a424e6a28f7704 100644 (file)
@@ -2180,17 +2180,20 @@ bool Render::mltResizeClipEnd(ItemInfo info, GenTime clipDuration)
         return false;
     }
     int clipIndex = trackPlaylist.get_clip_index_at((int) info.startPos.frames(m_fps));
-    kDebug() << "// SELECTED CLIP START: " << trackPlaylist.clip_start(clipIndex);
+    //kDebug() << "// SELECTED CLIP START: " << trackPlaylist.clip_start(clipIndex);
     Mlt::Producer *clip = trackPlaylist.get_clip(clipIndex);
     int previousStart = clip->get_in();
-    int previousDuration = trackPlaylist.clip_length(clipIndex) - 1;
     int newDuration = (int) clipDuration.frames(m_fps) - 1;
+    int diff = newDuration - trackPlaylist.clip_length(clipIndex) - 1;
+    if (newDuration > clip->get_length()) {
+        clip->parent().set("length", newDuration + 1);
+        clip->set("length", newDuration + 1);
+    }
     trackPlaylist.resize_clip(clipIndex, previousStart, newDuration + previousStart);
     trackPlaylist.consolidate_blanks(0);
     // skip to next clip
     clipIndex++;
-    int diff = newDuration - previousDuration;
-    kDebug() << "////////  RESIZE CLIP: " << clipIndex << "( pos: " << info.startPos.frames(25) << "), DIFF: " << diff << ", CURRENT DUR: " << previousDuration << ", NEW DUR: " << newDuration << ", IX: " << clipIndex << ", MAX: " << trackPlaylist.count();
+    //kDebug() << "////////  RESIZE CLIP: " << clipIndex << "( pos: " << info.startPos.frames(25) << "), DIFF: " << diff << ", CURRENT DUR: " << previousDuration << ", NEW DUR: " << newDuration << ", IX: " << clipIndex << ", MAX: " << trackPlaylist.count();
     if (diff > 0) {
         // clip was made longer, trim next blank if there is one.
         if (clipIndex < trackPlaylist.count()) {