]> git.sesse.net Git - kdenlive/commitdiff
Report error when MLT fails to insert a clip in playlist
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 16 Feb 2012 20:19:35 +0000 (21:19 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 16 Feb 2012 20:19:35 +0000 (21:19 +0100)
(for example when trying to insert a clip at a negative time)

src/customtrackview.cpp
src/renderer.cpp

index 1a0a8ebb1acdc8c70459fae14ea6e5877b12ad7b..9baf23b8f465892e8bb8b44504ec82d4a7b4d20d 100644 (file)
@@ -6034,9 +6034,9 @@ void CustomTrackView::alignAudio()
 
                 GenTime add(shift, m_document->fps());
                 ItemInfo start = clip->info();
-                ItemInfo end = clip->info();
+                ItemInfo end = start;
                 end.startPos = m_audioAlignmentReference->info().startPos + add;
-                end.endPos = m_audioAlignmentReference->info().startPos + add + clip->info().cropDuration;
+                end.endPos = end.startPos + start.cropDuration;
 
                 QUndoCommand *moveCommand = new QUndoCommand();
                 moveCommand->setText(i18n("Auto-align clip"));
index 9bb3c8a88d8f29f39ea5c1816ac4e9d6b01f9c38..5592f82f5c2842c1228ce1974d126a2a48bff74b 100644 (file)
@@ -3331,6 +3331,13 @@ bool Render::mltMoveClip(int startTrack, int endTrack, int moveStart, int moveEn
                 trackPlaylist.insert_blank(clipIndex, clipProducer->get_playtime() - 1);
             }
             int newIndex = trackPlaylist.insert_at(moveEnd, clipProducer, 1);
+            if (newIndex == -1) {
+                kDebug()<<"// CANNOT MOVE CLIP TO: "<<moveEnd;
+                trackPlaylist.insert_at(moveStart, clipProducer, 1);
+                delete clipProducer;
+                service.unlock();
+                return false;
+            }
             trackPlaylist.consolidate_blanks(1);
             delete clipProducer;
             /*if (QString(clipProducer.parent().get("transparency")).toInt() == 1) {