Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1921 from Montellese/paplayer_seek

paplayer: implement Seek() to support (small/big)skip(forward/backward)
  • Loading branch information...
commit dbb0daa94ceb1dc60dd7c9bbb202d23c6157274c 2 parents 3a6f680 + 050826b
@jmarshallnz jmarshallnz authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 xbmc/cores/paplayer/PAPlayer.cpp
View
23 xbmc/cores/paplayer/PAPlayer.cpp
@@ -839,6 +839,29 @@ bool PAPlayer::CanSeek()
void PAPlayer::Seek(bool bPlus, bool bLargeStep)
{
+ if (!CanSeek()) return;
+
+ __int64 seek;
+ if (g_advancedSettings.m_musicUseTimeSeeking && GetTotalTime() > 2 * g_advancedSettings.m_musicTimeSeekForwardBig)
+ {
+ if (bLargeStep)
+ seek = bPlus ? g_advancedSettings.m_musicTimeSeekForwardBig : g_advancedSettings.m_musicTimeSeekBackwardBig;
+ else
+ seek = bPlus ? g_advancedSettings.m_musicTimeSeekForward : g_advancedSettings.m_musicTimeSeekBackward;
+ seek *= 1000;
+ seek += GetTime();
+ }
+ else
+ {
+ float percent;
+ if (bLargeStep)
+ percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForwardBig : (float)g_advancedSettings.m_musicPercentSeekBackwardBig;
+ else
+ percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForward : (float)g_advancedSettings.m_musicPercentSeekBackward;
+ seek = (__int64)(GetTotalTime64() * (GetPercentage() + percent) / 100);
+ }
+
+ SeekTime(seek);
}
void PAPlayer::SeekTime(int64_t iTime /*=0*/)
Please sign in to comment.
Something went wrong with that request. Please try again.