Remove LiveTV menu.
[vuplus_xbmc] / xbmc / settings / AdvancedSettings.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 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, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include <vector>
23
24 #include "settings/lib/ISettingCallback.h"
25 #include "settings/lib/ISettingsHandler.h"
26 #include "utils/StdString.h"
27 #include "utils/GlobalsHandling.h"
28
29 class TiXmlElement;
30 namespace ADDON
31 {
32   class IAddon;
33 }
34
35 class DatabaseSettings
36 {
37 public:
38   void Reset()
39   {
40     type.clear();
41     host.clear();
42     port.clear();
43     user.clear();
44     pass.clear();
45     name.clear();
46     key.clear();
47     cert.clear();
48     ca.clear();
49     capath.clear();
50     ciphers.clear();
51   };
52   CStdString type;
53   CStdString host;
54   CStdString port;
55   CStdString user;
56   CStdString pass;
57   CStdString name;
58   CStdString key;
59   CStdString cert;
60   CStdString ca;
61   CStdString capath;
62   CStdString ciphers;
63 };
64
65 struct TVShowRegexp
66 {
67   bool byDate;
68   CStdString regexp;
69   int defaultSeason;
70   TVShowRegexp(bool d, const CStdString& r, int s = 1)
71   {
72     byDate = d;
73     regexp = r;
74     defaultSeason = s;
75   }
76 };
77
78 struct RefreshOverride
79 {
80   float fpsmin;
81   float fpsmax;
82
83   float refreshmin;
84   float refreshmax;
85
86   bool  fallback;
87 };
88
89
90 struct RefreshVideoLatency
91 {
92   float refreshmin;
93   float refreshmax;
94
95   float delay;
96 };
97
98 struct StagefrightConfig
99 {
100   int useAVCcodec;
101   int useVC1codec;
102   int useVPXcodec;
103   int useMP4codec;
104   int useMPEG2codec;
105   bool useSwRenderer;
106   bool useInputDTS;
107 };
108
109 typedef std::vector<TVShowRegexp> SETTINGS_TVSHOWLIST;
110
111 class CAdvancedSettings : public ISettingCallback, public ISettingsHandler
112 {
113   public:
114     CAdvancedSettings();
115
116     static CAdvancedSettings* getInstance();
117
118     virtual void OnSettingsLoaded();
119     virtual void OnSettingsUnloaded();
120
121     virtual void OnSettingChanged(const CSetting *setting);
122
123     virtual void OnSettingAction(const CSetting *setting);
124
125     void Initialize();
126     bool Initialized() { return m_initialized; };
127     void AddSettingsFile(const CStdString &filename);
128     bool Load();
129     void Clear();
130
131     static void GetCustomTVRegexps(TiXmlElement *pRootElement, SETTINGS_TVSHOWLIST& settings);
132     static void GetCustomRegexps(TiXmlElement *pRootElement, CStdStringArray& settings);
133     static void GetCustomRegexpReplacers(TiXmlElement *pRootElement, CStdStringArray& settings);
134     static void GetCustomExtensions(TiXmlElement *pRootElement, CStdString& extensions);
135
136     int m_audioHeadRoom;
137     float m_ac3Gain;
138     CStdString m_audioDefaultPlayer;
139     float m_audioPlayCountMinimumPercent;
140     bool m_dvdplayerIgnoreDTSinWAV;
141     float m_limiterHold;
142     float m_limiterRelease;
143
144     bool  m_omxHWAudioDecode;
145     bool  m_omxDecodeStartWithValidFrame;
146
147     float m_videoSubsDelayRange;
148     float m_videoAudioDelayRange;
149     int m_videoSmallStepBackSeconds;
150     int m_videoSmallStepBackTries;
151     int m_videoSmallStepBackDelay;
152     bool m_videoUseTimeSeeking;
153     int m_videoTimeSeekForward;
154     int m_videoTimeSeekBackward;
155     int m_videoTimeSeekForwardBig;
156     int m_videoTimeSeekBackwardBig;
157     int m_videoPercentSeekForward;
158     int m_videoPercentSeekBackward;
159     int m_videoPercentSeekForwardBig;
160     int m_videoPercentSeekBackwardBig;
161     CStdString m_videoPPFFmpegDeint;
162     CStdString m_videoPPFFmpegPostProc;
163     bool m_videoVDPAUtelecine;
164     bool m_videoVDPAUdeintSkipChromaHD;
165     bool m_musicUseTimeSeeking;
166     int m_musicTimeSeekForward;
167     int m_musicTimeSeekBackward;
168     int m_musicTimeSeekForwardBig;
169     int m_musicTimeSeekBackwardBig;
170     int m_musicPercentSeekForward;
171     int m_musicPercentSeekBackward;
172     int m_musicPercentSeekForwardBig;
173     int m_musicPercentSeekBackwardBig;
174     int m_videoBlackBarColour;
175     int m_videoIgnoreSecondsAtStart;
176     float m_videoIgnorePercentAtEnd;
177     CStdString m_audioHost;
178     bool m_audioApplyDrc;
179
180     int   m_videoVDPAUScaling;
181     float m_videoNonLinStretchRatio;
182     bool  m_videoEnableHighQualityHwScalers;
183     float m_videoAutoScaleMaxFps;
184     std::vector<RefreshOverride> m_videoAdjustRefreshOverrides;
185     std::vector<RefreshVideoLatency> m_videoRefreshLatency;
186     float m_videoDefaultLatency;
187     bool m_videoDisableBackgroundDeinterlace;
188     int  m_videoCaptureUseOcclusionQuery;
189     bool m_DXVACheckCompatibility;
190     bool m_DXVACheckCompatibilityPresent;
191     bool m_DXVAForceProcessorRenderer;
192     bool m_DXVANoDeintProcForProgressive;
193     int  m_videoFpsDetect;
194     int  m_videoBusyDialogDelay_ms;
195     bool m_videoDisableHi10pMultithreading;
196     StagefrightConfig m_stagefrightConfig;
197
198     CStdString m_videoDefaultPlayer;
199     CStdString m_videoDefaultDVDPlayer;
200     float m_videoPlayCountMinimumPercent;
201
202     float m_slideshowBlackBarCompensation;
203     float m_slideshowZoomAmount;
204     float m_slideshowPanAmount;
205
206     int m_songInfoDuration;
207     int m_logLevel;
208     int m_logLevelHint;
209     int m_extraLogLevels;
210     CStdString m_cddbAddress;
211
212     //airtunes + airplay
213     bool m_logEnableAirtunes;
214     int m_airTunesPort;
215     int m_airPlayPort;
216
217     bool m_handleMounting;
218
219     bool m_fullScreenOnMovieStart;
220     CStdString m_cachePath;
221     CStdString m_videoCleanDateTimeRegExp;
222     CStdStringArray m_videoCleanStringRegExps;
223     CStdStringArray m_videoExcludeFromListingRegExps;
224     CStdStringArray m_moviesExcludeFromScanRegExps;
225     CStdStringArray m_tvshowExcludeFromScanRegExps;
226     CStdStringArray m_audioExcludeFromListingRegExps;
227     CStdStringArray m_audioExcludeFromScanRegExps;
228     CStdStringArray m_pictureExcludeFromListingRegExps;
229     CStdStringArray m_videoStackRegExps;
230     CStdStringArray m_folderStackRegExps;
231     CStdStringArray m_trailerMatchRegExps;
232     SETTINGS_TVSHOWLIST m_tvshowEnumRegExps;
233     CStdString m_tvshowMultiPartEnumRegExp;
234     typedef std::vector< std::pair<CStdString, CStdString> > StringMapping;
235     StringMapping m_pathSubstitutions;
236     int m_remoteDelay; ///< \brief number of remote messages to ignore before repeating
237     float m_controllerDeadzone;
238
239     bool m_playlistAsFolders;
240     bool m_detectAsUdf;
241
242     unsigned int m_fanartRes; ///< \brief the maximal resolution to cache fanart at (assumes 16x9)
243     unsigned int m_imageRes;  ///< \brief the maximal resolution to cache images at (assumes 16x9)
244     /*! \brief the maximal size to cache thumbs at, assuming square
245      Used for actual thumbs (eg bookmark thumbs, picture thumbs) rather than cover art which uses m_imageRes instead
246      */
247     unsigned int GetThumbSize() const { return m_imageRes / 2; };
248     bool m_useDDSFanart;
249
250     int m_sambaclienttimeout;
251     CStdString m_sambadoscodepage;
252     bool m_sambastatfiles;
253
254     bool m_bHTTPDirectoryStatFilesize;
255
256     bool m_bFTPThumbs;
257
258     CStdString m_musicThumbs;
259     CStdString m_fanartImages;
260
261     bool m_bMusicLibraryHideAllItems;
262     int m_iMusicLibraryRecentlyAddedItems;
263     bool m_bMusicLibraryAllItemsOnBottom;
264     bool m_bMusicLibraryAlbumsSortByArtistThenYear;
265     bool m_bMusicLibraryCleanOnUpdate;
266     CStdString m_strMusicLibraryAlbumFormat;
267     CStdString m_strMusicLibraryAlbumFormatRight;
268     bool m_prioritiseAPEv2tags;
269     CStdString m_musicItemSeparator;
270     CStdString m_videoItemSeparator;
271     std::vector<CStdString> m_musicTagsFromFileFilters;
272
273     bool m_bVideoLibraryHideAllItems;
274     bool m_bVideoLibraryAllItemsOnBottom;
275     int m_iVideoLibraryRecentlyAddedItems;
276     bool m_bVideoLibraryHideEmptySeries;
277     bool m_bVideoLibraryCleanOnUpdate;
278     bool m_bVideoLibraryExportAutoThumbs;
279     bool m_bVideoLibraryImportWatchedState;
280     bool m_bVideoLibraryImportResumePoint;
281
282     bool m_bVideoScannerIgnoreErrors;
283     int m_iVideoLibraryDateAdded;
284
285     std::vector<CStdString> m_vecTokens; // cleaning strings tied to language
286     //TuxBox
287     int m_iTuxBoxStreamtsPort;
288     bool m_bTuxBoxSubMenuSelection;
289     int m_iTuxBoxDefaultSubMenu;
290     int m_iTuxBoxDefaultRootMenu;
291     bool m_bTuxBoxAudioChannelSelection;
292     bool m_bTuxBoxPictureIcon;
293     int m_iTuxBoxEpgRequestTime;
294     int m_iTuxBoxZapWaitTime;
295     bool m_bTuxBoxSendAllAPids;
296     bool m_bTuxBoxZapstream;
297     int m_iTuxBoxZapstreamPort;
298
299     int m_iMythMovieLength;         // minutes
300
301     int m_iEpgLingerTime;           // minutes
302     int m_iEpgUpdateCheckInterval;  // seconds
303     int m_iEpgCleanupInterval;      // seconds
304     int m_iEpgActiveTagCheckInterval; // seconds
305     int m_iEpgRetryInterruptedUpdateInterval; // seconds
306     int m_iEpgUpdateEmptyTagsInterval; // seconds
307     bool m_bEpgDisplayUpdatePopup;
308     bool m_bEpgDisplayIncrementalUpdatePopup;
309
310     // EDL Commercial Break
311     bool m_bEdlMergeShortCommBreaks;
312     int m_iEdlMaxCommBreakLength;   // seconds
313     int m_iEdlMinCommBreakLength;   // seconds
314     int m_iEdlMaxCommBreakGap;      // seconds
315     int m_iEdlMaxStartGap;          // seconds
316     int m_iEdlCommBreakAutowait;    // seconds
317     int m_iEdlCommBreakAutowind;    // seconds
318
319     int m_curlconnecttimeout;
320     int m_curllowspeedtime;
321     int m_curlretries;
322     bool m_curlDisableIPV6;
323
324     bool m_fullScreen;
325     bool m_startFullScreen;
326     bool m_showExitButton; /* Ideal for appliances to hide a 'useless' button */
327     bool m_canWindowed;
328     bool m_splashImage;
329     bool m_alwaysOnTop;  /* makes xbmc to run always on top .. osx/win32 only .. */
330     int m_playlistRetries;
331     int m_playlistTimeout;
332     bool m_GLRectangleHack;
333     int m_iSkipLoopFilter;
334     float m_ForcedSwapTime; /* if nonzero, set's the explicit time in ms to allocate for buffer swap */
335
336     bool m_AllowD3D9Ex;
337     bool m_ForceD3D9Ex;
338     bool m_AllowDynamicTextures;
339     unsigned int m_RestrictCapsMask;
340     float m_sleepBeforeFlip; ///< if greather than zero, XBMC waits for raster to be this amount through the frame prior to calling the flip
341     bool m_bVirtualShares;
342
343     float m_karaokeSyncDelayCDG; // seems like different delay is needed for CDG and MP3s
344     float m_karaokeSyncDelayLRC;
345     bool m_karaokeChangeGenreForKaraokeSongs;
346     bool m_karaokeKeepDelay; // store user-changed song delay in the database
347     int m_karaokeStartIndex; // auto-assign numbering start from this value
348     bool m_karaokeAlwaysEmptyOnCdgs; // always have empty background on CDG files
349     bool m_karaokeUseSongSpecificBackground; // use song-specific video or image if available instead of default
350     CStdString m_karaokeDefaultBackgroundType; // empty string or "vis", "image" or "video"
351     CStdString m_karaokeDefaultBackgroundFilePath; // only for "image" or "video" types above
352
353     CStdString m_cpuTempCmd;
354     CStdString m_gpuTempCmd;
355
356     /* PVR/TV related advanced settings */
357     int m_iPVRTimeCorrection;     /*!< @brief correct all times (epg tags, timer tags, recording tags) by this amount of minutes. defaults to 0. */
358     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. */
359     int m_iPVRMinVideoCacheLevel;      /*!< @brief cache up to this level in the video buffer buffer before resuming playback if the buffers run dry */
360     int m_iPVRMinAudioCacheLevel;      /*!< @brief cache up to this level in the audio buffer before resuming playback if the buffers run dry */
361     bool m_bPVRCacheInDvdPlayer; /*!< @brief true to use "CACHESTATE_PVR" in CDVDPlayer (default) */
362     bool m_bPVRChannelIconsAutoScan; /*!< @brief automatically scan user defined folder for channel icons when loading internal channel groups */
363     bool m_bPVRAutoScanIconsUserSet; /*!< @brief mark channel icons populated by auto scan as "user set" */
364     int m_iPVRNumericChannelSwitchTimeout; /*!< @brief time in ms before the numeric dialog auto closes when confirmchannelswitch is disabled */
365
366     bool m_measureRefreshrate; //when true the videoreferenceclock will measure the refreshrate when direct3d is used
367                                //otherwise it will use the windows refreshrate
368
369     DatabaseSettings m_databaseMusic; // advanced music database setup
370     DatabaseSettings m_databaseVideo; // advanced video database setup
371     DatabaseSettings m_databaseTV;    // advanced tv database setup
372     DatabaseSettings m_databaseEpg;   /*!< advanced EPG database setup */
373
374     bool m_guiVisualizeDirtyRegions;
375     int  m_guiAlgorithmDirtyRegions;
376     int  m_guiDirtyRegionNoFlipTimeout;
377     unsigned int m_addonPackageFolderSize;
378
379     unsigned int m_cacheMemBufferSize;
380     unsigned int m_networkBufferMode;
381     float m_readBufferFactor;
382
383     bool m_jsonOutputCompact;
384     unsigned int m_jsonTcpPort;
385
386     bool m_enableMultimediaKeys;
387     std::vector<CStdString> m_settingsFiles;
388     void ParseSettingsFile(const CStdString &file);
389
390     float GetDisplayLatency(float refreshrate);
391     bool m_initialized;
392
393     void SetDebugMode(bool debug);
394     void SetExtraLogsFromAddon(ADDON::IAddon* addon);
395
396     // runtime settings which cannot be set from advancedsettings.xml
397     CStdString m_pictureExtensions;
398     CStdString m_musicExtensions;
399     CStdString m_videoExtensions;
400     CStdString m_discStubExtensions;
401     CStdString m_subtitlesExtensions;
402
403     CStdString m_stereoscopicregex_3d;
404     CStdString m_stereoscopicregex_sbs;
405     CStdString m_stereoscopicregex_tab;
406
407     CStdString m_logFolder;
408
409     CStdString m_userAgent;
410 };
411
412 XBMC_GLOBAL(CAdvancedSettings,g_advancedSettings);