PageRenderTime 24ms CodeModel.GetById 2ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

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