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 bool m_videoAllowMpeg4VAAPI;
185 std::vector<RefreshOverride> m_videoAdjustRefreshOverrides;
186 std::vector<RefreshVideoLatency> m_videoRefreshLatency;
187 float m_videoDefaultLatency;
188 bool m_videoDisableBackgroundDeinterlace;
189 int m_videoCaptureUseOcclusionQuery;
190 bool m_DXVACheckCompatibility;
191 bool m_DXVACheckCompatibilityPresent;
192 bool m_DXVAForceProcessorRenderer;
193 bool m_DXVANoDeintProcForProgressive;
194 int m_videoFpsDetect;
195 int m_videoBusyDialogDelay_ms;
196 bool m_videoDisableHi10pMultithreading;
197 StagefrightConfig m_stagefrightConfig;
199 CStdString m_videoDefaultPlayer;
200 CStdString m_videoDefaultDVDPlayer;
201 float m_videoPlayCountMinimumPercent;
203 float m_slideshowBlackBarCompensation;
204 float m_slideshowZoomAmount;
205 float m_slideshowPanAmount;
207 int m_songInfoDuration;
210 int m_extraLogLevels;
211 CStdString m_cddbAddress;
214 bool m_logEnableAirtunes;
218 bool m_handleMounting;
220 bool m_fullScreenOnMovieStart;
221 CStdString m_cachePath;
222 CStdString m_videoCleanDateTimeRegExp;
223 CStdStringArray m_videoCleanStringRegExps;
224 CStdStringArray m_videoExcludeFromListingRegExps;
225 CStdStringArray m_moviesExcludeFromScanRegExps;
226 CStdStringArray m_tvshowExcludeFromScanRegExps;
227 CStdStringArray m_audioExcludeFromListingRegExps;
228 CStdStringArray m_audioExcludeFromScanRegExps;
229 CStdStringArray m_pictureExcludeFromListingRegExps;
230 CStdStringArray m_videoStackRegExps;
231 CStdStringArray m_folderStackRegExps;
232 CStdStringArray m_trailerMatchRegExps;
233 SETTINGS_TVSHOWLIST m_tvshowEnumRegExps;
234 CStdString m_tvshowMultiPartEnumRegExp;
235 typedef std::vector< std::pair<CStdString, CStdString> > StringMapping;
236 StringMapping m_pathSubstitutions;
237 int m_remoteDelay; ///< \brief number of remote messages to ignore before repeating
238 float m_controllerDeadzone;
240 bool m_playlistAsFolders;
243 unsigned int m_fanartRes; ///< \brief the maximal resolution to cache fanart at (assumes 16x9)
244 unsigned int m_imageRes; ///< \brief the maximal resolution to cache images at (assumes 16x9)
245 /*! \brief the maximal size to cache thumbs at, assuming square
246 Used for actual thumbs (eg bookmark thumbs, picture thumbs) rather than cover art which uses m_imageRes instead
248 unsigned int GetThumbSize() const { return m_imageRes / 2; };
251 int m_sambaclienttimeout;
252 CStdString m_sambadoscodepage;
253 bool m_sambastatfiles;
255 bool m_bHTTPDirectoryStatFilesize;
259 CStdString m_musicThumbs;
260 CStdString m_fanartImages;
262 bool m_bMusicLibraryHideAllItems;
263 int m_iMusicLibraryRecentlyAddedItems;
264 bool m_bMusicLibraryAllItemsOnBottom;
265 bool m_bMusicLibraryAlbumsSortByArtistThenYear;
266 bool m_bMusicLibraryCleanOnUpdate;
267 CStdString m_strMusicLibraryAlbumFormat;
268 CStdString m_strMusicLibraryAlbumFormatRight;
269 bool m_prioritiseAPEv2tags;
270 CStdString m_musicItemSeparator;
271 CStdString m_videoItemSeparator;
272 std::vector<CStdString> m_musicTagsFromFileFilters;
274 bool m_bVideoLibraryHideAllItems;
275 bool m_bVideoLibraryAllItemsOnBottom;
276 int m_iVideoLibraryRecentlyAddedItems;
277 bool m_bVideoLibraryHideEmptySeries;
278 bool m_bVideoLibraryCleanOnUpdate;
279 bool m_bVideoLibraryExportAutoThumbs;
280 bool m_bVideoLibraryImportWatchedState;
281 bool m_bVideoLibraryImportResumePoint;
283 bool m_bVideoScannerIgnoreErrors;
284 int m_iVideoLibraryDateAdded;
286 std::vector<CStdString> m_vecTokens; // cleaning strings tied to language
288 int m_iTuxBoxStreamtsPort;
289 bool m_bTuxBoxSubMenuSelection;
290 int m_iTuxBoxDefaultSubMenu;
291 int m_iTuxBoxDefaultRootMenu;
292 bool m_bTuxBoxAudioChannelSelection;
293 bool m_bTuxBoxPictureIcon;
294 int m_iTuxBoxEpgRequestTime;
295 int m_iTuxBoxZapWaitTime;
296 bool m_bTuxBoxSendAllAPids;
297 bool m_bTuxBoxZapstream;
298 int m_iTuxBoxZapstreamPort;
300 int m_iMythMovieLength; // minutes
302 int m_iEpgLingerTime; // minutes
303 int m_iEpgUpdateCheckInterval; // seconds
304 int m_iEpgCleanupInterval; // seconds
305 int m_iEpgActiveTagCheckInterval; // seconds
306 int m_iEpgRetryInterruptedUpdateInterval; // seconds
307 int m_iEpgUpdateEmptyTagsInterval; // seconds
308 bool m_bEpgDisplayUpdatePopup;
309 bool m_bEpgDisplayIncrementalUpdatePopup;
311 // EDL Commercial Break
312 bool m_bEdlMergeShortCommBreaks;
313 int m_iEdlMaxCommBreakLength; // seconds
314 int m_iEdlMinCommBreakLength; // seconds
315 int m_iEdlMaxCommBreakGap; // seconds
316 int m_iEdlMaxStartGap; // seconds
317 int m_iEdlCommBreakAutowait; // seconds
318 int m_iEdlCommBreakAutowind; // seconds
320 int m_curlconnecttimeout;
321 int m_curllowspeedtime;
323 bool m_curlDisableIPV6;
326 bool m_startFullScreen;
327 bool m_showExitButton; /* Ideal for appliances to hide a 'useless' button */
330 bool m_alwaysOnTop; /* makes xbmc to run always on top .. osx/win32 only .. */
331 int m_playlistRetries;
332 int m_playlistTimeout;
333 bool m_GLRectangleHack;
334 int m_iSkipLoopFilter;
335 float m_ForcedSwapTime; /* if nonzero, set's the explicit time in ms to allocate for buffer swap */
339 bool m_AllowDynamicTextures;
340 unsigned int m_RestrictCapsMask;
341 float m_sleepBeforeFlip; ///< if greather than zero, XBMC waits for raster to be this amount through the frame prior to calling the flip
342 bool m_bVirtualShares;
344 float m_karaokeSyncDelayCDG; // seems like different delay is needed for CDG and MP3s
345 float m_karaokeSyncDelayLRC;
346 bool m_karaokeChangeGenreForKaraokeSongs;
347 bool m_karaokeKeepDelay; // store user-changed song delay in the database
348 int m_karaokeStartIndex; // auto-assign numbering start from this value
349 bool m_karaokeAlwaysEmptyOnCdgs; // always have empty background on CDG files
350 bool m_karaokeUseSongSpecificBackground; // use song-specific video or image if available instead of default
351 CStdString m_karaokeDefaultBackgroundType; // empty string or "vis", "image" or "video"
352 CStdString m_karaokeDefaultBackgroundFilePath; // only for "image" or "video" types above
354 CStdString m_cpuTempCmd;
355 CStdString m_gpuTempCmd;
357 /* PVR/TV related advanced settings */
358 int m_iPVRTimeCorrection; /*!< @brief correct all times (epg tags, timer tags, recording tags) by this amount of minutes. defaults to 0. */
359 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. */
360 int m_iPVRMinVideoCacheLevel; /*!< @brief cache up to this level in the video buffer buffer before resuming playback if the buffers run dry */
361 int m_iPVRMinAudioCacheLevel; /*!< @brief cache up to this level in the audio buffer before resuming playback if the buffers run dry */
362 bool m_bPVRCacheInDvdPlayer; /*!< @brief true to use "CACHESTATE_PVR" in CDVDPlayer (default) */
363 bool m_bPVRChannelIconsAutoScan; /*!< @brief automatically scan user defined folder for channel icons when loading internal channel groups */
364 bool m_bPVRAutoScanIconsUserSet; /*!< @brief mark channel icons populated by auto scan as "user set" */
365 int m_iPVRNumericChannelSwitchTimeout; /*!< @brief time in ms before the numeric dialog auto closes when confirmchannelswitch is disabled */
367 bool m_measureRefreshrate; //when true the videoreferenceclock will measure the refreshrate when direct3d is used
368 //otherwise it will use the windows refreshrate
370 DatabaseSettings m_databaseMusic; // advanced music database setup
371 DatabaseSettings m_databaseVideo; // advanced video database setup
372 DatabaseSettings m_databaseTV; // advanced tv database setup
373 DatabaseSettings m_databaseEpg; /*!< advanced EPG database setup */
375 bool m_guiVisualizeDirtyRegions;
376 int m_guiAlgorithmDirtyRegions;
377 int m_guiDirtyRegionNoFlipTimeout;
378 unsigned int m_addonPackageFolderSize;
380 unsigned int m_cacheMemBufferSize;
381 unsigned int m_networkBufferMode;
382 float m_readBufferFactor;
384 bool m_jsonOutputCompact;
385 unsigned int m_jsonTcpPort;
387 bool m_enableMultimediaKeys;
388 std::vector<CStdString> m_settingsFiles;
389 void ParseSettingsFile(const CStdString &file);
391 float GetDisplayLatency(float refreshrate);
394 void SetDebugMode(bool debug);
395 void SetExtraLogsFromAddon(ADDON::IAddon* addon);
397 // runtime settings which cannot be set from advancedsettings.xml
398 CStdString m_pictureExtensions;
399 CStdString m_musicExtensions;
400 CStdString m_videoExtensions;
401 CStdString m_discStubExtensions;
402 CStdString m_subtitlesExtensions;
404 CStdString m_stereoscopicflags_sbs;
405 CStdString m_stereoscopicflags_tab;
407 CStdString m_logFolder;
409 CStdString m_userAgent;
412 XBMC_GLOBAL(CAdvancedSettings,g_advancedSettings);