[WASAPI] set stream audio category
[xbmc.git] / xbmc / cores / RetroPlayer / RetroPlayerAutoSave.cpp
blob872bfa86114a928a87e16cb2e8f230fedfc7073e
1 /*
2 * Copyright (C) 2017-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "RetroPlayerAutoSave.h"
11 #include "URL.h"
12 #include "games/GameSettings.h"
13 #include "utils/log.h"
15 using namespace KODI;
16 using namespace RETRO;
17 using namespace std::chrono_literals;
19 namespace
21 constexpr auto AUTOSAVE_DURATION_SECS = 10s; // Auto-save every 10 seconds
24 CRetroPlayerAutoSave::CRetroPlayerAutoSave(IAutoSaveCallback& callback,
25 GAME::CGameSettings& settings)
26 : CThread("CRetroPlayerAutoSave"), m_callback(callback), m_settings(settings)
28 CLog::Log(LOGDEBUG, "RetroPlayer[SAVE]: Initializing autosave");
30 Create(false);
33 CRetroPlayerAutoSave::~CRetroPlayerAutoSave()
35 CLog::Log(LOGDEBUG, "RetroPlayer[SAVE]: Deinitializing autosave");
37 StopThread();
40 void CRetroPlayerAutoSave::Process()
42 CLog::Log(LOGDEBUG, "RetroPlayer[SAVE]: Autosave thread started");
44 while (!m_bStop)
46 CThread::Sleep(AUTOSAVE_DURATION_SECS);
48 if (m_bStop)
49 break;
51 if (!m_settings.AutosaveEnabled())
52 continue;
54 if (m_callback.IsAutoSaveEnabled())
56 std::string savePath = m_callback.CreateAutosave();
57 if (!savePath.empty())
58 CLog::Log(LOGDEBUG, "RetroPlayer[SAVE]: Saved state to {}", CURL::GetRedacted(savePath));
62 CLog::Log(LOGDEBUG, "RetroPlayer[SAVE]: Autosave thread ended");