Commit 93dbb1f0 authored by Julius Künzel's avatar Julius Künzel
Browse files

Start playback from beginning if on timeline ende at action start

BUG: 353051
Related to #973
parent a996c2c9
......@@ -1606,7 +1606,7 @@ void GLWidget::refreshSceneLayout()
rootObject()->setProperty("scaley", double(m_rect.height() * m_zoom) / s.height());
}
void GLWidget::switchPlay(bool play, double speed)
void GLWidget::switchPlay(bool play, int offset, double speed)
{
if (!m_producer || !m_consumer) {
return;
......@@ -1615,9 +1615,10 @@ void GLWidget::switchPlay(bool play, double speed)
resetZoneMode();
}
if (play) {
if (m_id == Kdenlive::ClipMonitor && m_consumer->position() == m_producer->get_out() && speed > 0) {
if ((m_id == Kdenlive::ClipMonitor || m_id == Kdenlive::ProjectMonitor) && m_consumer->position() == m_producer->get_out() - offset && speed > 0) {
m_producer->seek(0);
}
qDebug() << "pos: " << m_consumer->position() << "out-offset: " << m_producer->get_out() - offset;
double current_speed = m_producer->get_speed();
m_producer->set_speed(speed);
m_proxy->setSpeed(speed);
......
......@@ -158,7 +158,7 @@ public slots:
void slotZoom(bool zoomIn);
void initializeGL();
void releaseAnalyse();
void switchPlay(bool play, double speed = 1.0);
void switchPlay(bool play, int offset = 0, double speed = 1.0);
void reloadProfile();
/** @brief Update MLT's consumer scaling
* @returns true is scaling was changed
......
......@@ -1308,7 +1308,7 @@ void Monitor::slotRewind(double speed)
}
}
updatePlayAction(true);
m_glMonitor->switchPlay(true, speed);
m_glMonitor->switchPlay(true, m_offset, speed);
}
void Monitor::slotForward(double speed, bool allowNormalPlay)
......@@ -1322,7 +1322,7 @@ void Monitor::slotForward(double speed, bool allowNormalPlay)
if (allowNormalPlay) {
m_glMonitor->purgeCache();
updatePlayAction(true);
m_glMonitor->switchPlay(true, 1);
m_glMonitor->switchPlay(true, m_offset);
return;
} else {
m_speedIndex = 0;
......@@ -1336,7 +1336,7 @@ void Monitor::slotForward(double speed, bool allowNormalPlay)
speed = MonitorManager::speedArray[m_speedIndex];
}
updatePlayAction(true);
m_glMonitor->switchPlay(true, speed);
m_glMonitor->switchPlay(true, m_offset, speed);
}
void Monitor::slotRewindOneFrame(int diff)
......@@ -1454,7 +1454,7 @@ void Monitor::switchPlay(bool play)
if (!KdenliveSettings::autoscroll()) {
emit pCore->autoScrollChanged();
}
m_glMonitor->switchPlay(play);
m_glMonitor->switchPlay(play, m_offset);
}
void Monitor::updatePlayAction(bool play)
......@@ -1473,7 +1473,7 @@ void Monitor::slotSwitchPlay()
if (!KdenliveSettings::autoscroll()) {
emit pCore->autoScrollChanged();
}
m_glMonitor->switchPlay(m_playAction->isActive());
m_glMonitor->switchPlay(m_playAction->isActive(), m_offset);
bool showDropped = false;
if (m_id == Kdenlive::ClipMonitor) {
showDropped = KdenliveSettings::displayClipMonitorInfo() & 0x20;
......@@ -1551,7 +1551,7 @@ void Monitor::updateClipProducer(const QString &playlist)
// TODO
// Mlt::Producer *prod = new Mlt::Producer(*m_glMonitor->profile(), playlist.toUtf8().constData());
// m_glMonitor->setProducer(prod, isActive(), render->seekFramePosition());
m_glMonitor->switchPlay(true);
m_glMonitor->switchPlay(true, m_offset);
}
void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int in, int out)
......
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