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

Don't query producer length on each frame

parent 3d9a1a57
Pipeline #158460 passed with stage
in 9 minutes and 55 seconds
......@@ -69,6 +69,7 @@ GLWidget::GLWidget(int id, QObject *parent)
, m_initSem(0)
, m_analyseSem(1)
, m_isInitialized(false)
, m_maxProducerPosition(0)
, m_threadStartEvent(nullptr)
, m_threadStopEvent(nullptr)
, m_threadCreateEvent(nullptr)
......@@ -702,15 +703,14 @@ bool GLWidget::checkFrameNumber(int pos, int offset, bool isPlaying)
}
return true;
} else if (isPlaying) {
int maxPos = m_producer->get_length() - 1 - offset;
if (pos > maxPos - 2 && !(speed < 0.)) {
if (pos > m_maxProducerPosition - 2 && !(speed < 0.)) {
// Playing past last clip, pause
m_producer->set_speed(0);
m_proxy->setSpeed(0);
m_consumer->set("refresh", 0);
m_consumer->purge();
m_proxy->setPosition(qMax(0, maxPos));
m_producer->seek(qMax(0, maxPos));
m_proxy->setPosition(qMax(0, m_maxProducerPosition));
m_producer->seek(qMax(0, m_maxProducerPosition));
return false;
} else if (pos <= 0 && speed < 0.) {
// rewinding reached 0, pause
......@@ -1722,6 +1722,7 @@ int GLWidget::getCurrentPos() const
void GLWidget::setRulerInfo(int duration, const std::shared_ptr<MarkerListModel> &model)
{
m_maxProducerPosition = duration;
rootObject()->setProperty("duration", duration);
if (model != nullptr) {
// we are resetting marker/snap model, reset zone
......
......@@ -205,6 +205,7 @@ private:
QSemaphore m_initSem;
QSemaphore m_analyseSem;
bool m_isInitialized;
int m_maxProducerPosition;
Mlt::Event *m_threadStartEvent;
Mlt::Event *m_threadStopEvent;
Mlt::Event *m_threadCreateEvent;
......
Supports Markdown
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