Commit e1c677c2 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix reverting clip speed modifies in/out

parent ae333a7a
Pipeline #6294 passed with stage
in 21 minutes and 45 seconds
......@@ -392,6 +392,15 @@ void ClipModel::refreshProducerFromBin(PlaylistState::ClipState state, double sp
QWriteLocker locker(&m_lock);
int in = getIn();
int out = getOut();
bool revertSpeed = false;
if (speed < 0) {
if (m_speed > 0) {
revertSpeed = true;
}
} else if (m_speed < 0) {
revertSpeed = true;
}
if (!qFuzzyCompare(speed, m_speed) && !qFuzzyCompare(speed, 0.)) {
in = in * std::abs(m_speed / speed);
out = in + getPlaytime() - 1;
......@@ -400,6 +409,11 @@ void ClipModel::refreshProducerFromBin(PlaylistState::ClipState state, double sp
m_speed = speed;
qDebug() << "changing speed" << in << out << m_speed;
}
if (revertSpeed) {
int duration = out - in;
in = m_producer->get_length() * std::fabs(m_speed) - out;
out = in + duration;
}
std::shared_ptr<ProjectClip> binClip = pCore->projectItemModel()->getClipByBinID(m_binClipId);
std::shared_ptr<Mlt::Producer> binProducer = binClip->getTimelineProducer(m_currentTrackId, m_id, state, m_speed);
m_producer = std::move(binProducer);
......
......@@ -1545,7 +1545,6 @@ void TimelineController::changeItemSpeed(int clipId, double speed)
minSpeed = std::max(minSpeed, minSpeed2);
maxSpeed = std::min(maxSpeed, maxSpeed2);
}
// speed = QInputDialog::getDouble(QApplication::activeWindow(), i18n("Clip Speed"), i18n("Percentage"), speed, minSpeed, maxSpeed, 2, &ok);
QScopedPointer<SpeedDialog> d(new SpeedDialog(QApplication::activeWindow(), std::abs(speed), minSpeed, maxSpeed, speed < 0));
if (d->exec() != QDialog::Accepted) {
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment