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

Fix loop mode broken on add effect

Fixes #1214
parent 2981c558
Pipeline #88120 passed with stage
in 8 minutes and 37 seconds
......@@ -693,9 +693,8 @@ bool GLWidget::checkFrameNumber(int pos, int offset, bool isPlaying)
{
const double speed = m_producer->get_speed();
m_proxy->positionFromConsumer(pos, isPlaying);
int maxPos = m_producer->get_int("out");
if (m_isLoopMode || m_isZoneMode) {
if (isPlaying && pos >= maxPos) {
if (isPlaying && pos >= m_loopOut) {
m_consumer->purge();
if (!m_isLoopMode) {
return false;
......@@ -708,8 +707,8 @@ bool GLWidget::checkFrameNumber(int pos, int offset, bool isPlaying)
}
return true;
} else if (isPlaying) {
maxPos -= offset;
if (pos >= (maxPos - 1) && !(speed < 0.)) {
int maxPos = m_producer->get_length() - 1 - offset;
if (pos > maxPos - 2 && !(speed < 0.)) {
// Playing past last clip, pause
m_producer->set_speed(0);
m_proxy->setSpeed(0);
......@@ -1677,7 +1676,7 @@ bool GLWidget::playZone(bool loop)
m_producer->set_speed(0);
m_proxy->setSpeed(0);
m_consumer->purge();
m_producer->set("out", m_proxy->zoneOut());
m_loopOut = m_proxy->zoneOut();
m_producer->set_speed(1.0);
restartConsumer();
m_consumer->set("scrub_audio", 0);
......@@ -1715,7 +1714,7 @@ bool GLWidget::loopClip(QPoint inOut)
m_producer->set_speed(0);
m_proxy->setSpeed(0);
m_consumer->purge();
m_producer->set("out", inOut.y());
m_loopOut = inOut.y();
m_producer->set_speed(1.0);
restartConsumer();
m_consumer->set("scrub_audio", 0);
......@@ -1730,8 +1729,8 @@ void GLWidget::resetZoneMode()
if (!m_isZoneMode && !m_isLoopMode) {
return;
}
m_producer->set("out", m_producer->get_length());
m_loopIn = 0;
m_loopOut = 0;
m_isZoneMode = false;
m_isLoopMode = false;
}
......
......@@ -230,6 +230,7 @@ private:
bool m_isZoneMode;
bool m_isLoopMode;
int m_loopIn;
int m_loopOut;
QPoint m_offset;
MonitorProxy *m_proxy;
std::shared_ptr<Mlt::Producer> m_blackClip;
......
......@@ -1484,7 +1484,7 @@ void Monitor::forceMonitorRefresh()
void Monitor::refreshMonitor(bool directUpdate)
{
if (!m_glMonitor->isReady()) {
if (!m_glMonitor->isReady() || isPlaying()) {
return;
}
if (isActive()) {
......
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