void CDummyVideoPlayer::Seek(bool bPlus, bool bLargeStep, bool bChapterOverride) { if (g_advancedSettings.m_videoUseTimeSeeking && GetTotalTime() > 2000*g_advancedSettings.m_videoTimeSeekForwardBig) { int seek = 0; if (bLargeStep) seek = bPlus ? g_advancedSettings.m_videoTimeSeekForwardBig : g_advancedSettings.m_videoTimeSeekBackwardBig; else seek = bPlus ? g_advancedSettings.m_videoTimeSeekForward : g_advancedSettings.m_videoTimeSeekBackward; // do the seek SeekTime(GetTime() + seek * 1000); } else { float percent = GetPercentage(); if (bLargeStep) percent += bPlus ? g_advancedSettings.m_videoPercentSeekForwardBig : g_advancedSettings.m_videoPercentSeekBackwardBig; else percent += bPlus ? g_advancedSettings.m_videoPercentSeekForward : g_advancedSettings.m_videoPercentSeekBackward; if (percent >= 0 && percent <= 100) { // should be modified to seektime SeekPercentage(percent); } } }
bool PAPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options) { m_defaultCrossfadeMS = CSettings::GetInstance().GetInt(CSettings::SETTING_MUSICPLAYER_CROSSFADE) * 1000; if (m_streams.size() > 1 || !m_defaultCrossfadeMS || m_isPaused) { CloseAllStreams(!m_isPaused); StopThread(); m_isPaused = false; // Make sure to reset the pause state } // if audio engine is suspended i.e. by a DisplayLost event (HDMI), MakeStream // waits until the engine is resumed. if we block the main thread here, it can't // resume the engine after a DisplayReset event if (CAEFactory::IsSuspended()) { if (!QueueNextFile(file)) return false; } else { if (!QueueNextFileEx(file, false)) return false; } CSharedLock lock(m_streamsLock); if (m_streams.size() == 2) { //do a short crossfade on trackskip, set to max 2 seconds for these prev/next transitions m_upcomingCrossfadeMS = std::min(m_defaultCrossfadeMS, (unsigned int)MAX_SKIP_XFADE_TIME); //start transition to next track StreamInfo* si = m_streams.front(); si->m_playNextAtFrame = si->m_framesSent; //start next track at current frame si->m_prepareTriggered = true; //next track is ready to go } lock.Leave(); if (!IsRunning()) Create(); /* trigger playback start */ m_isPlaying = true; m_startEvent.Set(); if (options.startpercent > 0.0) { Sleep(50); SeekPercentage(options.startpercent); } return true; }
bool PAPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options) { m_defaultCrossfadeMS = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MUSICPLAYER_CROSSFADE) * 1000; if (m_streams.size() > 1 || !m_defaultCrossfadeMS || m_isPaused) { CloseAllStreams(!m_isPaused); StopThread(); m_isPaused = false; // Make sure to reset the pause state } { CSingleLock lock(m_streamsLock); m_jobCounter++; } CJobManager::GetInstance().Submit([this, file]() { QueueNextFileEx(file, false); }, this, CJob::PRIORITY_NORMAL); CSingleLock lock(m_streamsLock); if (m_streams.size() == 2) { //do a short crossfade on trackskip, set to max 2 seconds for these prev/next transitions m_upcomingCrossfadeMS = std::min(m_defaultCrossfadeMS, (unsigned int)MAX_SKIP_XFADE_TIME); //start transition to next track StreamInfo* si = m_streams.front(); si->m_playNextAtFrame = si->m_framesSent; //start next track at current frame si->m_prepareTriggered = true; //next track is ready to go } lock.Leave(); if (!IsRunning()) Create(); /* trigger playback start */ m_isPlaying = true; m_startEvent.Set(); m_callback.OnPlayBackStarted(file); m_signalStarted = false; if (options.startpercent > 0.0) { Sleep(50); SeekPercentage(options.startpercent); } return true; }