strip added smb:// shares of their user/pass when adding, and instead store that...
[vuplus_xbmc] / xbmc / settings / AdvancedSettings.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2008 Team XBMC
4  *      http://xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, write to
18  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19  *  http://www.gnu.org/copyleft/gpl.html
20  *
21  */
22
23 #include <vector>
24 #include "utils/StdString.h"
25 #include "utils/GlobalsHandling.h"
26
27 class TiXmlElement;
28
29 class DatabaseSettings
30 {
31 public:
32   CStdString type;
33   CStdString host;
34   CStdString port;
35   CStdString user;
36   CStdString pass;
37   CStdString name;
38 };
39
40 struct TVShowRegexp
41 {
42   bool byDate;
43   CStdString regexp;
44   int defaultSeason;
45   TVShowRegexp(bool d, const CStdString& r, int s = 1)
46   {
47     byDate = d;
48     regexp = r;
49     defaultSeason = s;
50   }
51 };
52
53 struct RefreshOverride
54 {
55   float fpsmin;
56   float fpsmax;
57
58   float refreshmin;
59   float refreshmax;
60
61   bool  fallback;
62 };
63
64
65 struct RefreshVideoLatency
66 {
67   float refreshmin;
68   float refreshmax;
69
70   float delay;
71 };
72
73 typedef std::vector<TVShowRegexp> SETTINGS_TVSHOWLIST;
74
75 class CAdvancedSettings
76 {
77   public:
78     CAdvancedSettings();
79
80     static CAdvancedSettings* getInstance();
81
82     void Initialize();
83     bool Initialized() { return m_initialized; };
84     void AddSettingsFile(const CStdString &filename);
85     bool Load();
86     void Clear();
87
88     static void GetCustomTVRegexps(TiXmlElement *pRootElement, SETTINGS_TVSHOWLIST& settings);
89     static void GetCustomRegexps(TiXmlElement *pRootElement, CStdStringArray& settings);
90     static void GetCustomRegexpReplacers(TiXmlElement *pRootElement, CStdStringArray& settings);
91     static void GetCustomExtensions(TiXmlElement *pRootElement, CStdString& extensions);
92
93     int m_audioHeadRoom;
94     float m_ac3Gain;
95     CStdString m_audioDefaultPlayer;
96     float m_audioPlayCountMinimumPercent;
97     bool m_dvdplayerIgnoreDTSinWAV;
98     int m_audioResample;
99     bool m_allowTranscode44100;
100     bool m_audioForceDirectSound;
101     bool m_audioAudiophile;
102     bool m_allChannelStereo;
103     int m_audioSinkBufferDurationMsec;
104     CStdString m_audioTranscodeTo;
105     float m_limiterHold;
106     float m_limiterRelease;
107
108     float m_videoSubsDelayRange;
109     float m_videoAudioDelayRange;
110     int m_videoSmallStepBackSeconds;
111     int m_videoSmallStepBackTries;
112     int m_videoSmallStepBackDelay;
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     CStdString m_videoPPFFmpegDeint;
123     CStdString m_videoPPFFmpegPostProc;
124     bool m_musicUseTimeSeeking;
125     int m_musicTimeSeekForward;
126     int m_musicTimeSeekBackward;
127     int m_musicTimeSeekForwardBig;
128     int m_musicTimeSeekBackwardBig;
129     int m_musicPercentSeekForward;
130     int m_musicPercentSeekBackward;
131     int m_musicPercentSeekForwardBig;
132     int m_musicPercentSeekBackwardBig;
133     int m_videoBlackBarColour;
134     int m_videoIgnoreSecondsAtStart;
135     float m_videoIgnorePercentAtEnd;
136     CStdString m_audioHost;
137     bool m_audioApplyDrc;
138
139     bool  m_videoVDPAUScaling;
140     float m_videoNonLinStretchRatio;
141     bool  m_videoEnableHighQualityHwScalers;
142     float m_videoAutoScaleMaxFps;
143     bool  m_videoAllowMpeg4VDPAU;
144     bool  m_videoAllowMpeg4VAAPI;
145     std::vector<RefreshOverride> m_videoAdjustRefreshOverrides;
146     std::vector<RefreshVideoLatency> m_videoRefreshLatency;
147     float m_videoDefaultLatency;
148     bool m_videoDisableBackgroundDeinterlace;
149     int  m_videoCaptureUseOcclusionQuery;
150     bool m_DXVACheckCompatibility;
151     bool m_DXVACheckCompatibilityPresent;
152     bool m_DXVAForceProcessorRenderer;
153     bool m_DXVANoDeintProcForProgressive;
154     int  m_videoFpsDetect;
155
156     CStdString m_videoDefaultPlayer;
157     CStdString m_videoDefaultDVDPlayer;
158     float m_videoPlayCountMinimumPercent;
159
160     float m_slideshowBlackBarCompensation;
161     float m_slideshowZoomAmount;
162     float m_slideshowPanAmount;
163
164     bool m_lcdHeartbeat;
165     bool m_lcdDimOnScreenSave;
166     int m_lcdScrolldelay;
167     CStdString m_lcdHostName;
168
169     int m_autoDetectPingTime;
170
171     int m_songInfoDuration;
172     int m_busyDialogDelay;
173     int m_logLevel;
174     int m_logLevelHint;
175     CStdString m_cddbAddress;
176     
177     //airtunes + airplay
178     bool m_logEnableAirtunes;
179     int m_airTunesPort;
180     int m_airPlayPort;    
181
182     bool m_handleMounting;
183
184     bool m_fullScreenOnMovieStart;
185     CStdString m_cachePath;
186     CStdString m_videoCleanDateTimeRegExp;
187     CStdStringArray m_videoCleanStringRegExps;
188     CStdStringArray m_videoExcludeFromListingRegExps;
189     CStdStringArray m_moviesExcludeFromScanRegExps;
190     CStdStringArray m_tvshowExcludeFromScanRegExps;
191     CStdStringArray m_audioExcludeFromListingRegExps;
192     CStdStringArray m_audioExcludeFromScanRegExps;
193     CStdStringArray m_pictureExcludeFromListingRegExps;
194     CStdStringArray m_videoStackRegExps;
195     CStdStringArray m_folderStackRegExps;
196     CStdStringArray m_trailerMatchRegExps;
197     SETTINGS_TVSHOWLIST m_tvshowEnumRegExps;
198     CStdString m_tvshowMultiPartEnumRegExp;
199     typedef std::vector< std::pair<CStdString, CStdString> > StringMapping;
200     StringMapping m_pathSubstitutions;
201     int m_remoteDelay; ///< \brief number of remote messages to ignore before repeating
202     float m_controllerDeadzone;
203
204     bool m_playlistAsFolders;
205     bool m_detectAsUdf;
206
207     int m_fanartRes; ///< \brief the maximal resolution to cache fanart at (assumes 16x9)
208     int m_imageRes;  ///< \brief the maximal resolution to cache images at (assumes 16x9)
209     /*! \brief the maximal size to cache thumbs at, assuming square
210      Used for actual thumbs (eg bookmark thumbs, picture thumbs) rather than cover art which uses m_imageRes instead
211      */
212     unsigned int GetThumbSize() const { return m_imageRes / 2; };
213     bool m_useDDSFanart;
214
215     int m_sambaclienttimeout;
216     CStdString m_sambadoscodepage;
217     bool m_sambastatfiles;
218
219     bool m_bHTTPDirectoryStatFilesize;
220
221     bool m_bFTPThumbs;
222
223     CStdString m_musicThumbs;
224     CStdString m_dvdThumbs;
225     CStdString m_fanartImages;
226
227     bool m_bMusicLibraryHideAllItems;
228     int m_iMusicLibraryRecentlyAddedItems;
229     bool m_bMusicLibraryAllItemsOnBottom;
230     bool m_bMusicLibraryAlbumsSortByArtistThenYear;
231     CStdString m_strMusicLibraryAlbumFormat;
232     CStdString m_strMusicLibraryAlbumFormatRight;
233     bool m_prioritiseAPEv2tags;
234     CStdString m_musicItemSeparator;
235     CStdString m_videoItemSeparator;
236     std::vector<CStdString> m_musicTagsFromFileFilters;
237
238     bool m_bVideoLibraryHideAllItems;
239     bool m_bVideoLibraryAllItemsOnBottom;
240     int m_iVideoLibraryRecentlyAddedItems;
241     bool m_bVideoLibraryHideRecentlyAddedItems;
242     bool m_bVideoLibraryHideEmptySeries;
243     bool m_bVideoLibraryCleanOnUpdate;
244     bool m_bVideoLibraryExportAutoThumbs;
245     bool m_bVideoLibraryImportWatchedState;
246     bool m_bVideoLibraryImportResumePoint;
247
248     bool m_bVideoScannerIgnoreErrors;
249     int m_iVideoLibraryDateAdded;
250
251     std::vector<CStdString> m_vecTokens; // cleaning strings tied to language
252     //TuxBox
253     int m_iTuxBoxStreamtsPort;
254     bool m_bTuxBoxSubMenuSelection;
255     int m_iTuxBoxDefaultSubMenu;
256     int m_iTuxBoxDefaultRootMenu;
257     bool m_bTuxBoxAudioChannelSelection;
258     bool m_bTuxBoxPictureIcon;
259     int m_iTuxBoxEpgRequestTime;
260     int m_iTuxBoxZapWaitTime;
261     bool m_bTuxBoxSendAllAPids;
262     bool m_bTuxBoxZapstream;
263     int m_iTuxBoxZapstreamPort;
264
265     int m_iMythMovieLength;         // minutes
266
267     // EDL Commercial Break
268     bool m_bEdlMergeShortCommBreaks;
269     int m_iEdlMaxCommBreakLength;   // seconds
270     int m_iEdlMinCommBreakLength;   // seconds
271     int m_iEdlMaxCommBreakGap;      // seconds
272     int m_iEdlMaxStartGap;          // seconds
273     int m_iEdlCommBreakAutowait;    // seconds
274     int m_iEdlCommBreakAutowind;    // seconds
275
276     bool m_bFirstLoop;
277     int m_curlconnecttimeout;
278     int m_curllowspeedtime;
279     int m_curlretries;
280     bool m_curlDisableIPV6;
281
282     bool m_fullScreen;
283     bool m_startFullScreen;
284         bool m_showExitButton; /* Ideal for appliances to hide a 'useless' button */
285     bool m_canWindowed;
286     bool m_splashImage;
287     bool m_alwaysOnTop;  /* makes xbmc to run always on top .. osx/win32 only .. */
288     int m_playlistRetries;
289     int m_playlistTimeout;
290     bool m_GLRectangleHack;
291     int m_iSkipLoopFilter;
292     float m_ForcedSwapTime; /* if nonzero, set's the explicit time in ms to allocate for buffer swap */
293
294     bool m_AllowD3D9Ex;
295     bool m_ForceD3D9Ex;
296     bool m_AllowDynamicTextures;
297     unsigned int m_RestrictCapsMask;
298     float m_sleepBeforeFlip; ///< if greather than zero, XBMC waits for raster to be this amount through the frame prior to calling the flip
299     bool m_bVirtualShares;
300
301     float m_karaokeSyncDelayCDG; // seems like different delay is needed for CDG and MP3s
302     float m_karaokeSyncDelayLRC;
303     bool m_karaokeChangeGenreForKaraokeSongs;
304     bool m_karaokeKeepDelay; // store user-changed song delay in the database
305     int m_karaokeStartIndex; // auto-assign numbering start from this value
306     bool m_karaokeAlwaysEmptyOnCdgs; // always have empty background on CDG files
307     bool m_karaokeUseSongSpecificBackground; // use song-specific video or image if available instead of default
308     CStdString m_karaokeDefaultBackgroundType; // empty string or "vis", "image" or "video"
309     CStdString m_karaokeDefaultBackgroundFilePath; // only for "image" or "video" types above
310
311     CStdString m_cpuTempCmd;
312     CStdString m_gpuTempCmd;
313     int m_bgInfoLoaderMaxThreads;
314
315     bool m_measureRefreshrate; //when true the videoreferenceclock will measure the refreshrate when direct3d is used
316                                //otherwise it will use the windows refreshrate
317
318     DatabaseSettings m_databaseMusic; // advanced music database setup
319     DatabaseSettings m_databaseVideo; // advanced video database setup
320
321     bool m_guiVisualizeDirtyRegions;
322     int  m_guiAlgorithmDirtyRegions;
323     int  m_guiDirtyRegionNoFlipTimeout;
324
325     unsigned int m_cacheMemBufferSize;
326
327     bool m_jsonOutputCompact;
328     unsigned int m_jsonTcpPort;
329
330     bool m_enableMultimediaKeys;
331     std::vector<CStdString> m_settingsFiles;
332     void ParseSettingsFile(const CStdString &file);
333
334     float GetDisplayLatency(float refreshrate);
335     bool m_initialized;
336 };
337
338 XBMC_GLOBAL(CAdvancedSettings,g_advancedSettings);