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

Fix various 1 frame offset issues in monitor and zone handling

parent b71df50c
......@@ -659,6 +659,7 @@ void ClipController::checkAudioVideo()
// test_audio returns 1 if there is NO audio (strange but true at the time this code is written)
m_hasAudio = frame->get_int("test_audio") == 0;
m_hasVideo = frame->get_int("test_image") == 0;
m_masterProducer->seek(0);
} else {
qDebug()<<"* * * *ERROR INVALID FRAME On test";
}
......
......@@ -664,12 +664,9 @@ void Monitor::slotSetZoneEnd(bool discardLastFrame)
{
Q_UNUSED(discardLastFrame);
int pos = m_glMonitor->getCurrentPos();
if (m_controller) {
if (pos < (int)m_controller->frameDuration() - 1) {
pos++;
}
} else
if (m_controller == nullptr) {
pos++;
}
m_glMonitor->getControllerProxy()->setZoneOut(pos);
if (m_controller) {
m_controller->setZone(m_glMonitor->getControllerProxy()->zone());
......@@ -843,7 +840,7 @@ void Monitor::slotStartDrag()
QStringList list;
list.append(m_controller->AbstractProjectItem::clipId());
list.append(QString::number(p.x()));
list.append(QString::number(p.y() - 1));
list.append(QString::number(p.y()));
prodData.append(list.join(QLatin1Char('/')).toUtf8());
}
switch (dragType) {
......@@ -1183,7 +1180,7 @@ void Monitor::slotForwardOneFrame(int diff)
{
slotActivateMonitor();
if (m_id == Kdenlive::ClipMonitor) {
m_glMonitor->getControllerProxy()->setPosition(qMin(m_glMonitor->duration(), m_glMonitor->getCurrentPos() + diff));
m_glMonitor->getControllerProxy()->setPosition(qMin(m_glMonitor->duration() - 1, m_glMonitor->getCurrentPos() + diff));
} else {
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->getCurrentPos() + diff);
}
......@@ -1359,19 +1356,18 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
// we are in record mode, don't display clip
return;
}
m_glMonitor->setRulerInfo((int)m_controller->frameDuration(), controller->getMarkerModel());
m_glMonitor->setRulerInfo((int)m_controller->frameDuration() - 1, controller->getMarkerModel());
loadQmlScene(MonitorSceneDefault);
m_timePos->setRange(0, (int)m_controller->frameDuration());
m_timePos->setRange(0, (int)m_controller->frameDuration() - 1);
updateMarkers();
connect(m_glMonitor->getControllerProxy(), &MonitorProxy::addSnap, this, &Monitor::addSnapPoint, Qt::DirectConnection);
connect(m_glMonitor->getControllerProxy(), &MonitorProxy::removeSnap, this, &Monitor::removeSnapPoint, Qt::DirectConnection);
if (out == -1) {
m_glMonitor->getControllerProxy()->setZone(m_controller->zone(), false);
qDebug() << m_controller->zone();
} else {
m_glMonitor->getControllerProxy()->setZone(in, out, false);
}
m_snaps->addPoint((int)m_controller->frameDuration());
m_snaps->addPoint((int)m_controller->frameDuration() - 1);
// Loading new clip / zone, stop if playing
if (m_playAction->isActive()) {
m_playAction->setActive(false);
......@@ -2087,7 +2083,7 @@ void Monitor::slotEnd()
slotActivateMonitor();
m_glMonitor->switchPlay(false);
if (m_id == Kdenlive::ClipMonitor) {
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->duration());
m_glMonitor->getControllerProxy()->setPosition(m_glMonitor->duration() - 1);
} else {
m_glMonitor->getControllerProxy()->setPosition(pCore->projectDuration() - 1);
}
......
......@@ -140,11 +140,11 @@ void MonitorProxy::setZoneIn(int pos)
void MonitorProxy::setZoneOut(int pos)
{
if (m_zoneOut > 0) {
emit removeSnap(m_zoneOut - 1);
emit removeSnap(m_zoneOut);
}
m_zoneOut = pos;
if (pos > 0) {
emit addSnap(pos - 1);
emit addSnap(pos);
}
emit zoneChanged();
emit saveZone();
......@@ -156,7 +156,7 @@ void MonitorProxy::setZone(int in, int out, bool sendUpdate)
emit removeSnap(m_zoneIn);
}
if (m_zoneOut > 0) {
emit removeSnap(m_zoneOut - 1);
emit removeSnap(m_zoneOut);
}
m_zoneIn = in;
m_zoneOut = out;
......@@ -164,7 +164,7 @@ void MonitorProxy::setZone(int in, int out, bool sendUpdate)
emit addSnap(m_zoneIn);
}
if (m_zoneOut > 0) {
emit addSnap(m_zoneOut - 1);
emit addSnap(m_zoneOut);
}
emit zoneChanged();
if (sendUpdate) {
......
......@@ -269,7 +269,7 @@ Item {
left: inPoint.visible ? inPoint.right : parent.left
bottom: parent.bottom
}
visible: root.showMarkers && controller.position + 1 == controller.zoneOut
visible: root.showMarkers && controller.position == controller.zoneOut
text: i18n("Out Point")
color: "white"
background: Rectangle {
......
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