diff --git a/src/docks/timelinedock.cpp b/src/docks/timelinedock.cpp index 784f83a1d8..ee4d15de52 100644 --- a/src/docks/timelinedock.cpp +++ b/src/docks/timelinedock.cpp @@ -2030,17 +2030,8 @@ void TimelineDock::onProducerChanged(Mlt::Producer *after) } after->set_in_and_out(in, out); // Adjust filters. - int n = after->filter_count(); - for (int j = 0; j < n; j++) { - QScopedPointer filter(after->filter(j)); - if (filter && filter->is_valid() && !filter->get_int("_loader") - && !filter->get_int(kShotcutHiddenProperty)) { - in = qMin(qRound(filter->get_in() * speedRatio), length - 1); - out = qMin(qRound(filter->get_out() * speedRatio), length - 1); - filter->set_in_and_out(in, out); - //TODO: keyframes - } - } + MLT.adjustClipFilters(*after, info->frame_in, info->frame_out, in - info->frame_in, + info->frame_out - out, 0); resetRippleAll = false; } else if (newServiceName == "qimage" || newServiceName == "pixbuf") { int oldLength = info->frame_out - info->frame_in; @@ -2059,17 +2050,7 @@ void TimelineDock::onProducerChanged(Mlt::Producer *after) } after->set_in_and_out(in, out); // Adjust filters. - int n = after->filter_count(); - for (int j = 0; j < n; j++) { - QScopedPointer filter(after->filter(j)); - if (filter && filter->is_valid() && !filter->get_int("_loader") - && !filter->get_int(kShotcutHiddenProperty)) { - in = qMin(filter->get_in(), newLength - 1); - out = qMin(filter->get_out() + lengthDelta, newLength - 1); - filter->set_in_and_out(in, out); - //TODO: keyframes - } - } + MLT.adjustClipFilters(*after, info->frame_in, info->frame_out, 0, -lengthDelta, 0); } } else { after->set_in_and_out(info->frame_in, info->frame_out); diff --git a/src/mltcontroller.cpp b/src/mltcontroller.cpp index 26d4d9a597..3d3b070f61 100644 --- a/src/mltcontroller.cpp +++ b/src/mltcontroller.cpp @@ -1452,8 +1452,9 @@ void Controller::adjustFilter(Mlt::Filter *filter, int in, int out, int inDelta, emit MAIN.serviceOutChanged(outDelta, filter); // Update simple keyframes - if (filter->get_int(kShotcutAnimOutProperty) && meta && meta->keyframes()) { - foreach (QString name, meta->keyframes()->simpleProperties()) { + if ((filter->get_int(kShotcutAnimInProperty) || filter->get_int(kShotcutAnimOutProperty)) && meta + && meta->keyframes()) { + for (const QString &name : meta->keyframes()->simpleProperties()) { if (!filter->get_animation(name.toUtf8().constData())) { // Cause a string property to be interpreted as animated value. if (meta->keyframes()->parameter(name)->isColor()) @@ -1466,8 +1467,12 @@ void Controller::adjustFilter(Mlt::Filter *filter, int in, int out, int inDelta, int n = animation.key_count(); if (n > 1) { animation.set_length(filter->get_length()); - animation.key_set_frame(n - 2, filter->get_length() - filter->get_int(kShotcutAnimOutProperty)); - animation.key_set_frame(n - 1, filter->get_length() - 1); + if (filter->get_int(kShotcutAnimInProperty) > filter->get_length() - 1) { + animation.key_set_frame(n - 1, filter->get_length() - 1); + } else if (filter->get_int(kShotcutAnimOutProperty)) { + animation.key_set_frame(n - 2, filter->get_length() - filter->get_int(kShotcutAnimOutProperty)); + animation.key_set_frame(n - 1, filter->get_length() - 1); + } } } } diff --git a/src/player.cpp b/src/player.cpp index 92e4901112..43f95b1080 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -944,7 +944,7 @@ void Player::onProducerOpened(bool play) if (play || (MLT.isClip() && !MLT.isClosedClip())) { if (m_pauseAfterOpen) { m_pauseAfterOpen = false; - QTimer::singleShot(500, this, [=](){ + QTimer::singleShot(500, this, [ = ]() { if (MLT.producer()) pause(MLT.producer()->position()); });