3 * Copyright (C) 2005-2013 Team XBMC
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)
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.
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/>.
24 #include "settings/lib/ISettingCallback.h"
25 #include "settings/lib/ISettingsHandler.h"
26 #include "utils/StdString.h"
27 #include "utils/GlobalsHandling.h"
35 class DatabaseSettings
70 TVShowRegexp(bool d, const CStdString& r, int s = 1)
78 struct RefreshOverride
90 struct RefreshVideoLatency
98 struct StagefrightConfig
109 typedef std::vector<TVShowRegexp> SETTINGS_TVSHOWLIST;
111 class CAdvancedSettings : public ISettingCallback, public ISettingsHandler
116 static CAdvancedSettings* getInstance();
118 virtual void OnSettingsLoaded();
119 virtual void OnSettingsUnloaded();
121 virtual void OnSettingChanged(const CSetting *setting);
123 virtual void OnSettingAction(const CSetting *setting);
126 bool Initialized() { return m_initialized; };
127 void AddSettingsFile(const CStdString &filename);
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);
138 CStdString m_audioDefaultPlayer;
139 float m_audioPlayCountMinimumPercent;
140 bool m_dvdplayerIgnoreDTSinWAV;
142 float m_limiterRelease;
144 bool m_omxHWAudioDecode;
145 bool m_omxDecodeStartWithValidFrame;
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;
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;
198 CStdString m_videoDefaultPlayer;
199 CStdString m_videoDefaultDVDPlayer;
200 float m_videoPlayCountMinimumPercent;
202 float m_slideshowBlackBarCompensation;
203 float m_slideshowZoomAmount;
204 float m_slideshowPanAmount;
206 int m_songInfoDuration;
209 int m_extraLogLevels;
210 CStdString m_cddbAddress;
213 bool m_logEnableAirtunes;
217 bool m_handleMounting;
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;
239 bool m_playlistAsFolders;
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
247 unsigned int GetThumbSize() const { return m_imageRes / 2; };
250 int m_sambaclienttimeout;
251 CStdString m_sambadoscodepage;
252 bool m_sambastatfiles;
254 bool m_bHTTPDirectoryStatFilesize;
258 CStdString m_musicThumbs;
259 CStdString m_fanartImages;
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;
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;
282 bool m_bVideoScannerIgnoreErrors;
283 int m_iVideoLibraryDateAdded;
285 std::vector<CStdString> m_vecTokens; // cleaning strings tied to language
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;
299 int m_iMythMovieLength; // minutes
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;
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
319 int m_curlconnecttimeout;
320 int m_curllowspeedtime;
322 bool m_curlDisableIPV6;
325 bool m_startFullScreen;
326 bool m_showExitButton; /* Ideal for appliances to hide a 'useless' button */
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 */
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;
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
353 CStdString m_cpuTempCmd;
354 CStdString m_gpuTempCmd;
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 */
366 bool m_measureRefreshrate; //when true the videoreferenceclock will measure the refreshrate when direct3d is used
367 //otherwise it will use the windows refreshrate
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 */
374 bool m_guiVisualizeDirtyRegions;
375 int m_guiAlgorithmDirtyRegions;
376 int m_guiDirtyRegionNoFlipTimeout;
377 unsigned int m_addonPackageFolderSize;
379 unsigned int m_cacheMemBufferSize;
380 unsigned int m_networkBufferMode;
381 float m_readBufferFactor;
383 bool m_jsonOutputCompact;
384 unsigned int m_jsonTcpPort;
386 bool m_enableMultimediaKeys;
387 std::vector<CStdString> m_settingsFiles;
388 void ParseSettingsFile(const CStdString &file);
390 float GetDisplayLatency(float refreshrate);
393 void SetDebugMode(bool debug);
394 void SetExtraLogsFromAddon(ADDON::IAddon* addon);
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;
403 CStdString m_stereoscopicregex_3d;
404 CStdString m_stereoscopicregex_sbs;
405 CStdString m_stereoscopicregex_tab;
407 CStdString m_logFolder;
409 CStdString m_userAgent;
412 XBMC_GLOBAL(CAdvancedSettings,g_advancedSettings);