/xbmc/settings/AdvancedSettings.h

http://github.com/xbmc/xbmc · C Header · 373 lines · 296 code · 62 blank · 15 comment · 0 complexity · 5193122d46738d30873ce8b1de16d6d4 MD5 · raw file

  1. /*
  2. * Copyright (C) 2005-2018 Team Kodi
  3. * This file is part of Kodi - https://kodi.tv
  4. *
  5. * SPDX-License-Identifier: GPL-2.0-or-later
  6. * See LICENSES/README.md for more information.
  7. */
  8. #pragma once
  9. #include "pictures/PictureScalingAlgorithm.h"
  10. #include "settings/lib/ISettingCallback.h"
  11. #include "settings/lib/ISettingsHandler.h"
  12. #include <set>
  13. #include <string>
  14. #include <utility>
  15. #include <vector>
  16. #define CACHE_BUFFER_MODE_INTERNET 0
  17. #define CACHE_BUFFER_MODE_ALL 1
  18. #define CACHE_BUFFER_MODE_TRUE_INTERNET 2
  19. #define CACHE_BUFFER_MODE_NONE 3
  20. #define CACHE_BUFFER_MODE_REMOTE 4
  21. class CAppParamParser;
  22. class CProfileManager;
  23. class CSettingsManager;
  24. class CVariant;
  25. struct IntegerSettingOption;
  26. class TiXmlElement;
  27. namespace ADDON
  28. {
  29. class IAddon;
  30. }
  31. class DatabaseSettings
  32. {
  33. public:
  34. DatabaseSettings() { Reset(); }
  35. void Reset()
  36. {
  37. type.clear();
  38. host.clear();
  39. port.clear();
  40. user.clear();
  41. pass.clear();
  42. name.clear();
  43. key.clear();
  44. cert.clear();
  45. ca.clear();
  46. capath.clear();
  47. ciphers.clear();
  48. compression = false;
  49. };
  50. std::string type;
  51. std::string host;
  52. std::string port;
  53. std::string user;
  54. std::string pass;
  55. std::string name;
  56. std::string key;
  57. std::string cert;
  58. std::string ca;
  59. std::string capath;
  60. std::string ciphers;
  61. bool compression;
  62. };
  63. struct TVShowRegexp
  64. {
  65. bool byDate;
  66. std::string regexp;
  67. int defaultSeason;
  68. TVShowRegexp(bool d, const std::string& r, int s = 1):
  69. regexp(r)
  70. {
  71. byDate = d;
  72. defaultSeason = s;
  73. }
  74. };
  75. struct RefreshOverride
  76. {
  77. float fpsmin;
  78. float fpsmax;
  79. float refreshmin;
  80. float refreshmax;
  81. bool fallback;
  82. };
  83. struct RefreshVideoLatency
  84. {
  85. float refreshmin;
  86. float refreshmax;
  87. float delay;
  88. };
  89. typedef std::vector<TVShowRegexp> SETTINGS_TVSHOWLIST;
  90. class CAdvancedSettings : public ISettingCallback, public ISettingsHandler
  91. {
  92. public:
  93. CAdvancedSettings();
  94. void OnSettingsLoaded() override;
  95. void OnSettingsUnloaded() override;
  96. void OnSettingChanged(std::shared_ptr<const CSetting> setting) override;
  97. void Initialize(const CAppParamParser &params, CSettingsManager& settingsMgr);
  98. void Uninitialize(CSettingsManager& settingsMgr);
  99. bool Initialized() const { return m_initialized; };
  100. void AddSettingsFile(const std::string &filename);
  101. bool Load(const CProfileManager &profileManager);
  102. static void GetCustomTVRegexps(TiXmlElement *pRootElement, SETTINGS_TVSHOWLIST& settings);
  103. static void GetCustomRegexps(TiXmlElement *pRootElement, std::vector<std::string> &settings);
  104. static void GetCustomExtensions(TiXmlElement *pRootElement, std::string& extensions);
  105. std::string m_audioDefaultPlayer;
  106. float m_audioPlayCountMinimumPercent;
  107. bool m_VideoPlayerIgnoreDTSinWAV;
  108. float m_limiterHold;
  109. float m_limiterRelease;
  110. bool m_omlSync = false;
  111. float m_videoSubsDelayRange;
  112. float m_videoAudioDelayRange;
  113. bool m_videoUseTimeSeeking;
  114. int m_videoTimeSeekForward;
  115. int m_videoTimeSeekBackward;
  116. int m_videoTimeSeekForwardBig;
  117. int m_videoTimeSeekBackwardBig;
  118. int m_videoPercentSeekForward;
  119. int m_videoPercentSeekBackward;
  120. int m_videoPercentSeekForwardBig;
  121. int m_videoPercentSeekBackwardBig;
  122. std::vector<int> m_seekSteps;
  123. std::string m_videoPPFFmpegPostProc;
  124. bool m_videoVDPAUtelecine;
  125. bool m_videoVDPAUdeintSkipChromaHD;
  126. bool m_musicUseTimeSeeking;
  127. int m_musicTimeSeekForward;
  128. int m_musicTimeSeekBackward;
  129. int m_musicTimeSeekForwardBig;
  130. int m_musicTimeSeekBackwardBig;
  131. int m_musicPercentSeekForward;
  132. int m_musicPercentSeekBackward;
  133. int m_musicPercentSeekForwardBig;
  134. int m_musicPercentSeekBackwardBig;
  135. int m_videoIgnoreSecondsAtStart;
  136. float m_videoIgnorePercentAtEnd;
  137. float m_audioApplyDrc;
  138. int m_videoVDPAUScaling;
  139. float m_videoNonLinStretchRatio;
  140. bool m_videoEnableHighQualityHwScalers;
  141. float m_videoAutoScaleMaxFps;
  142. std::vector<RefreshOverride> m_videoAdjustRefreshOverrides;
  143. std::vector<RefreshVideoLatency> m_videoRefreshLatency;
  144. float m_videoDefaultLatency;
  145. int m_videoCaptureUseOcclusionQuery;
  146. bool m_DXVACheckCompatibility;
  147. bool m_DXVACheckCompatibilityPresent;
  148. int m_videoFpsDetect;
  149. float m_maxTempo;
  150. bool m_videoPreferStereoStream = false;
  151. std::string m_videoDefaultPlayer;
  152. float m_videoPlayCountMinimumPercent;
  153. float m_slideshowBlackBarCompensation;
  154. float m_slideshowZoomAmount;
  155. float m_slideshowPanAmount;
  156. int m_songInfoDuration;
  157. int m_logLevel;
  158. int m_logLevelHint;
  159. std::string m_cddbAddress;
  160. bool m_addSourceOnTop; //!< True to put 'add source' buttons on top
  161. //airtunes + airplay
  162. int m_airTunesPort;
  163. int m_airPlayPort;
  164. bool m_handleMounting;
  165. bool m_fullScreenOnMovieStart;
  166. std::string m_cachePath;
  167. std::string m_videoCleanDateTimeRegExp;
  168. std::vector<std::string> m_videoCleanStringRegExps;
  169. std::vector<std::string> m_videoExcludeFromListingRegExps;
  170. std::vector<std::string> m_allExcludeFromScanRegExps;
  171. std::vector<std::string> m_moviesExcludeFromScanRegExps;
  172. std::vector<std::string> m_tvshowExcludeFromScanRegExps;
  173. std::vector<std::string> m_audioExcludeFromListingRegExps;
  174. std::vector<std::string> m_audioExcludeFromScanRegExps;
  175. std::vector<std::string> m_pictureExcludeFromListingRegExps;
  176. std::vector<std::string> m_videoStackRegExps;
  177. std::vector<std::string> m_folderStackRegExps;
  178. std::vector<std::string> m_trailerMatchRegExps;
  179. SETTINGS_TVSHOWLIST m_tvshowEnumRegExps;
  180. std::string m_tvshowMultiPartEnumRegExp;
  181. typedef std::vector< std::pair<std::string, std::string> > StringMapping;
  182. StringMapping m_pathSubstitutions;
  183. int m_remoteDelay; ///< \brief number of remote messages to ignore before repeating
  184. bool m_bScanIRServer;
  185. bool m_playlistAsFolders;
  186. bool m_detectAsUdf;
  187. unsigned int m_fanartRes; ///< \brief the maximal resolution to cache fanart at (assumes 16x9)
  188. unsigned int m_imageRes; ///< \brief the maximal resolution to cache images at (assumes 16x9)
  189. CPictureScalingAlgorithm::Algorithm m_imageScalingAlgorithm;
  190. int m_sambaclienttimeout;
  191. std::string m_sambadoscodepage;
  192. bool m_sambastatfiles;
  193. bool m_bHTTPDirectoryStatFilesize;
  194. bool m_bFTPThumbs;
  195. std::string m_musicThumbs;
  196. std::string m_fanartImages;
  197. std::vector<std::string> m_musicArtistExtraArt;
  198. std::vector<std::string> m_musicAlbumExtraArt;
  199. int m_iMusicLibraryRecentlyAddedItems;
  200. int m_iMusicLibraryDateAdded;
  201. bool m_bMusicLibraryAllItemsOnBottom;
  202. bool m_bMusicLibraryCleanOnUpdate;
  203. bool m_bMusicLibraryArtistSortOnUpdate;
  204. bool m_bMusicLibraryUseISODates;
  205. std::string m_strMusicLibraryAlbumFormat;
  206. bool m_prioritiseAPEv2tags;
  207. std::string m_musicItemSeparator;
  208. std::vector<std::string> m_musicArtistSeparators;
  209. std::string m_videoItemSeparator;
  210. std::vector<std::string> m_musicTagsFromFileFilters;
  211. bool m_bVideoLibraryAllItemsOnBottom;
  212. int m_iVideoLibraryRecentlyAddedItems;
  213. bool m_bVideoLibraryCleanOnUpdate;
  214. bool m_bVideoLibraryUseFastHash;
  215. bool m_bVideoLibraryImportWatchedState;
  216. bool m_bVideoLibraryImportResumePoint;
  217. std::vector<std::string> m_videoEpisodeExtraArt;
  218. std::vector<std::string> m_videoTvShowExtraArt;
  219. std::vector<std::string> m_videoTvSeasonExtraArt;
  220. std::vector<std::string> m_videoMovieExtraArt;
  221. std::vector<std::string> m_videoMovieSetExtraArt;
  222. std::vector<std::string> m_videoMusicVideoExtraArt;
  223. bool m_bVideoScannerIgnoreErrors;
  224. int m_iVideoLibraryDateAdded;
  225. std::set<std::string> m_vecTokens;
  226. int m_iEpgUpdateCheckInterval; // seconds
  227. int m_iEpgCleanupInterval; // seconds
  228. int m_iEpgActiveTagCheckInterval; // seconds
  229. int m_iEpgRetryInterruptedUpdateInterval; // seconds
  230. int m_iEpgUpdateEmptyTagsInterval; // seconds
  231. bool m_bEpgDisplayUpdatePopup;
  232. bool m_bEpgDisplayIncrementalUpdatePopup;
  233. // EDL Commercial Break
  234. bool m_bEdlMergeShortCommBreaks;
  235. int m_iEdlMaxCommBreakLength; // seconds
  236. int m_iEdlMinCommBreakLength; // seconds
  237. int m_iEdlMaxCommBreakGap; // seconds
  238. int m_iEdlMaxStartGap; // seconds
  239. int m_iEdlCommBreakAutowait; // seconds
  240. int m_iEdlCommBreakAutowind; // seconds
  241. int m_curlconnecttimeout;
  242. int m_curllowspeedtime;
  243. int m_curlretries;
  244. bool m_curlDisableIPV6;
  245. bool m_curlDisableHTTP2;
  246. bool m_fullScreen;
  247. bool m_startFullScreen;
  248. bool m_showExitButton; /* Ideal for appliances to hide a 'useless' button */
  249. bool m_canWindowed;
  250. bool m_splashImage;
  251. bool m_alwaysOnTop; /* makes xbmc to run always on top .. osx/win32 only .. */
  252. int m_playlistRetries;
  253. int m_playlistTimeout;
  254. bool m_GLRectangleHack;
  255. int m_iSkipLoopFilter;
  256. bool m_bVirtualShares;
  257. bool m_bTry10bitOutput;
  258. std::string m_cpuTempCmd;
  259. std::string m_gpuTempCmd;
  260. /* PVR/TV related advanced settings */
  261. int m_iPVRTimeCorrection; /*!< @brief correct all times (epg tags, timer tags, recording tags) by this amount of minutes. defaults to 0. */
  262. 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. */
  263. bool m_bPVRChannelIconsAutoScan; /*!< @brief automatically scan user defined folder for channel icons when loading internal channel groups */
  264. bool m_bPVRAutoScanIconsUserSet; /*!< @brief mark channel icons populated by auto scan as "user set" */
  265. int m_iPVRNumericChannelSwitchTimeout; /*!< @brief time in msecs after that a channel switch occurs after entering a channel number, if confirmchannelswitch is disabled */
  266. int m_iPVRTimeshiftThreshold; /*!< @brief time diff between current playing time and timeshift buffer end, in seconds, before a playing stream is displayed as timeshifting. */
  267. bool m_bPVRTimeshiftSimpleOSD; /*!< @brief use simple timeshift OSD (with progress only for the playing event instead of progress for the whole ts buffer). */
  268. DatabaseSettings m_databaseMusic; // advanced music database setup
  269. DatabaseSettings m_databaseVideo; // advanced video database setup
  270. DatabaseSettings m_databaseTV; // advanced tv database setup
  271. DatabaseSettings m_databaseEpg; /*!< advanced EPG database setup */
  272. bool m_useLocaleCollation;
  273. bool m_guiVisualizeDirtyRegions;
  274. int m_guiAlgorithmDirtyRegions;
  275. bool m_guiSmartRedraw;
  276. unsigned int m_addonPackageFolderSize;
  277. unsigned int m_cacheMemSize;
  278. unsigned int m_cacheBufferMode;
  279. unsigned int m_cacheChunkSize;
  280. float m_cacheReadFactor;
  281. bool m_jsonOutputCompact;
  282. unsigned int m_jsonTcpPort;
  283. bool m_enableMultimediaKeys;
  284. std::vector<std::string> m_settingsFiles;
  285. void ParseSettingsFile(const std::string &file);
  286. float GetLatencyTweak(float refreshrate);
  287. bool m_initialized;
  288. void SetDebugMode(bool debug);
  289. //! \brief Toggles dirty-region visualization
  290. void ToggleDirtyRegionVisualization() { m_guiVisualizeDirtyRegions = !m_guiVisualizeDirtyRegions; };
  291. // runtime settings which cannot be set from advancedsettings.xml
  292. std::string m_videoExtensions;
  293. std::string m_discStubExtensions;
  294. std::string m_subtitlesExtensions;
  295. std::string m_musicExtensions;
  296. std::string m_pictureExtensions;
  297. std::string m_stereoscopicregex_3d;
  298. std::string m_stereoscopicregex_sbs;
  299. std::string m_stereoscopicregex_tab;
  300. bool m_allowUseSeparateDeviceForDecoding;
  301. /*!< @brief position behavior of ass subtitles when setting "subtitle position on screen" set to "fixed"
  302. True to show at the fixed position set in video calibration
  303. False to show at the bottom of video (default) */
  304. bool m_videoAssFixedWorks;
  305. bool m_openGlDebugging;
  306. std::string m_userAgent;
  307. private:
  308. void Initialize();
  309. void Clear();
  310. void SetExtraArtwork(const TiXmlElement* arttypes, std::vector<std::string>& artworkMap);
  311. };