Fix editing keyframe causing unwanted seek

parent 2fd9bcf5
......@@ -720,12 +720,8 @@ void GLWidget::refresh()
bool GLWidget::checkFrameNumber(int pos, int offset)
{
emit consumerPosition(pos);
// TODO: cleanup and move logic to proper proxy class
bool seekStoped = false;
m_proxy->setPosition(pos, &seekStoped);
emit seekPosition(m_proxy->seekOrCurrentPosition());
if (seekStoped) {
return true;
if (!m_proxy->setPosition(pos)) {
emit seekPosition(m_proxy->seekOrCurrentPosition());
}
const double speed = m_producer->get_speed();
if (m_proxy->seeking()) {
......@@ -993,9 +989,7 @@ int GLWidget::setProducer(Mlt::Producer *producer, bool isActive, int position)
if (isActive) {
startConsumer();
}
// emit durationChanged(m_producer->get_length() - 1, m_producer->get_in());
bool ok;
m_proxy->setPosition(m_producer->position(), &ok);
m_proxy->setPosition(m_producer->position());
return error;
}
......
......@@ -54,7 +54,7 @@ bool MonitorProxy::seeking() const
return m_seekPosition != SEEK_INACTIVE;
}
int MonitorProxy::position() const
int MonitorProxy::position() const
{
return m_position;
}
......@@ -96,17 +96,19 @@ int MonitorProxy::seekOrCurrentPosition() const
return m_seekPosition == SEEK_INACTIVE ? m_position : m_seekPosition;
}
void MonitorProxy::setPosition(int pos, bool *seekStopped)
bool MonitorProxy::setPosition(int pos)
{
m_position = pos;
if (m_seekPosition == m_position) {
if (m_seekPosition == pos) {
m_position = pos;
m_seekPosition = SEEK_INACTIVE;
emit seekPositionChanged();
*seekStopped = true;
} else if (m_position == pos) {
return true;
} else {
*seekStopped = false;
m_position = pos;
}
emit positionChanged();
return false;
}
void MonitorProxy::setMarkerComment(const QString &comment)
......
......@@ -58,7 +58,10 @@ public:
/** brief: Returns seek position or consumer position when not seeking
* */
int seekOrCurrentPosition() const;
void setPosition(int pos, bool *seekStopped);
/** brief: update position and end seeking if we reached the requested seek position.
* returns true if the position was unchanged, false otherwise
* */
bool setPosition(int pos);
void setMarkerComment(const QString &comment);
void setSeekPosition(int pos);
void pauseAndSeek(int pos);
......
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