Merge pull request #26362 from ksooo/estuary-rework-pvr-info-dialog
[xbmc.git] / xbmc / settings / AdvancedSettings.h
blobdc73358abd06ba5282d7732e4e7efd5e29a88757
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 <cstdint>
17 #include <set>
18 #include <string>
19 #include <utility>
20 #include <vector>
22 class CProfileManager;
23 class CSettingsManager;
24 class CVariant;
25 struct IntegerSettingOption;
27 class TiXmlElement;
28 namespace ADDON
30 class IAddon;
33 class DatabaseSettings
35 public:
36 DatabaseSettings() { Reset(); }
37 void Reset()
39 type.clear();
40 host.clear();
41 port.clear();
42 user.clear();
43 pass.clear();
44 name.clear();
45 key.clear();
46 cert.clear();
47 ca.clear();
48 capath.clear();
49 ciphers.clear();
50 compression = false;
52 std::string type;
53 std::string host;
54 std::string port;
55 std::string user;
56 std::string pass;
57 std::string name;
58 std::string key;
59 std::string cert;
60 std::string ca;
61 std::string capath;
62 std::string ciphers;
63 bool compression;
66 struct TVShowRegexp
68 bool byDate;
69 bool byTitle;
70 std::string regexp;
71 int defaultSeason;
72 TVShowRegexp(bool d, const std::string& r, int s = 1, bool t = false) : regexp(r)
74 byDate = d;
75 defaultSeason = s;
76 byTitle = t;
80 struct RefreshOverride
82 float fpsmin;
83 float fpsmax;
85 float refreshmin;
86 float refreshmax;
88 bool fallback;
92 struct RefreshVideoLatency
94 float refreshmin;
95 float refreshmax;
97 float delay;
98 float hdrextradelay;
101 typedef std::vector<TVShowRegexp> SETTINGS_TVSHOWLIST;
103 class CAdvancedSettings : public ISettingCallback, public ISettingsHandler
105 public:
106 CAdvancedSettings();
108 void OnSettingsLoaded() override;
109 void OnSettingsUnloaded() override;
111 void OnSettingChanged(const std::shared_ptr<const CSetting>& setting) override;
113 void Initialize(CSettingsManager& settingsMgr);
114 void Uninitialize(CSettingsManager& settingsMgr);
115 bool Initialized() const { return m_initialized; }
116 void AddSettingsFile(const std::string &filename);
117 bool Load(const CProfileManager &profileManager);
119 static void GetCustomTVRegexps(TiXmlElement *pRootElement, SETTINGS_TVSHOWLIST& settings);
120 static void GetCustomRegexps(TiXmlElement *pRootElement, std::vector<std::string> &settings);
121 static void GetCustomExtensions(TiXmlElement *pRootElement, std::string& extensions);
123 std::string m_audioDefaultPlayer;
124 float m_audioPlayCountMinimumPercent;
125 float m_limiterHold;
126 float m_limiterRelease;
128 bool m_omlSync = true;
130 float m_videoSubsDelayRange;
131 float m_videoSubsDelayStep;
132 float m_videoAudioDelayRange;
133 float m_videoAudioDelayStep;
134 bool m_videoUseTimeSeeking;
135 int m_videoTimeSeekForward;
136 int m_videoTimeSeekBackward;
137 int m_videoTimeSeekForwardBig;
138 int m_videoTimeSeekBackwardBig;
139 int m_videoPercentSeekForward;
140 int m_videoPercentSeekBackward;
141 int m_videoPercentSeekForwardBig;
142 int m_videoPercentSeekBackwardBig;
143 std::vector<int> m_seekSteps;
144 std::string m_videoPPFFmpegPostProc;
145 bool m_videoVDPAUtelecine;
146 bool m_videoVDPAUdeintSkipChromaHD;
147 bool m_musicUseTimeSeeking;
148 int m_musicTimeSeekForward;
149 int m_musicTimeSeekBackward;
150 int m_musicTimeSeekForwardBig;
151 int m_musicTimeSeekBackwardBig;
152 int m_musicPercentSeekForward;
153 int m_musicPercentSeekBackward;
154 int m_musicPercentSeekForwardBig;
155 int m_musicPercentSeekBackwardBig;
156 int m_videoIgnoreSecondsAtStart;
157 float m_videoIgnorePercentAtEnd;
158 float m_audioApplyDrc;
159 unsigned int m_maxPassthroughOffSyncDuration = 50; // when 50 ms off adjust
160 bool m_AllowMultiChannelFloat = false; // Android only switch to be removed in v22
161 bool m_superviseAudioDelay = false; // Android only to correct broken audio firmwares
163 int m_videoVDPAUScaling;
164 float m_videoNonLinStretchRatio;
165 float m_videoAutoScaleMaxFps;
166 std::vector<RefreshOverride> m_videoAdjustRefreshOverrides;
167 std::vector<RefreshVideoLatency> m_videoRefreshLatency;
168 float m_videoDefaultLatency;
169 float m_videoDefaultHdrExtraLatency;
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;
179 bool m_videoBypassCodecProfile = false; // Android only to bypass reported codec capabilities
181 float m_slideshowBlackBarCompensation;
182 float m_slideshowZoomAmount;
183 float m_slideshowPanAmount;
185 int m_songInfoDuration;
186 int m_logLevel;
187 int m_logLevelHint;
188 std::string m_cddbAddress;
189 bool m_addSourceOnTop; //!< True to put 'add source' buttons on top
191 //airtunes + airplay
192 int m_airTunesPort;
193 int m_airPlayPort;
195 /*! \brief Only used in linux for the udisks and udisks2 providers
196 * defines if kodi should automount media drives
197 * @note if kodi is running standalone (--standalone option) it will
198 * be set to tue
200 bool m_handleMounting;
201 /*! \brief Only used in linux for the udisks and udisks2 providers
202 * defines if kodi should automount optical discs
204 bool m_autoMountOpticalMedia{true};
206 bool m_fullScreenOnMovieStart;
207 std::string m_cachePath;
208 std::string m_videoCleanDateTimeRegExp;
209 std::string m_videoFilenameIdentifierRegExp;
210 std::vector<std::string> m_videoCleanStringRegExps;
211 std::vector<std::string> m_videoExcludeFromListingRegExps;
212 std::vector<std::string> m_allExcludeFromScanRegExps;
213 std::vector<std::string> m_moviesExcludeFromScanRegExps;
214 std::vector<std::string> m_tvshowExcludeFromScanRegExps;
215 std::vector<std::string> m_audioExcludeFromListingRegExps;
216 std::vector<std::string> m_audioExcludeFromScanRegExps;
217 std::vector<std::string> m_pictureExcludeFromListingRegExps;
218 std::vector<std::string> m_videoStackRegExps;
219 std::vector<std::string> m_folderStackRegExps;
220 std::vector<std::string> m_trailerMatchRegExps;
221 SETTINGS_TVSHOWLIST m_tvshowEnumRegExps;
222 std::string m_tvshowMultiPartEnumRegExp;
223 typedef std::vector< std::pair<std::string, std::string> > StringMapping;
224 StringMapping m_pathSubstitutions;
225 int m_remoteDelay; ///< \brief number of remote messages to ignore before repeating
226 bool m_bScanIRServer;
228 bool m_playlistAsFolders;
229 bool m_detectAsUdf;
231 unsigned int m_fanartRes; ///< \brief the maximal resolution to cache fanart at (assumes 16x9)
232 unsigned int m_imageRes; ///< \brief the maximal resolution to cache images at (assumes 16x9)
233 CPictureScalingAlgorithm::Algorithm m_imageScalingAlgorithm;
234 unsigned int
235 m_imageQualityJpeg; ///< \brief the stored jpeg quality the lower the better (default: 4)
237 int m_sambaclienttimeout;
238 std::string m_sambadoscodepage;
239 bool m_sambastatfiles;
241 bool m_bHTTPDirectoryStatFilesize;
243 bool m_bFTPThumbs;
244 bool m_bShoutcastArt;
246 std::string m_musicThumbs;
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 bool m_bMusicLibraryArtistNavigatesToSongs;
255 std::string m_strMusicLibraryAlbumFormat;
256 bool m_prioritiseAPEv2tags;
257 std::string m_musicItemSeparator;
258 std::vector<std::string> m_musicArtistSeparators;
259 std::string m_videoItemSeparator;
260 std::vector<std::string> m_musicTagsFromFileFilters;
262 bool m_bVideoLibraryAllItemsOnBottom;
263 int m_iVideoLibraryRecentlyAddedItems;
264 bool m_bVideoLibraryCleanOnUpdate;
265 bool m_bVideoLibraryUseFastHash;
266 bool m_bVideoLibraryImportWatchedState{true};
267 bool m_bVideoLibraryImportResumePoint{true};
269 bool m_bVideoScannerIgnoreErrors;
270 int m_iVideoLibraryDateAdded;
272 std::set<std::string> m_vecTokens;
274 int m_iEpgUpdateCheckInterval; // seconds
275 int m_iEpgCleanupInterval; // seconds
276 int m_iEpgActiveTagCheckInterval; // seconds
277 int m_iEpgRetryInterruptedUpdateInterval; // seconds
278 int m_iEpgUpdateEmptyTagsInterval; // seconds
279 bool m_bEpgDisplayUpdatePopup;
280 bool m_bEpgDisplayIncrementalUpdatePopup;
282 // EDL Commercial Break
283 bool m_bEdlMergeShortCommBreaks;
284 /*!< @brief If GUI notifications should be shown when reaching the start of commercial breaks */
285 bool m_EdlDisplayCommbreakNotifications;
286 int m_iEdlMaxCommBreakLength; // seconds
287 int m_iEdlMinCommBreakLength; // seconds
288 int m_iEdlMaxCommBreakGap; // seconds
289 int m_iEdlMaxStartGap; // seconds
290 int m_iEdlCommBreakAutowait; // seconds
291 int m_iEdlCommBreakAutowind; // seconds
293 int m_curlconnecttimeout;
294 int m_curllowspeedtime;
295 int m_curlretries;
296 int m_curlKeepAliveInterval; // seconds
297 bool m_curlDisableIPV6;
298 bool m_curlDisableHTTP2;
300 std::string m_caTrustFile;
302 bool m_minimizeToTray; /* win32 only */
303 bool m_fullScreen;
304 bool m_startFullScreen;
305 bool m_showExitButton; /* Ideal for appliances to hide a 'useless' button */
306 bool m_canWindowed;
307 bool m_splashImage;
308 bool m_alwaysOnTop; /* makes xbmc to run always on top .. osx/win32 only .. */
309 int m_playlistRetries;
310 int m_playlistTimeout;
311 bool m_GLRectangleHack;
312 int m_iSkipLoopFilter;
314 bool m_bVirtualShares;
316 std::string m_cpuTempCmd;
317 std::string m_gpuTempCmd;
319 /* PVR/TV related advanced settings */
320 int m_iPVRTimeCorrection; /*!< @brief correct all times (epg tags, timer tags, recording tags) by this amount of minutes. defaults to 0. */
321 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. */
322 bool m_bPVRChannelIconsAutoScan; /*!< @brief automatically scan user defined folder for channel icons when loading internal channel groups */
323 bool m_bPVRAutoScanIconsUserSet; /*!< @brief mark channel icons populated by auto scan as "user set" */
324 uint32_t
325 m_iPVRNumericChannelSwitchTimeout; /*!< @brief time in msecs after that a channel switch occurs after entering a channel number, if confirmchannelswitch is disabled */
326 int m_iPVRTimeshiftThreshold; /*!< @brief time diff between current playing time and timeshift buffer end, in seconds, before a playing stream is displayed as timeshifting. */
327 bool m_bPVRTimeshiftSimpleOSD; /*!< @brief use simple timeshift OSD (with progress only for the playing event instead of progress for the whole ts buffer). */
328 SortDescription m_PVRDefaultSortOrder; /*!< @brief SortDecription used to store default recording sort type and sort order */
330 DatabaseSettings m_databaseMusic; // advanced music database setup
331 DatabaseSettings m_databaseVideo; // advanced video database setup
332 DatabaseSettings m_databaseTV; // advanced tv database setup
333 DatabaseSettings m_databaseEpg; /*!< advanced EPG database setup */
335 bool m_useLocaleCollation;
337 bool m_guiVisualizeDirtyRegions;
338 int m_guiAlgorithmDirtyRegions;
339 bool m_guiSmartRedraw;
340 int32_t m_guiAnisotropicFiltering{0};
341 bool m_guiFrontToBackRendering{false};
342 bool m_guiGeometryClear{true};
343 bool m_guiAsyncTextureUpload{false};
344 bool m_guiVideoLayoutTransparent{false};
346 unsigned int m_addonPackageFolderSize;
348 bool m_jsonOutputCompact;
349 unsigned int m_jsonTcpPort;
351 bool m_enableMultimediaKeys;
352 std::vector<std::string> m_settingsFiles;
353 void ParseSettingsFile(const std::string &file);
355 float GetLatencyTweak(float refreshrate, bool isHDREnabled);
356 bool m_initialized;
358 void SetDebugMode(bool debug);
360 //! \brief Toggles dirty-region visualization
361 void ToggleDirtyRegionVisualization()
363 m_guiVisualizeDirtyRegions = !m_guiVisualizeDirtyRegions;
366 // runtime settings which cannot be set from advancedsettings.xml
367 std::string m_videoExtensions;
368 std::string m_discStubExtensions;
369 std::string m_subtitlesExtensions;
370 std::string m_musicExtensions;
371 std::string m_pictureExtensions;
373 std::string m_stereoscopicregex_3d;
374 std::string m_stereoscopicregex_sbs;
375 std::string m_stereoscopicregex_tab;
377 bool m_openGlDebugging;
379 std::string m_userAgent;
380 uint32_t m_nfsTimeout;
381 int m_nfsRetries;
383 private:
384 void Initialize();
385 void Clear();
386 void SetExtraArtwork(const TiXmlElement* arttypes, std::vector<std::string>& artworkMap);