Fix playing clip monitor seems to pause a few frames before end and seeking allowed past clip end

parent 05b122c6
......@@ -680,10 +680,9 @@ void GLWidget::refresh()
m_consumer->set("refresh", 1);
}
bool GLWidget::checkFrameNumber(int pos, int offset)
bool GLWidget::checkFrameNumber(int pos, int offset, bool isPlaying)
{
const double speed = m_producer->get_speed();
bool isPlaying = !qFuzzyIsNull(speed);
m_proxy->positionFromConsumer(pos, isPlaying);
int maxPos = m_producer->get_int("out");
if (m_isLoopMode || m_isZoneMode) {
......@@ -716,7 +715,7 @@ bool GLWidget::checkFrameNumber(int pos, int offset)
return false;
}
}
return true;
return isPlaying;
}
void GLWidget::mousePressEvent(QMouseEvent *event)
......@@ -1387,7 +1386,6 @@ void GLWidget::on_gl_nosync_frame_show(mlt_consumer, void *self, mlt_frame frame
void GLWidget::on_gl_frame_show(mlt_consumer, void *self, mlt_frame frame_ptr)
{
Mlt::Frame frame(frame_ptr);
qDebug()<<"== SHOWING GL FRAME: "<<frame.get_position();
if (frame.get_int("rendered") != 0) {
auto *widget = static_cast<GLWidget *>(self);
int timeout = (widget->consumer()->get_int("real_time") > 0) ? 0 : 1000;
......
......@@ -115,7 +115,7 @@ public:
int realTime() const;
int droppedFrames() const;
void resetDrops();
bool checkFrameNumber(int pos, int offset);
bool checkFrameNumber(int pos, int offset, bool isPlaying);
/** @brief Return current timeline position */
int getCurrentPos() const;
/** @brief Requests a monitor refresh */
......
......@@ -143,6 +143,7 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
, m_editMarker(nullptr)
, m_forceSizeFactor(0)
, m_lastMonitorSceneType(MonitorSceneDefault)
, m_offset(id == Kdenlive::ClipMonitor ? 0 : TimelineModel::seekDuration)
{
auto *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
......@@ -1179,7 +1180,11 @@ void Monitor::slotRewindOneFrame(int diff)
void Monitor::slotForwardOneFrame(int diff)
{
slotActivateMonitor();
if (m_id == Kdenlive::ClipMonitor) {
m_glMonitor->getControllerProxy()->setPosition(qMin(m_glMonitor->duration(), m_glMonitor->getCurrentPos() + diff));
} else {
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->getCurrentPos() + diff);
}
}
void Monitor::adjustRulerSize(int length, const std::shared_ptr<MarkerListModel> &markerModel)
......@@ -1650,7 +1655,7 @@ void Monitor::updateAudioForAnalysis()
void Monitor::onFrameDisplayed(const SharedFrame &frame)
{
if (!m_glMonitor->checkFrameNumber(frame.get_position(), m_id == Kdenlive::ClipMonitor ? 0 : TimelineModel::seekDuration)) {
if (!m_glMonitor->checkFrameNumber(frame.get_position(), m_offset, m_playAction->isActive())) {
m_playAction->setActive(false);
}
m_monitorManager->frameDisplayed(frame);
......
......@@ -217,6 +217,7 @@ private:
QAction *m_editMarker;
KMessageWidget *m_infoMessage;
int m_forceSizeFactor;
int m_offset;
MonitorSceneType m_lastMonitorSceneType;
MonitorAudioLevel *m_audioMeterWidget;
QElapsedTimer m_droppedTimer;
......
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