diff options
author | Arne Morten Kvarving <spiff@kodi.tv> | 2022-10-22 22:50:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-22 22:50:23 +0200 |
commit | 90838f0fbc80edc668b618b452311bfe2a8727e7 (patch) | |
tree | 83b5996e2f66d5a96c4b31dc0de349af52f993b0 | |
parent | 01aa35615eb327338f87bd1c13ac47d4e4c06923 (diff) | |
parent | 835b6e03e632b44be788b72c0a6f3bd674f016a6 (diff) |
Merge pull request #21942 from notspiff/app_comp_stack_helper
ApplicationStackHelper: move to ApplicationComponents
-rw-r--r-- | xbmc/application/Application.cpp | 89 | ||||
-rw-r--r-- | xbmc/application/Application.h | 3 | ||||
-rw-r--r-- | xbmc/application/ApplicationPlayerCallback.cpp | 42 | ||||
-rw-r--r-- | xbmc/application/ApplicationPlayerCallback.h | 3 | ||||
-rw-r--r-- | xbmc/application/ApplicationStackHelper.h | 3 | ||||
-rw-r--r-- | xbmc/powermanagement/PowerManager.cpp | 12 | ||||
-rw-r--r-- | xbmc/utils/SaveFileStateJob.cpp | 10 |
7 files changed, 92 insertions, 70 deletions
diff --git a/xbmc/application/Application.cpp b/xbmc/application/Application.cpp index 9197b9b822..b3edbdf0ca 100644 --- a/xbmc/application/Application.cpp +++ b/xbmc/application/Application.cpp @@ -30,6 +30,7 @@ #include "application/ApplicationPlayer.h" #include "application/ApplicationPowerHandling.h" #include "application/ApplicationSkinHandling.h" +#include "application/ApplicationStackHelper.h" #include "application/ApplicationVolumeHandling.h" #include "cores/AudioEngine/Engines/ActiveAE/ActiveAE.h" #include "cores/IPlayer.h" @@ -221,12 +222,10 @@ using namespace std::chrono_literals; #define MAX_FFWD_SPEED 5 CApplication::CApplication(void) - : CApplicationPlayerCallback(m_stackHelper) + : #ifdef HAS_DVD_DRIVE - , - m_Autorun(new CAutorun()) + m_Autorun(new CAutorun()), #endif - , m_pInertialScrollingHandler(new CInertialScrollingHandler()), m_WaitingExternalCalls(0) { @@ -242,10 +241,12 @@ CApplication::CApplication(void) RegisterComponent(std::make_shared<CApplicationPowerHandling>()); RegisterComponent(std::make_shared<CApplicationSkinHandling>(this, this, m_bInitializing)); RegisterComponent(std::make_shared<CApplicationVolumeHandling>()); + RegisterComponent(std::make_shared<CApplicationStackHelper>()); } CApplication::~CApplication(void) { + DeregisterComponent(typeid(CApplicationStackHelper)); DeregisterComponent(typeid(CApplicationVolumeHandling)); DeregisterComponent(typeid(CApplicationSkinHandling)); DeregisterComponent(typeid(CApplicationPowerHandling)); @@ -2301,12 +2302,13 @@ bool CApplication::PlayMedia(CFileItem& item, const std::string& player, PLAYLIS // return value: same with PlayFile() bool CApplication::PlayStack(CFileItem& item, bool bRestart) { - if (!m_stackHelper.InitializeStack(item)) + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + if (!stackHelper->InitializeStack(item)) return false; - int startoffset = m_stackHelper.InitializeStackStartPartAndOffset(item); + int startoffset = stackHelper->InitializeStackStartPartAndOffset(item); - CFileItem selectedStackPart = m_stackHelper.GetCurrentStackPartFileItem(); + CFileItem selectedStackPart = stackHelper->GetCurrentStackPartFileItem(); selectedStackPart.SetStartOffset(startoffset); if (item.HasProperty("savedplayerstate")) @@ -2325,6 +2327,7 @@ bool CApplication::PlayFile(CFileItem item, const std::string& player, bool bRes item.FillInMimeType(); const auto appPlayer = GetComponent<CApplicationPlayer>(); + const auto stackHelper = GetComponent<CApplicationStackHelper>(); if (!bRestart) { @@ -2332,7 +2335,7 @@ bool CApplication::PlayFile(CFileItem item, const std::string& player, bool bRes appPlayer->SetPlaySpeed(1); m_nextPlaylistItem = -1; - m_stackHelper.Clear(); + stackHelper->Clear(); if (item.IsVideo()) CUtil::ClearSubtitles(); @@ -2380,7 +2383,7 @@ bool CApplication::PlayFile(CFileItem item, const std::string& player, bool bRes if (item.HasVideoInfoTag()) options.state = item.GetVideoInfoTag()->GetResumePoint().playerState; } - if (!bRestart || m_stackHelper.IsPlayingISOStack()) + if (!bRestart || stackHelper->IsPlayingISOStack()) { // the following code block is only applicable when bRestart is false OR to ISO stacks @@ -2485,11 +2488,11 @@ bool CApplication::PlayFile(CFileItem item, const std::string& player, bool bRes CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_fullScreenOnMovieStart && !CMediaSettings::GetInstance().DoesMediaStartWindowed(); } - else if(m_stackHelper.IsPlayingRegularStack()) + else if (stackHelper->IsPlayingRegularStack()) { //! @todo - this will fail if user seeks back to first file in stack - if (m_stackHelper.GetCurrentPartNumber() == 0 || - m_stackHelper.GetRegisteredStack(item)->GetStartOffset() != 0) + if (stackHelper->GetCurrentPartNumber() == 0 || + stackHelper->GetRegisteredStack(item)->GetStartOffset() != 0) options.fullscreen = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()-> m_fullScreenOnMovieStart && !CMediaSettings::GetInstance().DoesMediaStartWindowed(); else @@ -2547,6 +2550,8 @@ bool CApplication::PlayFile(CFileItem item, const std::string& player, bool bRes void CApplication::PlaybackCleanup() { const auto appPlayer = GetComponent<CApplicationPlayer>(); + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + if (!appPlayer->IsPlaying()) { CGUIComponent *gui = CServiceBroker::GetGUI(); @@ -2597,7 +2602,7 @@ void CApplication::PlaybackCleanup() if (!appPlayer->IsPlaying()) { - m_stackHelper.Clear(); + stackHelper->Clear(); appPlayer->ResetPlayer(); } @@ -2870,10 +2875,12 @@ bool CApplication::OnMessage(CGUIMessage& message) return true; case GUI_MSG_PLAYBACK_ENDED: + { m_playerEvent.Set(); - if (m_stackHelper.IsPlayingRegularStack() && m_stackHelper.HasNextStackPartFileItem()) + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + if (stackHelper->IsPlayingRegularStack() && stackHelper->HasNextStackPartFileItem()) { // just play the next item in the stack - PlayFile(m_stackHelper.SetNextStackPartCurrentFileItem(), "", true); + PlayFile(stackHelper->SetNextStackPartCurrentFileItem(), "", true); return true; } ResetCurrentItem(); @@ -2886,6 +2893,7 @@ bool CApplication::OnMessage(CGUIMessage& message) CServiceBroker::GetXBPython().OnPlayBackEnded(); #endif return true; + } case GUI_MSG_PLAYLISTPLAYER_STOPPED: ResetCurrentItem(); @@ -3283,8 +3291,10 @@ CFileItem& CApplication::CurrentFileItem() const CFileItem& CApplication::CurrentUnstackedItem() { - if (m_stackHelper.IsPlayingISOStack() || m_stackHelper.IsPlayingRegularStack()) - return m_stackHelper.GetCurrentStackPartFileItem(); + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + + if (stackHelper->IsPlayingISOStack() || stackHelper->IsPlayingRegularStack()) + return stackHelper->GetCurrentStackPartFileItem(); else return *m_itemCurrentFile; } @@ -3298,10 +3308,12 @@ double CApplication::GetTotalTime() const double rc = 0.0; const auto appPlayer = GetComponent<CApplicationPlayer>(); + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + if (appPlayer->IsPlaying()) { - if (m_stackHelper.IsPlayingRegularStack()) - rc = m_stackHelper.GetStackTotalTimeMs() * 0.001; + if (stackHelper->IsPlayingRegularStack()) + rc = stackHelper->GetStackTotalTimeMs() * 0.001; else rc = appPlayer->GetTotalTime() * 0.001; } @@ -3317,11 +3329,13 @@ double CApplication::GetTime() const double rc = 0.0; const auto appPlayer = GetComponent<CApplicationPlayer>(); + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + if (appPlayer->IsPlaying()) { - if (m_stackHelper.IsPlayingRegularStack()) + if (stackHelper->IsPlayingRegularStack()) { - uint64_t startOfCurrentFile = m_stackHelper.GetCurrentStackPartStartTimeMs(); + uint64_t startOfCurrentFile = stackHelper->GetCurrentStackPartStartTimeMs(); rc = (startOfCurrentFile + appPlayer->GetTime()) * 0.001; } else @@ -3339,24 +3353,28 @@ double CApplication::GetTime() const void CApplication::SeekTime( double dTime ) { const auto appPlayer = GetComponent<CApplicationPlayer>(); + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + if (appPlayer->IsPlaying() && (dTime >= 0.0)) { if (!appPlayer->CanSeek()) return; - if (m_stackHelper.IsPlayingRegularStack()) + + if (stackHelper->IsPlayingRegularStack()) { // find the item in the stack we are seeking to, and load the new // file if necessary, and calculate the correct seek within the new // file. Otherwise, just fall through to the usual routine if the // time is higher than our total time. - int partNumberToPlay = m_stackHelper.GetStackPartNumberAtTimeMs(static_cast<uint64_t>(dTime * 1000.0)); - uint64_t startOfNewFile = m_stackHelper.GetStackPartStartTimeMs(partNumberToPlay); - if (partNumberToPlay == m_stackHelper.GetCurrentPartNumber()) + int partNumberToPlay = + stackHelper->GetStackPartNumberAtTimeMs(static_cast<uint64_t>(dTime * 1000.0)); + uint64_t startOfNewFile = stackHelper->GetStackPartStartTimeMs(partNumberToPlay); + if (partNumberToPlay == stackHelper->GetCurrentPartNumber()) appPlayer->SeekTime(static_cast<uint64_t>(dTime * 1000.0) - startOfNewFile); else { // seeking to a new file - m_stackHelper.SetStackPartCurrentFileItem(partNumberToPlay); - CFileItem *item = new CFileItem(m_stackHelper.GetCurrentStackPartFileItem()); + stackHelper->SetStackPartCurrentFileItem(partNumberToPlay); + CFileItem* item = new CFileItem(stackHelper->GetCurrentStackPartFileItem()); item->SetStartOffset(static_cast<uint64_t>(dTime * 1000.0) - startOfNewFile); // don't just call "PlayFile" here, as we are quite likely called from the // player thread, so we won't be able to delete ourselves. @@ -3372,6 +3390,8 @@ void CApplication::SeekTime( double dTime ) float CApplication::GetPercentage() const { const auto appPlayer = GetComponent<CApplicationPlayer>(); + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + if (appPlayer->IsPlaying()) { if (appPlayer->GetTotalTime() == 0 && appPlayer->IsPlayingAudio() && @@ -3382,7 +3402,7 @@ float CApplication::GetPercentage() const return (float)(GetTime() / tag.GetDuration() * 100); } - if (m_stackHelper.IsPlayingRegularStack()) + if (stackHelper->IsPlayingRegularStack()) { double totalTime = GetTotalTime(); if (totalTime > 0.0) @@ -3397,10 +3417,12 @@ float CApplication::GetPercentage() const float CApplication::GetCachePercentage() const { const auto appPlayer = GetComponent<CApplicationPlayer>(); + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + if (appPlayer->IsPlaying()) { // Note that the player returns a relative cache percentage and we want an absolute percentage - if (m_stackHelper.IsPlayingRegularStack()) + if (stackHelper->IsPlayingRegularStack()) { float stackedTotalTime = (float) GetTotalTime(); // We need to take into account the stack's total time vs. currently playing file's total time @@ -3418,11 +3440,13 @@ float CApplication::GetCachePercentage() const void CApplication::SeekPercentage(float percent) { const auto appPlayer = GetComponent<CApplicationPlayer>(); + const auto stackHelper = GetComponent<CApplicationStackHelper>(); + if (appPlayer->IsPlaying() && (percent >= 0.0f)) { if (!appPlayer->CanSeek()) return; - if (m_stackHelper.IsPlayingRegularStack()) + if (stackHelper->IsPlayingRegularStack()) SeekTime(static_cast<double>(percent) * 0.01 * GetTotalTime()); else appPlayer->SeekPercentage(percent); @@ -3435,11 +3459,6 @@ std::string CApplication::GetCurrentPlayer() return appPlayer->GetCurrentPlayer(); } -const CApplicationStackHelper& CApplication::GetAppStackHelper() const -{ - return m_stackHelper; -} - void CApplication::UpdateLibraries() { const std::shared_ptr<CSettings> settings = CServiceBroker::GetSettingsComponent()->GetSettings(); diff --git a/xbmc/application/Application.h b/xbmc/application/Application.h index 9f86befb4a..a37dcf733d 100644 --- a/xbmc/application/Application.h +++ b/xbmc/application/Application.h @@ -12,7 +12,6 @@ #include "application/ApplicationEnums.h" #include "application/ApplicationPlayerCallback.h" #include "application/ApplicationSettingsHandling.h" -#include "application/ApplicationStackHelper.h" #include "guilib/IMsgTargetCallback.h" #include "guilib/IWindowManagerCallback.h" #include "messaging/IMessageTarget.h" @@ -121,7 +120,6 @@ public: const CFileItem& CurrentUnstackedItem(); bool OnMessage(CGUIMessage& message) override; std::string GetCurrentPlayer(); - const CApplicationStackHelper& GetAppStackHelper() const; int GetMessageMask() override; void OnApplicationMessage(KODI::MESSAGING::ThreadMessage* pMsg) override; @@ -252,7 +250,6 @@ private: std::atomic_uint m_WaitingExternalCalls; /*!< counts threads which are waiting to be processed in FrameMove */ unsigned int m_ProcessedExternalCalls = 0; /*!< counts calls which are processed during one "door open" cycle in FrameMove */ unsigned int m_ProcessedExternalDecay = 0; /*!< counts to close door after a few frames of no python activity */ - CApplicationStackHelper m_stackHelper; int m_ExitCode{EXITCODE_QUIT}; }; diff --git a/xbmc/application/ApplicationPlayerCallback.cpp b/xbmc/application/ApplicationPlayerCallback.cpp index e10751f2f9..0dbb4b9fe5 100644 --- a/xbmc/application/ApplicationPlayerCallback.cpp +++ b/xbmc/application/ApplicationPlayerCallback.cpp @@ -35,8 +35,8 @@ #include "video/VideoDatabase.h" #include "video/VideoInfoTag.h" -CApplicationPlayerCallback::CApplicationPlayerCallback(CApplicationStackHelper& stackHelper) - : m_stackHelper(stackHelper), m_itemCurrentFile(new CFileItem), m_playerEvent(true, true) +CApplicationPlayerCallback::CApplicationPlayerCallback() + : m_itemCurrentFile(new CFileItem), m_playerEvent(true, true) { } @@ -71,12 +71,13 @@ void CApplicationPlayerCallback::OnPlayBackStarted(const CFileItem& file) { auto& components = CServiceBroker::GetAppComponents(); const auto appPlayer = components.GetComponent<CApplicationPlayer>(); - if (appPlayer) - appPlayer->SetUpdateStreamDetails(); + appPlayer->SetUpdateStreamDetails(); } - if (m_stackHelper.IsPlayingISOStack() || m_stackHelper.IsPlayingRegularStack()) - m_itemCurrentFile.reset(new CFileItem(*m_stackHelper.GetRegisteredStack(file))); + auto& components = CServiceBroker::GetAppComponents(); + const auto stackHelper = components.GetComponent<CApplicationStackHelper>(); + if (stackHelper->IsPlayingISOStack() || stackHelper->IsPlayingRegularStack()) + m_itemCurrentFile.reset(new CFileItem(*stackHelper->GetRegisteredStack(file))); else m_itemCurrentFile.reset(new CFileItem(file)); @@ -90,7 +91,7 @@ void CApplicationPlayerCallback::OnPlayBackStarted(const CFileItem& file) } CServiceBroker::GetPVRManager().OnPlaybackStarted(*m_itemCurrentFile); - m_stackHelper.OnPlayBackStarted(file); + stackHelper->OnPlayBackStarted(file); m_playerEvent.Reset(); @@ -101,7 +102,10 @@ void CApplicationPlayerCallback::OnPlayBackStarted(const CFileItem& file) void CApplicationPlayerCallback::OnPlayerCloseFile(const CFileItem& file, const CBookmark& bookmarkParam) { - std::unique_lock<CCriticalSection> lock(m_stackHelper.m_critSection); + auto& components = CServiceBroker::GetAppComponents(); + const auto stackHelper = components.GetComponent<CApplicationStackHelper>(); + + std::unique_lock<CCriticalSection> lock(stackHelper->m_critSection); CFileItem fileItem(file); CBookmark bookmark = bookmarkParam; @@ -113,16 +117,16 @@ void CApplicationPlayerCallback::OnPlayerCloseFile(const CFileItem& file, if (bookmark.timeInSeconds == 0.0) return; - if (m_stackHelper.GetRegisteredStack(fileItem) != nullptr && - m_stackHelper.GetRegisteredStackTotalTimeMs(fileItem) > 0) + if (stackHelper->GetRegisteredStack(fileItem) != nullptr && + stackHelper->GetRegisteredStackTotalTimeMs(fileItem) > 0) { // regular stack case: we have to save the bookmark on the stack - fileItem = *m_stackHelper.GetRegisteredStack(file); + fileItem = *stackHelper->GetRegisteredStack(file); // the bookmark coming from the player is only relative to the current part, thus needs to be corrected with these attributes (start time will be 0 for non-stackparts) - bookmark.timeInSeconds += m_stackHelper.GetRegisteredStackPartStartTimeMs(file) / 1000.0; - if (m_stackHelper.GetRegisteredStackTotalTimeMs(file) > 0) - bookmark.totalTimeInSeconds = m_stackHelper.GetRegisteredStackTotalTimeMs(file) / 1000.0; - bookmark.partNumber = m_stackHelper.GetRegisteredStackPartNumber(file); + bookmark.timeInSeconds += stackHelper->GetRegisteredStackPartStartTimeMs(file) / 1000.0; + if (stackHelper->GetRegisteredStackTotalTimeMs(file) > 0) + bookmark.totalTimeInSeconds = stackHelper->GetRegisteredStackTotalTimeMs(file) / 1000.0; + bookmark.partNumber = stackHelper->GetRegisteredStackPartNumber(file); } percent = bookmark.timeInSeconds / bookmark.totalTimeInSeconds * 100; @@ -148,7 +152,7 @@ void CApplicationPlayerCallback::OnPlayerCloseFile(const CFileItem& file, else if (bookmark.timeInSeconds > advancedSettings->m_videoIgnoreSecondsAtStart) { resumeBookmark = bookmark; - if (m_stackHelper.GetRegisteredStack(file) != nullptr) + if (stackHelper->GetRegisteredStack(file) != nullptr) { // also update video info tag with total time fileItem.GetVideoInfoTag()->m_streamDetails.SetVideoDuration( @@ -246,8 +250,7 @@ void CApplicationPlayerCallback::OnPlayBackSeek(int64_t iTime, int64_t seekOffse param["player"]["playerid"] = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist(); const auto& components = CServiceBroker::GetAppComponents(); const auto appPlayer = components.GetComponent<CApplicationPlayer>(); - if (appPlayer) - param["player"]["speed"] = static_cast<int>(appPlayer->GetPlaySpeed()); + param["player"]["speed"] = static_cast<int>(appPlayer->GetPlaySpeed()); CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "OnSeek", m_itemCurrentFile, param); @@ -318,8 +321,7 @@ void CApplicationPlayerCallback::RequestVideoSettings(const CFileItem& fileItem) auto& components = CServiceBroker::GetAppComponents(); const auto appPlayer = components.GetComponent<CApplicationPlayer>(); - if (appPlayer) - appPlayer->SetVideoSettings(vs); + appPlayer->SetVideoSettings(vs); dbs.Close(); } diff --git a/xbmc/application/ApplicationPlayerCallback.h b/xbmc/application/ApplicationPlayerCallback.h index 8860787c24..8cfd40b6fd 100644 --- a/xbmc/application/ApplicationPlayerCallback.h +++ b/xbmc/application/ApplicationPlayerCallback.h @@ -19,7 +19,7 @@ class CFileItem; class CApplicationPlayerCallback : public IPlayerCallback { public: - CApplicationPlayerCallback(CApplicationStackHelper& stackHelper); + CApplicationPlayerCallback(); void OnPlayBackEnded() override; void OnPlayBackStarted(const CFileItem& file) override; @@ -38,7 +38,6 @@ public: void StoreVideoSettings(const CFileItem& fileItem, const CVideoSettings& vs) override; protected: - CApplicationStackHelper& m_stackHelper; //!< Reference to application stack helper std::shared_ptr<CFileItem> m_itemCurrentFile; //!< Currently playing file CEvent m_playerEvent; }; diff --git a/xbmc/application/ApplicationStackHelper.h b/xbmc/application/ApplicationStackHelper.h index e7ce9d998c..6af0044372 100644 --- a/xbmc/application/ApplicationStackHelper.h +++ b/xbmc/application/ApplicationStackHelper.h @@ -8,6 +8,7 @@ #pragma once +#include "application/IApplicationComponent.h" #include "threads/CriticalSection.h" #include <map> @@ -17,7 +18,7 @@ class CFileItem; class CFileItemList; -class CApplicationStackHelper +class CApplicationStackHelper : public IApplicationComponent { public: CApplicationStackHelper(void); diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp index 924aa2a054..3c30817331 100644 --- a/xbmc/powermanagement/PowerManager.cpp +++ b/xbmc/powermanagement/PowerManager.cpp @@ -16,6 +16,7 @@ #include "application/ApplicationComponents.h" #include "application/ApplicationPlayer.h" #include "application/ApplicationPowerHandling.h" +#include "application/ApplicationStackHelper.h" #include "cores/AudioEngine/Interfaces/AE.h" #include "dialogs/GUIDialogBusyNoCancel.h" #include "dialogs/GUIDialogKaiToast.h" @@ -262,12 +263,13 @@ void CPowerManager::StorePlayerState() // set the actual offset instead of store and load it from database m_lastPlayedFileItem->SetStartOffset(appPlayer->GetTime()); // in case of regular stack, correct the start offset by adding current part start time - if (g_application.GetAppStackHelper().IsPlayingRegularStack()) - m_lastPlayedFileItem->SetStartOffset( - m_lastPlayedFileItem->GetStartOffset() + - g_application.GetAppStackHelper().GetCurrentStackPartStartTimeMs()); + const auto stackHelper = components.GetComponent<CApplicationStackHelper>(); + if (stackHelper->IsPlayingRegularStack()) + m_lastPlayedFileItem->SetStartOffset(m_lastPlayedFileItem->GetStartOffset() + + stackHelper->GetCurrentStackPartStartTimeMs()); // in case of iso stack, keep track of part number - m_lastPlayedFileItem->m_lStartPartNumber = g_application.GetAppStackHelper().IsPlayingISOStack() ? g_application.GetAppStackHelper().GetCurrentPartNumber() + 1 : 1; + m_lastPlayedFileItem->m_lStartPartNumber = + stackHelper->IsPlayingISOStack() ? stackHelper->GetCurrentPartNumber() + 1 : 1; // for iso and iso stacks, keep track of playerstate m_lastPlayedFileItem->SetProperty("savedplayerstate", appPlayer->GetPlayerState()); CLog::Log(LOGDEBUG, diff --git a/xbmc/utils/SaveFileStateJob.cpp b/xbmc/utils/SaveFileStateJob.cpp index e97d350cf7..b993ed450d 100644 --- a/xbmc/utils/SaveFileStateJob.cpp +++ b/xbmc/utils/SaveFileStateJob.cpp @@ -15,7 +15,8 @@ #include "URIUtils.h" #include "URL.h" #include "Util.h" -#include "application/Application.h" +#include "application/ApplicationComponents.h" +#include "application/ApplicationStackHelper.h" #include "guilib/GUIComponent.h" #include "guilib/GUIMessage.h" #include "guilib/GUIWindowManager.h" @@ -165,9 +166,10 @@ void CSaveFileState::DoWork(CFileItem& item, // Could be part of an ISO stack. In this case the bookmark is saved onto the part. // In order to properly update the list, we need to refresh the stack's resume point - const CApplicationStackHelper& stackHelper = g_application.GetAppStackHelper(); - if (stackHelper.HasRegisteredStack(item) && - stackHelper.GetRegisteredStackTotalTimeMs(item) == 0) + const auto& components = CServiceBroker::GetAppComponents(); + const auto stackHelper = components.GetComponent<CApplicationStackHelper>(); + if (stackHelper->HasRegisteredStack(item) && + stackHelper->GetRegisteredStackTotalTimeMs(item) == 0) videodatabase.GetResumePoint(*(msgItem->GetVideoInfoTag())); CGUIMessage message(GUI_MSG_NOTIFY_ALL, CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow(), 0, GUI_MSG_UPDATE_ITEM, 0, msgItem); |