2 * Copyright (C) 2013-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.
11 #include "cores/VideoSettings.h"
12 #include "settings/GameSettings.h"
13 #include "settings/ISubSettings.h"
14 #include "settings/LibExportSettings.h"
15 #include "settings/lib/ISettingCallback.h"
16 #include "settings/lib/ISettingsHandler.h"
17 #include "threads/CriticalSection.h"
22 #define VOLUME_DRC_MINIMUM 0 // 0dB
23 #define VOLUME_DRC_MAXIMUM 6000 // 60dB
33 class CMediaSettings
: public ISettingCallback
, public ISettingsHandler
, public ISubSettings
36 static CMediaSettings
& GetInstance();
38 bool Load(const TiXmlNode
*settings
) override
;
39 bool Save(TiXmlNode
*settings
) const override
;
41 void OnSettingAction(const std::shared_ptr
<const CSetting
>& setting
) override
;
42 void OnSettingChanged(const std::shared_ptr
<const CSetting
>& setting
) override
;
44 const CVideoSettings
& GetDefaultVideoSettings() const { return m_defaultVideoSettings
; }
45 CVideoSettings
& GetDefaultVideoSettings() { return m_defaultVideoSettings
; }
47 const CGameSettings
& GetDefaultGameSettings() const { return m_defaultGameSettings
; }
48 CGameSettings
& GetDefaultGameSettings() { return m_defaultGameSettings
; }
49 const CGameSettings
& GetCurrentGameSettings() const { return m_currentGameSettings
; }
50 CGameSettings
& GetCurrentGameSettings() { return m_currentGameSettings
; }
52 /*! \brief Retrieve the watched mode for the given content type
53 \param content Current content type
54 \return the current watch mode for this content type, WATCH_MODE_ALL if the content type is unknown.
57 int GetWatchedMode(const std::string
&content
) const;
59 /*! \brief Set the watched mode for the given content type
60 \param content Current content type
61 \param value Watched mode to set
64 void SetWatchedMode(const std::string
&content
, WatchedMode mode
);
66 /*! \brief Cycle the watched mode for the given content type
67 \param content Current content type
68 \sa GetWatchMode, SetWatchMode
70 void CycleWatchedMode(const std::string
&content
);
72 void SetMusicPlaylistRepeat(bool repeats
) { m_musicPlaylistRepeat
= repeats
; }
73 void SetMusicPlaylistShuffled(bool shuffled
) { m_musicPlaylistShuffle
= shuffled
; }
75 void SetVideoPlaylistRepeat(bool repeats
) { m_videoPlaylistRepeat
= repeats
; }
76 void SetVideoPlaylistShuffled(bool shuffled
) { m_videoPlaylistShuffle
= shuffled
; }
78 bool DoesMediaStartWindowed() const { return m_mediaStartWindowed
; }
79 void SetMediaStartWindowed(bool windowed
) { m_mediaStartWindowed
= windowed
; }
80 int GetAdditionalSubtitleDirectoryChecked() const { return m_additionalSubtitleDirectoryChecked
; }
81 void SetAdditionalSubtitleDirectoryChecked(int checked
) { m_additionalSubtitleDirectoryChecked
= checked
; }
83 int GetMusicNeedsUpdate() const { return m_musicNeedsUpdate
; }
84 void SetMusicNeedsUpdate(int version
) { m_musicNeedsUpdate
= version
; }
85 int GetVideoNeedsUpdate() const { return m_videoNeedsUpdate
; }
86 void SetVideoNeedsUpdate(int version
) { m_videoNeedsUpdate
= version
; }
90 CMediaSettings(const CMediaSettings
&) = delete;
91 CMediaSettings
& operator=(CMediaSettings
const&) = delete;
92 ~CMediaSettings() override
;
94 static std::string
GetWatchedContent(const std::string
&content
);
97 CVideoSettings m_defaultVideoSettings
;
99 CGameSettings m_defaultGameSettings
;
100 CGameSettings m_currentGameSettings
;
102 typedef std::map
<std::string
, WatchedMode
> WatchedModes
;
103 WatchedModes m_watchedModes
;
105 bool m_musicPlaylistRepeat
;
106 bool m_musicPlaylistShuffle
;
107 bool m_videoPlaylistRepeat
;
108 bool m_videoPlaylistShuffle
;
110 bool m_mediaStartWindowed
;
111 int m_additionalSubtitleDirectoryChecked
;
113 int m_musicNeedsUpdate
; ///< if a database update means an update is required (set to the version number of the db)
114 int m_videoNeedsUpdate
; ///< if a database update means an update is required (set to the version number of the db)
116 mutable CCriticalSection m_critical
;