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

Fix loop mode broken on add effect

Fixes #1214
parent 7f5645d1
......@@ -701,9 +701,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;
......@@ -716,8 +715,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);
......@@ -1682,7 +1681,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);
......@@ -1720,7 +1719,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);
......@@ -1735,8 +1734,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;
}
......
......@@ -234,6 +234,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;
......
......@@ -1404,7 +1404,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