Skip to content
This repository
Browse code

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 authored December 11, 2012

Showing 1 changed file with 23 additions and 0 deletions. Show diff stats Hide diff stats

  1. 23  xbmc/cores/paplayer/PAPlayer.cpp
23  xbmc/cores/paplayer/PAPlayer.cpp
@@ -839,6 +839,29 @@ bool PAPlayer::CanSeek()
839 839
 
840 840
 void PAPlayer::Seek(bool bPlus, bool bLargeStep)
841 841
 {
  842
+  if (!CanSeek()) return;
  843
+
  844
+  __int64 seek;
  845
+  if (g_advancedSettings.m_musicUseTimeSeeking && GetTotalTime() > 2 * g_advancedSettings.m_musicTimeSeekForwardBig)
  846
+  {
  847
+    if (bLargeStep)
  848
+      seek = bPlus ? g_advancedSettings.m_musicTimeSeekForwardBig : g_advancedSettings.m_musicTimeSeekBackwardBig;
  849
+    else
  850
+      seek = bPlus ? g_advancedSettings.m_musicTimeSeekForward : g_advancedSettings.m_musicTimeSeekBackward;
  851
+    seek *= 1000;
  852
+    seek += GetTime();
  853
+  }
  854
+  else
  855
+  {
  856
+    float percent;
  857
+    if (bLargeStep)
  858
+      percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForwardBig : (float)g_advancedSettings.m_musicPercentSeekBackwardBig;
  859
+    else
  860
+      percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForward : (float)g_advancedSettings.m_musicPercentSeekBackward;
  861
+    seek = (__int64)(GetTotalTime64() * (GetPercentage() + percent) / 100);
  862
+  }
  863
+
  864
+  SeekTime(seek);
842 865
 }
843 866
 
844 867
 void PAPlayer::SeekTime(int64_t iTime /*=0*/)

0 notes on commit dbb0daa

Please sign in to comment.
Something went wrong with that request. Please try again.