Skip to content

Commit

Permalink
Merge pull request #792 from ElderOrb/left_right_fix
Browse files Browse the repository at this point in the history
fix crazy jumps on left/right after pausing after playback
  • Loading branch information
dericed authored Sep 7, 2023
2 parents 05bccb3 + 976e3f0 commit cf8fc90
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 6 additions & 0 deletions Source/Core/FileInformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2237,21 +2237,27 @@ void FileInformation::Frames_Pos_Set (int Pos, size_t Stats_Pos)
//---------------------------------------------------------------------------
void FileInformation::Frames_Pos_Minus ()
{
qDebug() << "Frames_Pos_Minus..";

if (Frames_Pos==0)
return;

Frames_Pos--;
qDebug() << "Frames_Pos_Minus: " << Frames_Pos;

Q_EMIT positionChanged();
}

//---------------------------------------------------------------------------
bool FileInformation::Frames_Pos_Plus ()
{
qDebug() << "Frames_Pos_Plus..";

if (Frames_Pos+1>=ReferenceStat()->x_Current_Max)
return false;;

Frames_Pos++;
qDebug() << "Frames_Pos_Plus: " << Frames_Pos;

Q_EMIT positionChanged();
return true;
Expand Down
6 changes: 1 addition & 5 deletions Source/GUI/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,13 +1017,9 @@ void Player::handleFileInformationPositionChanges()
{
m_ignorePositionChanges = true;

auto prevMs = frameToMs(m_fileInformation->Frames_Pos_Get() - 12);
if(prevMs < 0)
prevMs = 0;

// ScopedMute mute(m_player);

m_player->seek(qint64(prevMs));
m_player->seek(qint64(ms));
m_ignorePositionChanges = false;
ui->playerSlider->setValue(ms);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/GUI/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class MediaPlayer : public QAVPlayer {
connect(this, &QAVPlayer::stateChanged, this, [this](QAVPlayer::State state) {
if(state == QAVPlayer::PlayingState) {
t.start();
} else if(state == QAVPlayer::StoppedState) {
} else if(state == QAVPlayer::StoppedState || state == QAVPlayer::PausedState) {
t.stop();
}
}, Qt::QueuedConnection);
Expand Down

0 comments on commit cf8fc90

Please sign in to comment.