Merge pull request #24470 from fuzzard/release_20.3
[xbmc.git] / xbmc / settings / AdvancedSettings.h
blob4ba4e7e8b075ef84a1be551d03ad724d4ae20f3e
1 /*
2 * Copyright (C) 2005-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 #pragma once
11 #include "pictures/PictureScalingAlgorithm.h"
12 #include "settings/lib/ISettingCallback.h"
13 #include "settings/lib/ISettingsHandler.h"
14 #include "utils/SortUtils.h"
16 #include <set>
17 #include <string>
18 #include <utility>
19 #include <vector>
21 #define CACHE_BUFFER_MODE_INTERNET 0
22 #define CACHE_BUFFER_MODE_ALL 1
23 #define CACHE_BUFFER_MODE_TRUE_INTERNET 2
24 #define CACHE_BUFFER_MODE_NONE 3
25 #define CACHE_BUFFER_MODE_NETWORK 4
27 class CProfileManager;
28 class CSettingsManager;
29 class CVariant;
30 struct IntegerSettingOption;
32 class TiXmlElement;
33 namespace ADDON
35 class IAddon;
38 class DatabaseSettings
40 public:
41 DatabaseSettings() { Reset(); }
42 void Reset()
44 type.clear();
45 host.clear();
46 port.clear();
47 user.clear();
48 pass.clear();
49 name.clear();
50 key.clear();
51 cert.clear();
52 ca.clear();
53 capath.clear();
54 ciphers.clear();
55 compression = false;
57 std::string type;
58 std::string host;
59 std::string port;
60 std::string user;
61 std::string pass;
62 std::string name;
63 std::string key;
64 std::string cert;
65 std::string ca;
66 std::string capath;
67 std::string ciphers;
68 bool compression;
71 struct TVShowRegexp
73 bool byDate;
74 bool byTitle;
75 std::string regexp;
76 int defaultSeason;
77 TVShowRegexp(bool d, const std::string& r, int s = 1, bool t = false) : regexp(r)
79 byDate = d;
80 defaultSeason = s;
81 byTitle = t;
85 struct RefreshOverride
87 float fpsmin;
88 float fpsmax;
90 float refreshmin;
91 float refreshmax;
93 bool fallback;
97 struct RefreshVideoLatency
99 float refreshmin;
100 float refreshmax;
102 float delay;
105 typedef std::vector<TVShowRegexp> SETTINGS_TVSHOWLIST;
107 class CAdvancedSettings : public ISettingCallback, public ISettingsHandler
109 public:
110 CAdvancedSettings();
112 void OnSettingsLoaded() override;
113 void OnSettingsUnloaded() override;
115 void OnSettingChanged(const std::shared_ptr<const CSetting>& setting) override;
117 void Initialize(CSettingsManager& settingsMgr);
118 void Uninitialize(CSettingsManager& settingsMgr);
119 bool Initialized() const { return m_initialized; }
120 void AddSettingsFile(const std::string &filename);
121 bool Load(const CProfileManager &profileManager);
123 static void GetCustomTVRegexps(TiXmlElement *pRootElement, SETTINGS_TVSHOWLIST& settings);
124 static void GetCustomRegexps(TiXmlElement *pRootElement, std::vector<std::string> &settings);
125 static void GetCustomExtensions(TiXmlElement *pRootElement, std::string& extensions);
127 std::string m_audioDefaultPlayer;
128 float m_audioPlayCountMinimumPercent;
129 bool m_VideoPlayerIgnoreDTSinWAV;
130 float m_limiterHold;
131 float m_limiterRelease;
133 bool m_omlSync = true;
135 float m_videoSubsDelayRange;
136 float m_videoAudioDelayRange;
137 bool m_videoUseTimeSeeking;
138 int m_videoTimeSeekForward;
139 int m_videoTimeSeekBackward;
140 int m_videoTimeSeekForwardBig;
141 int m_videoTimeSeekBackwardBig;
142 int m_videoPercentSeekForward;
143 int m_videoPercentSeekBackward;
144 int m_videoPercentSeekForwardBig;
145 int m_videoPercentSeekBackwardBig;
146 std::vector<int> m_seekSteps;
147 std::string m_videoPPFFmpegPostProc;
148 bool m_videoVDPAUtelecine;
149 bool m_videoVDPAUdeintSkipChromaHD;
150 bool m_musicUseTimeSeeking;
151 int m_musicTimeSeekForward;
152 int m_musicTimeSeekBackward;
153 int m_musicTimeSeekForwardBig;
154 int m_musicTimeSeekBackwardBig;
155 int m_musicPercentSeekForward;
156 int m_musicPercentSeekBackward;
157 int m_musicPercentSeekForwardBig;
158 int m_musicPercentSeekBackwardBig;
159 int m_videoIgnoreSecondsAtStart;
160 float m_videoIgnorePercentAtEnd;
161 float m_audioApplyDrc;
162 unsigned int m_maxPassthroughOffSyncDuration = 10; // when 10 ms off adjust
164 int m_videoVDPAUScaling;
165 float m_videoNonLinStretchRatio;
166 float m_videoAutoScaleMaxFps;
167 std::vector<RefreshOverride> m_videoAdjustRefreshOverrides;
168 std::vector<RefreshVideoLatency> m_videoRefreshLatency;
169 float m_videoDefaultLatency;
170 int m_videoCaptureUseOcclusionQuery;
171 bool m_DXVACheckCompatibility;
172 bool m_DXVACheckCompatibilityPresent;
173 int m_videoFpsDetect;
174 float m_maxTempo;
175 bool m_videoPreferStereoStream = false;
177 std::string m_videoDefaultPlayer;
178 float m_videoPlayCountMinimumPercent;
180 float m_slideshowBlackBarCompensation;
181 float m_slideshowZoomAmount;
182 float m_slideshowPanAmount;
184 int m_songInfoDuration;
185 int m_logLevel;
186 int m_logLevelHint;
187 std::string m_cddbAddress;
188 bool m_addSourceOnTop; //!< True to put 'add source' buttons on top
190 //airtunes + airplay
191 int m_airTunesPort;
192 int m_airPlayPort;
194 /*! \brief Only used in linux for the udisks and udisks2 providers
195 * defines if kodi should automount media drives
196 * @note if kodi is running standalone (--standalone option) it will
197 * be set to tue
199 bool m_handleMounting;
200 /*! \brief Only used in linux for the udisks and udisks2 providers
201 * defines if kodi should automount optical discs
203 bool m_autoMountOpticalMedia{true};
205 bool m_fullScreenOnMovieStart;
206 std::string m_cachePath;
207 std::string m_videoCleanDateTimeRegExp;
208 std::vector<std::string> m_videoCleanStringRegExps;
209 std::vector<std::string> m_videoExcludeFromListingRegExps;
210 std::vector<std::string> m_allExcludeFromScanRegExps;
211 std::vector<std::string> m_moviesExcludeFromScanRegExps;
212 std::vector<std::string> m_tvshowExcludeFromScanRegExps;
213 std::vector<std::string> m_audioExcludeFromListingRegExps;
214 std::vector<std::string> m_audioExcludeFromScanRegExps;
215 std::vector<std::string> m_pictureExcludeFromListingRegExps;
216 std::vector<std::string> m_videoStackRegExps;
217 std::vector<std::string> m_folderStackRegExps;
218 std::vector<std::string> m_trailerMatchRegExps;
219 SETTINGS_TVSHOWLIST m_tvshowEnumRegExps;
220 std::string m_tvshowMultiPartEnumRegExp;
221 typedef std::vector< std::pair<std::string, std::string> > StringMapping;
222 StringMapping m_pathSubstitutions;
223 int m_remoteDelay; ///< \brief number of remote messages to ignore before repeating
224 bool m_bScanIRServer;
226 bool m_playlistAsFolders;
227 bool m_detectAsUdf;
229 unsigned int m_fanartRes; ///< \brief the maximal resolution to cache fanart at (assumes 16x9)
230 unsigned int m_imageRes; ///< \brief the maximal resolution to cache images at (assumes 16x9)
231 CPictureScalingAlgorithm::Algorithm m_imageScalingAlgorithm;
232 unsigned int
233 m_imageQualityJpeg; ///< \brief the stored jpeg quality the lower the better (default: 4)
235 int m_sambaclienttimeout;
236 std::string m_sambadoscodepage;
237 bool m_sambastatfiles;
239 bool m_bHTTPDirectoryStatFilesize;
241 bool m_bFTPThumbs;
242 bool m_bShoutcastArt;
244 std::string m_musicThumbs;
245 std::vector<std::string> m_musicArtistExtraArt;
246 std::vector<std::string> m_musicAlbumExtraArt;
248 int m_iMusicLibraryRecentlyAddedItems;
249 int m_iMusicLibraryDateAdded;
250 bool m_bMusicLibraryAllItemsOnBottom;
251 bool m_bMusicLibraryCleanOnUpdate;
252 bool m_bMusicLibraryArtistSortOnUpdate;
253 bool m_bMusicLibraryUseISODates;
254 std::string m_strMusicLibraryAlbumFormat;
255 bool m_prioritiseAPEv2tags;
256 std::string m_musicItemSeparator;
257 std::vector<std::string> m_musicArtistSeparators;
258 std::string m_videoItemSeparator;
259 std::vector<std::string> m_musicTagsFromFileFilters;
261 bool m_bVideoLibraryAllItemsOnBottom;
262 int m_iVideoLibraryRecentlyAddedItems;
263 bool m_bVideoLibraryCleanOnUpdate;
264 bool m_bVideoLibraryUseFastHash;
265 bool m_bVideoLibraryImportWatchedState{true};
266 bool m_bVideoLibraryImportResumePoint{true};
267 std::vector<std::string> m_videoEpisodeExtraArt;
268 std::vector<std::string> m_videoTvShowExtraArt;
269 std::vector<std::string> m_videoTvSeasonExtraArt;
270 std::vector<std::string> m_videoMovieExtraArt;
271 std::vector<std::string> m_videoMovieSetExtraArt;
272 std::vector<std::string> m_videoMusicVideoExtraArt;
274 bool m_bVideoScannerIgnoreErrors;
275 int m_iVideoLibraryDateAdded;
277 std::set<std::string> m_vecTokens;
279 int m_iEpgUpdateCheckInterval; // seconds
280 int m_iEpgCleanupInterval; // seconds
281 int m_iEpgActiveTagCheckInterval; // seconds
282 int m_iEpgRetryInterruptedUpdateInterval; // seconds
283 int m_iEpgUpdateEmptyTagsInterval; // seconds
284 bool m_bEpgDisplayUpdatePopup;
285 bool m_bEpgDisplayIncrementalUpdatePopup;
287 // EDL Commercial Break
288 bool m_bEdlMergeShortCommBreaks;
289 /*!< @brief If GUI notifications should be shown when reaching the start of commercial breaks */
290 bool m_EdlDisplayCommbreakNotifications;
291 int m_iEdlMaxCommBreakLength; // seconds
292 int m_iEdlMinCommBreakLength; // seconds
293 int m_iEdlMaxCommBreakGap; // seconds
294 int m_iEdlMaxStartGap; // seconds
295 int m_iEdlCommBreakAutowait; // seconds
296 int m_iEdlCommBreakAutowind; // seconds
298 int m_curlconnecttimeout;
299 int m_curllowspeedtime;
300 int m_curlretries;
301 int m_curlKeepAliveInterval; // seconds
302 bool m_curlDisableIPV6;
303 bool m_curlDisableHTTP2;
305 std::string m_caTrustFile;
307 bool m_minimizeToTray; /* win32 only */
308 bool m_fullScreen;
309 bool m_startFullScreen;
310 bool m_showExitButton; /* Ideal for appliances to hide a 'useless' button */
311 bool m_canWindowed;
312 bool m_splashImage;
313 bool m_alwaysOnTop; /* makes xbmc to run always on top .. osx/win32 only .. */
314 int m_playlistRetries;
315 int m_playlistTimeout;
316 bool m_GLRectangleHack;
317 int m_iSkipLoopFilter;
319 bool m_bVirtualShares;
321 std::string m_cpuTempCmd;
322 std::string m_gpuTempCmd;
324 /* PVR/TV related advanced settings */
325 int m_iPVRTimeCorrection; /*!< @brief correct all times (epg tags, timer tags, recording tags) by this amount of minutes. defaults to 0. */
326 int m_iPVRInfoToggleInterval; /*!< @brief if there are more than 1 pvr gui info item available (e.g. multiple recordings active at the same time), use this toggle delay in milliseconds. defaults to 3000. */
327 bool m_bPVRChannelIconsAutoScan; /*!< @brief automatically scan user defined folder for channel icons when loading internal channel groups */
328 bool m_bPVRAutoScanIconsUserSet; /*!< @brief mark channel icons populated by auto scan as "user set" */
329 int m_iPVRNumericChannelSwitchTimeout; /*!< @brief time in msecs after that a channel switch occurs after entering a channel number, if confirmchannelswitch is disabled */
330 int m_iPVRTimeshiftThreshold; /*!< @brief time diff between current playing time and timeshift buffer end, in seconds, before a playing stream is displayed as timeshifting. */
331 bool m_bPVRTimeshiftSimpleOSD; /*!< @brief use simple timeshift OSD (with progress only for the playing event instead of progress for the whole ts buffer). */
332 SortDescription m_PVRDefaultSortOrder; /*!< @brief SortDecription used to store default recording sort type and sort order */
334 DatabaseSettings m_databaseMusic; // advanced music database setup
335 DatabaseSettings m_databaseVideo; // advanced video database setup
336 DatabaseSettings m_databaseTV; // advanced tv database setup
337 DatabaseSettings m_databaseEpg; /*!< advanced EPG database setup */
339 bool m_useLocaleCollation;
341 bool m_guiVisualizeDirtyRegions;
342 int m_guiAlgorithmDirtyRegions;
343 bool m_guiSmartRedraw;
344 unsigned int m_addonPackageFolderSize;
346 unsigned int m_cacheMemSize;
347 unsigned int m_cacheBufferMode;
348 unsigned int m_cacheChunkSize;
349 float m_cacheReadFactor;
351 bool m_jsonOutputCompact;
352 unsigned int m_jsonTcpPort;
354 bool m_enableMultimediaKeys;
355 std::vector<std::string> m_settingsFiles;
356 void ParseSettingsFile(const std::string &file);
358 float GetLatencyTweak(float refreshrate);
359 bool m_initialized;
361 void SetDebugMode(bool debug);
363 //! \brief Toggles dirty-region visualization
364 void ToggleDirtyRegionVisualization()
366 m_guiVisualizeDirtyRegions = !m_guiVisualizeDirtyRegions;
369 // runtime settings which cannot be set from advancedsettings.xml
370 std::string m_videoExtensions;
371 std::string m_discStubExtensions;
372 std::string m_subtitlesExtensions;
373 std::string m_musicExtensions;
374 std::string m_pictureExtensions;
376 std::string m_stereoscopicregex_3d;
377 std::string m_stereoscopicregex_sbs;
378 std::string m_stereoscopicregex_tab;
380 bool m_openGlDebugging;
382 std::string m_userAgent;
383 uint32_t m_nfsTimeout;
384 int m_nfsRetries;
386 private:
387 void Initialize();
388 void Clear();
389 void SetExtraArtwork(const TiXmlElement* arttypes, std::vector<std::string>& artworkMap);
390 void MigrateOldArtSettings();