Skip to content
This repository
Browse code

paplayer: implement Seek() to support small/bigskipforward/backward

  • Loading branch information...
commit 050826b412c14afe20a88ca5e9905ee4c451677e 1 parent f61f8ba
Sascha Montellese 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 050826b

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