diff options
author | montellese <montellese@xbmc.org> | 2013-03-14 00:09:19 +0100 |
---|---|---|
committer | montellese <montellese@xbmc.org> | 2013-04-01 22:26:51 +0200 |
commit | 7ab38600d6ccdcdf923e164ab3b8b2eb3e2c075a (patch) | |
tree | 76184bc7dce1dcef8a9090ce3057c799758575ad | |
parent | 5f5c8b8dedb6bec2e4ad3aa12c0afe2866ef3e5b (diff) |
settings: move watched and video settings into CMediaSettings
36 files changed, 713 insertions, 531 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 9ade0e8a98..93ad9655dc 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -95,6 +95,7 @@ #include "powermanagement/DPMSSupport.h" #include "settings/Settings.h" #include "settings/AdvancedSettings.h" +#include "settings/MediaSettings.h" #include "settings/MediaSourceSettings.h" #include "settings/SkinSettings.h" #include "guilib/LocalizeStrings.h" @@ -715,7 +716,8 @@ bool CApplication::Create() #ifdef HAS_UPNP g_settings.RegisterSettingsHandler(&CUPnPSettings::Get()); #endif - + + g_settings.RegisterSubSettings(&CMediaSettings::Get()); g_settings.RegisterSubSettings(&CSkinSettings::Get()); g_settings.RegisterSubSettings(&CViewStateSettings::Get()); @@ -3813,7 +3815,7 @@ bool CApplication::PlayStack(const CFileItem& item, bool bRestart) CVideoDatabase dbs; if (dbs.Open()) { - dbs.GetVideoSettings(item.GetPath(), g_settings.m_currentVideoSettings); + dbs.GetVideoSettings(item.GetPath(), CMediaSettings::Get().GetCurrentVideoSettings()); haveTimes = dbs.GetStackTimes(item.GetPath(), times); dbs.Close(); } @@ -3896,7 +3898,7 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart) OutputDebugString("new file set audiostream:0\n"); // Switch to default options - g_settings.m_currentVideoSettings = g_settings.m_defaultVideoSettings; + CMediaSettings::Get().GetCurrentVideoSettings() = CMediaSettings::Get().GetDefaultVideoSettings(); // see if we have saved options in the database SetPlaySpeed(1); @@ -4018,7 +4020,7 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart) // open the d/b and retrieve the bookmarks for the current movie CVideoDatabase dbs; dbs.Open(); - dbs.GetVideoSettings(item.GetPath(), g_settings.m_currentVideoSettings); + dbs.GetVideoSettings(item.GetPath(), CMediaSettings::Get().GetCurrentVideoSettings()); if( item.m_lStartOffset == STARTOFFSET_RESUME ) { @@ -5387,13 +5389,13 @@ void CApplication::VolumeChanged() const int CApplication::GetSubtitleDelay() const { // converts subtitle delay to a percentage - return int(((float)(g_settings.m_currentVideoSettings.m_SubtitleDelay + g_advancedSettings.m_videoSubsDelayRange)) / (2 * g_advancedSettings.m_videoSubsDelayRange)*100.0f + 0.5f); + return int(((float)(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay + g_advancedSettings.m_videoSubsDelayRange)) / (2 * g_advancedSettings.m_videoSubsDelayRange)*100.0f + 0.5f); } int CApplication::GetAudioDelay() const { // converts audio delay to a percentage - return int(((float)(g_settings.m_currentVideoSettings.m_AudioDelay + g_advancedSettings.m_videoAudioDelayRange)) / (2 * g_advancedSettings.m_videoAudioDelayRange)*100.0f + 0.5f); + return int(((float)(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay + g_advancedSettings.m_videoAudioDelayRange)) / (2 * g_advancedSettings.m_videoAudioDelayRange)*100.0f + 0.5f); } void CApplication::SetPlaySpeed(int iSpeed) @@ -5796,11 +5798,11 @@ void CApplication::SaveCurrentFileSettings() if (m_itemCurrentFile->IsVideo() && !m_itemCurrentFile->IsPVRChannel()) { // save video settings - if (g_settings.m_currentVideoSettings != g_settings.m_defaultVideoSettings) + if (CMediaSettings::Get().GetCurrentVideoSettings() != CMediaSettings::Get().GetDefaultVideoSettings()) { CVideoDatabase dbs; dbs.Open(); - dbs.SetVideoSettings(m_itemCurrentFile->GetPath(), g_settings.m_currentVideoSettings); + dbs.SetVideoSettings(m_itemCurrentFile->GetPath(), CMediaSettings::Get().GetCurrentVideoSettings()); dbs.Close(); } } diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 70743c5516..3e1e8fda66 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -43,6 +43,7 @@ #include "windowing/WindowingFactory.h" #include "powermanagement/PowerManager.h" #include "settings/AdvancedSettings.h" +#include "settings/MediaSettings.h" #include "settings/Settings.h" #include "settings/SkinSettings.h" #include "guilib/LocalizeStrings.h" @@ -1273,10 +1274,10 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa strLabel.Format("%2.1f dB", CAEUtil::PercentToGain(g_settings.m_fVolumeLevel)); break; case PLAYER_SUBTITLE_DELAY: - strLabel.Format("%2.3f s", g_settings.m_currentVideoSettings.m_SubtitleDelay); + strLabel.Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); break; case PLAYER_AUDIO_DELAY: - strLabel.Format("%2.3f s", g_settings.m_currentVideoSettings.m_AudioDelay); + strLabel.Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); break; case PLAYER_CHAPTER: if(g_application.IsPlaying() && g_application.m_pPlayer) @@ -2639,7 +2640,7 @@ bool CGUIInfoManager::GetMultiInfoBool(const GUIInfo &info, int contextWindow, c { CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW); if (window) - bReturn = g_settings.GetWatchMode(((CGUIMediaWindow *)window)->CurrentDirectory().GetContent()) == VIDEO_SHOW_UNWATCHED; + bReturn = CMediaSettings::Get().GetWatchedMode(((CGUIMediaWindow *)window)->CurrentDirectory().GetContent()) == WatchedModeUnwatched; } } break; diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.cpp b/xbmc/cores/VideoRenderers/BaseRenderer.cpp index bd7850dad3..7090728e31 100644 --- a/xbmc/cores/VideoRenderers/BaseRenderer.cpp +++ b/xbmc/cores/VideoRenderers/BaseRenderer.cpp @@ -24,6 +24,7 @@ #include "BaseRenderer.h" #include "settings/Settings.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "guilib/GraphicContext.h" #include "guilib/GUIWindowManager.h" #include "utils/log.h" @@ -303,8 +304,8 @@ RESOLUTION CBaseRenderer::GetResolution() const float CBaseRenderer::GetAspectRatio() const { - float width = (float)m_sourceWidth - g_settings.m_currentVideoSettings.m_CropLeft - g_settings.m_currentVideoSettings.m_CropRight; - float height = (float)m_sourceHeight - g_settings.m_currentVideoSettings.m_CropTop - g_settings.m_currentVideoSettings.m_CropBottom; + float width = (float)m_sourceWidth - CMediaSettings::Get().GetCurrentVideoSettings().m_CropLeft - CMediaSettings::Get().GetCurrentVideoSettings().m_CropRight; + float height = (float)m_sourceHeight - CMediaSettings::Get().GetCurrentVideoSettings().m_CropTop - CMediaSettings::Get().GetCurrentVideoSettings().m_CropBottom; return m_sourceFrameRatio * width / height * m_sourceHeight / m_sourceWidth; } @@ -565,23 +566,23 @@ void CBaseRenderer::ManageDisplay() { const CRect view = g_graphicsContext.GetViewWindow(); - m_sourceRect.x1 = (float)g_settings.m_currentVideoSettings.m_CropLeft; - m_sourceRect.y1 = (float)g_settings.m_currentVideoSettings.m_CropTop; - m_sourceRect.x2 = (float)m_sourceWidth - g_settings.m_currentVideoSettings.m_CropRight; - m_sourceRect.y2 = (float)m_sourceHeight - g_settings.m_currentVideoSettings.m_CropBottom; + m_sourceRect.x1 = (float)CMediaSettings::Get().GetCurrentVideoSettings().m_CropLeft; + m_sourceRect.y1 = (float)CMediaSettings::Get().GetCurrentVideoSettings().m_CropTop; + m_sourceRect.x2 = (float)m_sourceWidth - CMediaSettings::Get().GetCurrentVideoSettings().m_CropRight; + m_sourceRect.y2 = (float)m_sourceHeight - CMediaSettings::Get().GetCurrentVideoSettings().m_CropBottom; CalcNormalDisplayRect(view.x1, view.y1, view.Width(), view.Height(), GetAspectRatio() * g_settings.m_fPixelRatio, g_settings.m_fZoomAmount, g_settings.m_fVerticalShift); } void CBaseRenderer::SetViewMode(int viewMode) { - if (viewMode < VIEW_MODE_NORMAL || viewMode > VIEW_MODE_CUSTOM) - viewMode = VIEW_MODE_NORMAL; + if (viewMode < ViewModeNormal || viewMode > ViewModeCustom) + viewMode = ViewModeNormal; if (m_iFlags & (CONF_FLAGS_FORMAT_SBS | CONF_FLAGS_FORMAT_TB)) - viewMode = VIEW_MODE_NORMAL; + viewMode = ViewModeNormal; - g_settings.m_currentVideoSettings.m_ViewMode = viewMode; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = viewMode; // get our calibrated full screen resolution RESOLUTION res = GetResolution(); @@ -596,7 +597,7 @@ void CBaseRenderer::SetViewMode(int viewMode) float sourceFrameRatio = GetAspectRatio(); bool is43 = (sourceFrameRatio < 8.f/(3.f*sqrt(3.f)) && - g_settings.m_currentVideoSettings.m_ViewMode == VIEW_MODE_NORMAL); + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeNormal); // Splitres scaling factor float xscale = (float)g_settings.m_ResInfo[res].iScreenWidth / (float)g_settings.m_ResInfo[res].iWidth; @@ -608,8 +609,8 @@ void CBaseRenderer::SetViewMode(int viewMode) g_settings.m_fVerticalShift = 0.0f; g_settings.m_bNonLinStretch = false; - if ( g_settings.m_currentVideoSettings.m_ViewMode == VIEW_MODE_ZOOM || - (is43 && g_guiSettings.GetInt("videoplayer.stretch43") == VIEW_MODE_ZOOM)) + if ( CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeZoom || + (is43 && g_guiSettings.GetInt("videoplayer.stretch43") == ViewModeZoom)) { // zoom image so no black bars g_settings.m_fPixelRatio = 1.0; // calculate the desired output ratio @@ -625,7 +626,7 @@ void CBaseRenderer::SetViewMode(int viewMode) g_settings.m_fZoomAmount = newHeight / screenHeight; } } - else if (g_settings.m_currentVideoSettings.m_ViewMode == VIEW_MODE_STRETCH_4x3) + else if (CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeStretch4x3) { // stretch image to 4:3 ratio g_settings.m_fZoomAmount = 1.0; if (res == RES_PAL_4x3 || res == RES_PAL60_4x3 || res == RES_NTSC_4x3 || res == RES_HDTV_480p_4x3) @@ -640,16 +641,16 @@ void CBaseRenderer::SetViewMode(int viewMode) g_settings.m_fPixelRatio = (4.0f / 3.0f) / sourceFrameRatio; } } - else if ( g_settings.m_currentVideoSettings.m_ViewMode == VIEW_MODE_WIDE_ZOOM || - (is43 && g_guiSettings.GetInt("videoplayer.stretch43") == VIEW_MODE_WIDE_ZOOM)) + else if ( CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeWideZoom || + (is43 && g_guiSettings.GetInt("videoplayer.stretch43") == ViewModeWideZoom)) { // super zoom float stretchAmount = (screenWidth / screenHeight) * g_settings.m_ResInfo[res].fPixelRatio / sourceFrameRatio; g_settings.m_fPixelRatio = pow(stretchAmount, float(2.0/3.0)); g_settings.m_fZoomAmount = pow(stretchAmount, float((stretchAmount < 1.0) ? -1.0/3.0 : 1.0/3.0)); g_settings.m_bNonLinStretch = true; } - else if ( g_settings.m_currentVideoSettings.m_ViewMode == VIEW_MODE_STRETCH_16x9 || - (is43 && g_guiSettings.GetInt("videoplayer.stretch43") == VIEW_MODE_STRETCH_16x9)) + else if ( CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeStretch16x9 || + (is43 && g_guiSettings.GetInt("videoplayer.stretch43") == ViewModeStretch16x9)) { // stretch image to 16:9 ratio g_settings.m_fZoomAmount = 1.0; if (res == RES_PAL_4x3 || res == RES_PAL60_4x3 || res == RES_NTSC_4x3 || res == RES_HDTV_480p_4x3) @@ -663,7 +664,7 @@ void CBaseRenderer::SetViewMode(int viewMode) g_settings.m_fPixelRatio = (screenWidth / screenHeight) * g_settings.m_ResInfo[res].fPixelRatio / sourceFrameRatio; } } - else if (g_settings.m_currentVideoSettings.m_ViewMode == VIEW_MODE_ORIGINAL) + else if (CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeOriginal) { // zoom image so that the height is the original size g_settings.m_fPixelRatio = 1.0; // get the size of the media file @@ -678,25 +679,25 @@ void CBaseRenderer::SetViewMode(int viewMode) newWidth = newHeight * outputFrameRatio; } // now work out the zoom amount so that no zoom is done - g_settings.m_fZoomAmount = (m_sourceHeight - g_settings.m_currentVideoSettings.m_CropTop - g_settings.m_currentVideoSettings.m_CropBottom) / newHeight; + g_settings.m_fZoomAmount = (m_sourceHeight - CMediaSettings::Get().GetCurrentVideoSettings().m_CropTop - CMediaSettings::Get().GetCurrentVideoSettings().m_CropBottom) / newHeight; } - else if (g_settings.m_currentVideoSettings.m_ViewMode == VIEW_MODE_CUSTOM) + else if (CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeCustom) { - g_settings.m_fZoomAmount = g_settings.m_currentVideoSettings.m_CustomZoomAmount; - g_settings.m_fPixelRatio = g_settings.m_currentVideoSettings.m_CustomPixelRatio; - g_settings.m_bNonLinStretch = g_settings.m_currentVideoSettings.m_CustomNonLinStretch; - g_settings.m_fVerticalShift = g_settings.m_currentVideoSettings.m_CustomVerticalShift; + g_settings.m_fZoomAmount = CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount; + g_settings.m_fPixelRatio = CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio; + g_settings.m_bNonLinStretch = CMediaSettings::Get().GetCurrentVideoSettings().m_CustomNonLinStretch; + g_settings.m_fVerticalShift = CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift; } - else // if (g_settings.m_currentVideoSettings.m_ViewMode == VIEW_MODE_NORMAL) + else // if (CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeNormal) { g_settings.m_fPixelRatio = 1.0; g_settings.m_fZoomAmount = 1.0; } - g_settings.m_currentVideoSettings.m_CustomZoomAmount = g_settings.m_fZoomAmount; - g_settings.m_currentVideoSettings.m_CustomPixelRatio = g_settings.m_fPixelRatio; - g_settings.m_currentVideoSettings.m_CustomNonLinStretch = g_settings.m_bNonLinStretch; - g_settings.m_currentVideoSettings.m_CustomVerticalShift = g_settings.m_fVerticalShift; + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = g_settings.m_fZoomAmount; + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio = g_settings.m_fPixelRatio; + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomNonLinStretch = g_settings.m_bNonLinStretch; + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = g_settings.m_fVerticalShift; } void CBaseRenderer::MarkDirty() diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp index 7771daf897..a3c46405cf 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp @@ -33,6 +33,7 @@ #include "settings/Settings.h" #include "settings/AdvancedSettings.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "VideoShaders/YUV2RGBShader.h" #include "VideoShaders/VideoFilterShader.h" #include "windowing/WindowingFactory.h" @@ -292,7 +293,7 @@ bool CLinuxRendererGL::Configure(unsigned int width, unsigned int height, unsign // Calculate the input frame aspect ratio. CalculateFrameAspectRatio(d_width, d_height); ChooseBestResolution(fps); - SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode); + SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); ManageDisplay(); m_bConfigured = true; @@ -835,7 +836,7 @@ void CLinuxRendererGL::UpdateVideoFilter() } } - if (m_scalingMethodGui == g_settings.m_currentVideoSettings.m_ScalingMethod && !nonLinStretchChanged) + if (m_scalingMethodGui == CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod && !nonLinStretchChanged) return; //recompile YUV shader when non-linear stretch is turned on/off @@ -843,7 +844,7 @@ void CLinuxRendererGL::UpdateVideoFilter() if (m_nonLinStretch || nonLinStretchChanged) m_reloadShaders = 1; - m_scalingMethodGui = g_settings.m_currentVideoSettings.m_ScalingMethod; + m_scalingMethodGui = CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod; m_scalingMethod = m_scalingMethodGui; if(!Supports(m_scalingMethod)) @@ -1247,8 +1248,8 @@ void CLinuxRendererGL::RenderSinglePass(int index, int field) glActiveTextureARB(GL_TEXTURE0); VerifyGLState(); - m_pYUVShader->SetBlack(g_settings.m_currentVideoSettings.m_Brightness * 0.01f - 0.5f); - m_pYUVShader->SetContrast(g_settings.m_currentVideoSettings.m_Contrast * 0.02f); + m_pYUVShader->SetBlack(CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness * 0.01f - 0.5f); + m_pYUVShader->SetContrast(CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast * 0.02f); m_pYUVShader->SetWidth(planes[0].texwidth); m_pYUVShader->SetHeight(planes[0].texheight); @@ -1372,8 +1373,8 @@ void CLinuxRendererGL::RenderToFBO(int index, int field) m_fbo.fbo.BeginRender(); VerifyGLState(); - m_pYUVShader->SetBlack(g_settings.m_currentVideoSettings.m_Brightness * 0.01f - 0.5f); - m_pYUVShader->SetContrast(g_settings.m_currentVideoSettings.m_Contrast * 0.02f); + m_pYUVShader->SetBlack(CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness * 0.01f - 0.5f); + m_pYUVShader->SetContrast(CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast * 0.02f); m_pYUVShader->SetWidth(planes[0].texwidth); m_pYUVShader->SetHeight(planes[0].texheight); m_pYUVShader->SetNonLinStretch(1.0); @@ -3098,11 +3099,11 @@ void CLinuxRendererGL::UploadRGBTexture(int source) } if (imaging==1 && - ((g_settings.m_currentVideoSettings.m_Brightness!=50) || - (g_settings.m_currentVideoSettings.m_Contrast!=50))) + ((CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness!=50) || + (CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast!=50))) { - GLfloat brightness = ((GLfloat)g_settings.m_currentVideoSettings.m_Brightness - 50.0f)/100.0f;; - GLfloat contrast = ((GLfloat)g_settings.m_currentVideoSettings.m_Contrast)/50.0f; + GLfloat brightness = ((GLfloat)CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness - 50.0f)/100.0f;; + GLfloat contrast = ((GLfloat)CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast)/50.0f; glPixelTransferf(GL_RED_SCALE , contrast); glPixelTransferf(GL_GREEN_SCALE, contrast); diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp index 3574a27e62..176d946646 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp @@ -35,6 +35,7 @@ #include "settings/Settings.h" #include "settings/AdvancedSettings.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "guilib/FrameBufferObject.h" #include "VideoShaders/YUV2RGBShader.h" #include "VideoShaders/VideoFilterShader.h" @@ -174,7 +175,7 @@ bool CLinuxRendererGLES::Configure(unsigned int width, unsigned int height, unsi // Calculate the input frame aspect ratio. CalculateFrameAspectRatio(d_width, d_height); ChooseBestResolution(fps); - SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode); + SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); ManageDisplay(); m_bConfigured = true; @@ -545,9 +546,9 @@ unsigned int CLinuxRendererGLES::PreInit() void CLinuxRendererGLES::UpdateVideoFilter() { - if (m_scalingMethodGui == g_settings.m_currentVideoSettings.m_ScalingMethod) + if (m_scalingMethodGui == CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod) return; - m_scalingMethodGui = g_settings.m_currentVideoSettings.m_ScalingMethod; + m_scalingMethodGui = CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod; m_scalingMethod = m_scalingMethodGui; if(!Supports(m_scalingMethod)) @@ -859,8 +860,8 @@ void CLinuxRendererGLES::RenderSinglePass(int index, int field) glActiveTexture(GL_TEXTURE0); VerifyGLState(); - m_pYUVShader->SetBlack(g_settings.m_currentVideoSettings.m_Brightness * 0.01f - 0.5f); - m_pYUVShader->SetContrast(g_settings.m_currentVideoSettings.m_Contrast * 0.02f); + m_pYUVShader->SetBlack(CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness * 0.01f - 0.5f); + m_pYUVShader->SetContrast(CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast * 0.02f); m_pYUVShader->SetWidth(im.width); m_pYUVShader->SetHeight(im.height); if (field == FIELD_TOP) @@ -981,8 +982,8 @@ void CLinuxRendererGLES::RenderMultiPass(int index, int field) m_fbo.BeginRender(); VerifyGLState(); - m_pYUVShader->SetBlack(g_settings.m_currentVideoSettings.m_Brightness * 0.01f - 0.5f); - m_pYUVShader->SetContrast(g_settings.m_currentVideoSettings.m_Contrast * 0.02f); + m_pYUVShader->SetBlack(CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness * 0.01f - 0.5f); + m_pYUVShader->SetContrast(CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast * 0.02f); m_pYUVShader->SetWidth(im.width); m_pYUVShader->SetHeight(im.height); if (field == FIELD_TOP) diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp index d15424f8f0..1b761ace01 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp @@ -34,6 +34,7 @@ #include "settings/Settings.h" #include "settings/GUISettings.h" #include "settings/AdvancedSettings.h" +#include "settings/MediaSettings.h" #if defined(HAS_GL) #include "LinuxRendererGL.h" @@ -564,8 +565,8 @@ void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0L m_presentfield = sync; m_presentstep = PRESENT_FLIP; m_presentsource = source; - EDEINTERLACEMODE deinterlacemode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; - EINTERLACEMETHOD interlacemethod = AutoInterlaceMethodInternal(g_settings.m_currentVideoSettings.m_InterlaceMethod); + EDEINTERLACEMODE deinterlacemode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD interlacemethod = AutoInterlaceMethodInternal(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); bool invert = false; diff --git a/xbmc/cores/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoRenderers/WinRenderer.cpp index f8091fd8ac..c103c2942a 100644 --- a/xbmc/cores/VideoRenderers/WinRenderer.cpp +++ b/xbmc/cores/VideoRenderers/WinRenderer.cpp @@ -24,6 +24,7 @@ #include "Util.h" #include "settings/Settings.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "guilib/Texture.h" #include "windowing/WindowingFactory.h" #include "settings/AdvancedSettings.h" @@ -234,7 +235,7 @@ bool CWinRenderer::Configure(unsigned int width, unsigned int height, unsigned i ChooseBestResolution(fps); m_destWidth = g_settings.m_ResInfo[m_resolution].iWidth; m_destHeight = g_settings.m_ResInfo[m_resolution].iHeight; - SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode); + SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); ManageDisplay(); m_bConfigured = true; @@ -582,12 +583,12 @@ void CWinRenderer::UpdatePSVideoFilter() void CWinRenderer::UpdateVideoFilter() { - if (m_scalingMethodGui == g_settings.m_currentVideoSettings.m_ScalingMethod && m_bFilterInitialized) + if (m_scalingMethodGui == CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod && m_bFilterInitialized) return; m_bFilterInitialized = true; - m_scalingMethodGui = g_settings.m_currentVideoSettings.m_ScalingMethod; + m_scalingMethodGui = CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod; m_scalingMethod = m_scalingMethodGui; if (!Supports(m_scalingMethod)) @@ -762,9 +763,9 @@ void CWinRenderer::ScaleFixedPipeline() float srcWidth = (float)srcDesc.Width; float srcHeight = (float)srcDesc.Height; - bool cbcontrol = (g_settings.m_currentVideoSettings.m_Contrast != 50.0f || g_settings.m_currentVideoSettings.m_Brightness != 50.0f); - unsigned int contrast = (unsigned int)(g_settings.m_currentVideoSettings.m_Contrast *.01f * 255.0f); // we have to divide by two here/multiply by two later - unsigned int brightness = (unsigned int)(g_settings.m_currentVideoSettings.m_Brightness * .01f * 255.0f); + bool cbcontrol = (CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast != 50.0f || CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness != 50.0f); + unsigned int contrast = (unsigned int)(CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast *.01f * 255.0f); // we have to divide by two here/multiply by two later + unsigned int brightness = (unsigned int)(CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness * .01f * 255.0f); D3DCOLOR diffuse = D3DCOLOR_ARGB(255, contrast, contrast, contrast); D3DCOLOR specular = D3DCOLOR_ARGB(255, brightness, brightness, brightness); @@ -861,8 +862,8 @@ void CWinRenderer::Stage1() if (!m_bUseHQScaler) { m_colorShader->Render(m_sourceRect, m_destRect, - g_settings.m_currentVideoSettings.m_Contrast, - g_settings.m_currentVideoSettings.m_Brightness, + CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast, + CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness, m_iFlags, (YUVBuffer*)m_VideoBuffers[m_iYV12RenderBuffer]); } @@ -879,8 +880,8 @@ void CWinRenderer::Stage1() CRect rtRect(0.0f, 0.0f, m_sourceWidth, m_sourceHeight); m_colorShader->Render(srcRect, rtRect, - g_settings.m_currentVideoSettings.m_Contrast, - g_settings.m_currentVideoSettings.m_Brightness, + CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast, + CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness, m_iFlags, (YUVBuffer*)m_VideoBuffers[m_iYV12RenderBuffer]); diff --git a/xbmc/cores/VideoRenderers/legacy/ComboRenderer.cpp b/xbmc/cores/VideoRenderers/legacy/ComboRenderer.cpp index 8980bdc3d4..78b5d72e92 100644 --- a/xbmc/cores/VideoRenderers/legacy/ComboRenderer.cpp +++ b/xbmc/cores/VideoRenderers/legacy/ComboRenderer.cpp @@ -132,10 +132,10 @@ void CComboRenderer::ManageDisplay() } // source rect - rs.left = g_settings.m_currentVideoSettings.m_CropLeft; - rs.top = g_settings.m_currentVideoSettings.m_CropTop; - rs.right = m_iSourceWidth - g_settings.m_currentVideoSettings.m_CropRight; - rs.bottom = m_iSourceHeight - g_settings.m_currentVideoSettings.m_CropBottom; + rs.left = CMediaSettings::Get().GetCurrentVideoSettings().m_CropLeft; + rs.top = CMediaSettings::Get().GetCurrentVideoSettings().m_CropTop; + rs.right = m_iSourceWidth - CMediaSettings::Get().GetCurrentVideoSettings().m_CropRight; + rs.bottom = m_iSourceHeight - CMediaSettings::Get().GetCurrentVideoSettings().m_CropBottom; CalcNormalDisplayRect(fOffsetX1, fOffsetY1, fScreenWidth, fScreenHeight, GetAspectRatio() * fPixelRatio, g_settings.m_fZoomAmount); diff --git a/xbmc/cores/amlplayer/AMLPlayer.cpp b/xbmc/cores/amlplayer/AMLPlayer.cpp index 2c2a8496b8..ba4e2a2467 100644 --- a/xbmc/cores/amlplayer/AMLPlayer.cpp +++ b/xbmc/cores/amlplayer/AMLPlayer.cpp @@ -968,7 +968,7 @@ bool CAMLPlayer::GetSubtitleVisible() void CAMLPlayer::SetSubtitleVisible(bool bVisible) { m_subtitle_show = (bVisible && m_subtitle_count); - g_settings.m_currentVideoSettings.m_SubtitleOn = bVisible; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = bVisible; if (m_subtitle_show && m_subtitle_count) { @@ -1436,11 +1436,11 @@ void CAMLPlayer::Process() // check for video in media content if (GetVideoStreamCount() > 0) { - SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); + SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); // turn on/off subs - SetSubtitleVisible(g_settings.m_currentVideoSettings.m_SubtitleOn); - SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); + SetSubtitleVisible(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); + SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); // setup renderer for bypass. This tell renderer to get out of the way as // hw decoder will be doing the actual video rendering in a video plane @@ -2198,20 +2198,20 @@ void CAMLPlayer::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) // do not do anything stupid here. // video zoom adjustment. - float zoom = g_settings.m_currentVideoSettings.m_CustomZoomAmount; + float zoom = CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount; if ((int)(zoom * 1000) != (int)(m_zoom * 1000)) { m_zoom = zoom; } // video contrast adjustment. - int contrast = g_settings.m_currentVideoSettings.m_Contrast; + int contrast = CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast; if (contrast != m_contrast) { SetVideoContrast(contrast); m_contrast = contrast; } // video brightness adjustment. - int brightness = g_settings.m_currentVideoSettings.m_Brightness; + int brightness = CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness; if (brightness != m_brightness) { SetVideoBrightness(brightness); @@ -2219,10 +2219,10 @@ void CAMLPlayer::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) } // check if destination rect or video view mode has changed - if ((m_dst_rect != DestRect) || (m_view_mode != g_settings.m_currentVideoSettings.m_ViewMode)) + if ((m_dst_rect != DestRect) || (m_view_mode != CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode)) { m_dst_rect = DestRect; - m_view_mode = g_settings.m_currentVideoSettings.m_ViewMode; + m_view_mode = CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode; } else { diff --git a/xbmc/cores/dvdplayer/DVDAudio.cpp b/xbmc/cores/dvdplayer/DVDAudio.cpp index d46981d0af..1b31ad161f 100644 --- a/xbmc/cores/dvdplayer/DVDAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDAudio.cpp @@ -27,6 +27,7 @@ #include "cores/AudioEngine/AEFactory.h" #include "cores/AudioEngine/Interfaces/AEStream.h" #include "settings/Settings.h" +#include "settings/MediaSettings.h" using namespace std; @@ -152,7 +153,7 @@ bool CDVDAudio::Create(const DVDAudioFrame &audioframe, CodecID codec, bool need m_SecondsPerByte = 0.0; m_iBufferSize = 0; - SetDynamicRangeCompression((long)(g_settings.m_currentVideoSettings.m_VolumeAmplification * 100)); + SetDynamicRangeCompression((long)(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification * 100)); if (m_pAudioCallback) RegisterAudioCallback(m_pAudioCallback); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp index be5601c9f3..acb468ef59 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp @@ -22,6 +22,7 @@ #include "DVDCodecs/DVDCodecs.h" #include "DVDStreamInfo.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "settings/Settings.h" #include "utils/log.h" @@ -300,7 +301,7 @@ bool CDVDAudioCodecPassthroughFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptio return false; // TODO - this is only valid for video files, and should be moved somewhere else - if( hints.channels == 2 && g_settings.m_currentVideoSettings.m_OutputToAllSpeakers ) + if( hints.channels == 2 && CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers ) { CLog::Log(LOGINFO, "CDVDAudioCodecPassthroughFFmpeg::Open - disabled passthrough due to video OTAS"); return false; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp index 3c916c4275..466a03a13c 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp @@ -39,6 +39,7 @@ #include "boost/shared_ptr.hpp" #include "utils/AutoPtrHandle.h" #include "settings/AdvancedSettings.h" +#include "settings/MediaSettings.h" #include "cores/VideoRenderers/RenderManager.h" #include "win32/WIN32Util.h" @@ -1175,8 +1176,8 @@ bool CProcessor::Open(UINT width, UINT height, unsigned int flags, unsigned int // And for those GPUs, the correct values will be calculated with the first Render() and the correct processor // will replace the one allocated here, before the user sees anything. // It's a bit inefficient, that's all. - m_deinterlace_mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; - m_interlace_method = g_renderManager.AutoInterlaceMethod(g_settings.m_currentVideoSettings.m_InterlaceMethod);; + m_deinterlace_mode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + m_interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod);; EvaluateQuirkNoDeintProcForProg(); @@ -1460,10 +1461,10 @@ bool CProcessor::Render(CRect src, CRect dst, IDirect3DSurface9* target, REFEREN // With auto deinterlacing, the Ion Gen. 1 drops some frames with deinterlacing processor + progressive flags for progressive material. // For that GPU (or when specified by an advanced setting), use the progressive processor. // This is at the expense of the switch speed when video interlacing flags change and a deinterlacing processor is actually required. - EDEINTERLACEMODE mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; + EDEINTERLACEMODE mode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; if (g_advancedSettings.m_DXVANoDeintProcForProgressive || m_quirk_nodeintprocforprog) mode = (flags & RENDER_FLAG_FIELD0 || flags & RENDER_FLAG_FIELD1) ? VS_DEINTERLACEMODE_FORCE : VS_DEINTERLACEMODE_OFF; - EINTERLACEMETHOD method = g_renderManager.AutoInterlaceMethod(g_settings.m_currentVideoSettings.m_InterlaceMethod); + EINTERLACEMETHOD method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); if(m_interlace_method != method || m_deinterlace_mode != mode || !m_process) @@ -1577,9 +1578,9 @@ bool CProcessor::Render(CRect src, CRect dst, IDirect3DSurface9* target, REFEREN blt.DestFormat.NominalRange = DXVA2_NominalRange_0_255; blt.Alpha = DXVA2_Fixed32OpaqueAlpha(); - blt.ProcAmpValues.Brightness = ConvertRange( m_brightness, g_settings.m_currentVideoSettings.m_Brightness + blt.ProcAmpValues.Brightness = ConvertRange( m_brightness, CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness , 0, 100, 50); - blt.ProcAmpValues.Contrast = ConvertRange( m_contrast, g_settings.m_currentVideoSettings.m_Contrast + blt.ProcAmpValues.Contrast = ConvertRange( m_contrast, CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast , 0, 100, 50); blt.ProcAmpValues.Hue = m_hue.DefaultValue; blt.ProcAmpValues.Saturation = m_saturation.DefaultValue; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp index f8d6e19301..8acacd636b 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp @@ -30,6 +30,7 @@ #include "settings/Settings.h" #include "settings/GUISettings.h" #include "settings/AdvancedSettings.h" +#include "settings/MediaSettings.h" #include "Application.h" #include "utils/MathUtils.h" #include "DVDCodecs/DVDCodecUtils.h" @@ -514,29 +515,29 @@ void CVDPAU::CheckFeatures() SetHWUpscaling(); } - if (tmpBrightness != g_settings.m_currentVideoSettings.m_Brightness || - tmpContrast != g_settings.m_currentVideoSettings.m_Contrast) + if (tmpBrightness != CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness || + tmpContrast != CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast) { SetColor(); - tmpBrightness = g_settings.m_currentVideoSettings.m_Brightness; - tmpContrast = g_settings.m_currentVideoSettings.m_Contrast; + tmpBrightness = CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness; + tmpContrast = CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast; } - if (tmpNoiseReduction != g_settings.m_currentVideoSettings.m_NoiseReduction) + if (tmpNoiseReduction != CMediaSettings::Get().GetCurrentVideoSettings().m_NoiseReduction) { - tmpNoiseReduction = g_settings.m_currentVideoSettings.m_NoiseReduction; + tmpNoiseReduction = CMediaSettings::Get().GetCurrentVideoSettings().m_NoiseReduction; SetNoiseReduction(); } - if (tmpSharpness != g_settings.m_currentVideoSettings.m_Sharpness) + if (tmpSharpness != CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness) { - tmpSharpness = g_settings.m_currentVideoSettings.m_Sharpness; + tmpSharpness = CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness; SetSharpness(); } - if ( tmpDeintMode != g_settings.m_currentVideoSettings.m_DeinterlaceMode || - tmpDeintGUI != g_settings.m_currentVideoSettings.m_InterlaceMethod || + if ( tmpDeintMode != CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode || + tmpDeintGUI != CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod || (tmpDeintGUI == VS_INTERLACEMETHOD_AUTO && tmpDeint != AutoInterlaceMethod())) { - tmpDeintMode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; - tmpDeintGUI = g_settings.m_currentVideoSettings.m_InterlaceMethod; + tmpDeintMode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + tmpDeintGUI = CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod; if (tmpDeintGUI == VS_INTERLACEMETHOD_AUTO) tmpDeint = AutoInterlaceMethod(); else @@ -580,10 +581,10 @@ void CVDPAU::SetColor() { VdpStatus vdp_st; - if (tmpBrightness != g_settings.m_currentVideoSettings.m_Brightness) - m_Procamp.brightness = (float)((g_settings.m_currentVideoSettings.m_Brightness)-50) / 100; - if (tmpContrast != g_settings.m_currentVideoSettings.m_Contrast) - m_Procamp.contrast = (float)((g_settings.m_currentVideoSettings.m_Contrast)+50) / 100; + if (tmpBrightness != CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness) + m_Procamp.brightness = (float)((CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness)-50) / 100; + if (tmpContrast != CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast) + m_Procamp.contrast = (float)((CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast)+50) / 100; if(vid_height >= 600 || vid_width > 1024) vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_709, &m_CSCMatrix); @@ -613,7 +614,7 @@ void CVDPAU::SetNoiseReduction() VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL }; VdpStatus vdp_st; - if (!g_settings.m_currentVideoSettings.m_NoiseReduction) + if (!CMediaSettings::Get().GetCurrentVideoSettings().m_NoiseReduction) { VdpBool enabled[]= {0}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); @@ -623,8 +624,8 @@ void CVDPAU::SetNoiseReduction() VdpBool enabled[]={1}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); CheckStatus(vdp_st, __LINE__); - void* nr[] = { &g_settings.m_currentVideoSettings.m_NoiseReduction }; - CLog::Log(LOGNOTICE,"Setting Noise Reduction to %f",g_settings.m_currentVideoSettings.m_NoiseReduction); + void* nr[] = { &CMediaSettings::Get().GetCurrentVideoSettings().m_NoiseReduction }; + CLog::Log(LOGNOTICE,"Setting Noise Reduction to %f",CMediaSettings::Get().GetCurrentVideoSettings().m_NoiseReduction); vdp_st = vdp_video_mixer_set_attribute_values(videoMixer, ARSIZE(attributes), attributes, nr); CheckStatus(vdp_st, __LINE__); } @@ -638,7 +639,7 @@ void CVDPAU::SetSharpness() VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL }; VdpStatus vdp_st; - if (!g_settings.m_currentVideoSettings.m_Sharpness) + if (!CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness) { VdpBool enabled[]={0}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); @@ -648,8 +649,8 @@ void CVDPAU::SetSharpness() VdpBool enabled[]={1}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); CheckStatus(vdp_st, __LINE__); - void* sh[] = { &g_settings.m_currentVideoSettings.m_Sharpness }; - CLog::Log(LOGNOTICE,"Setting Sharpness to %f",g_settings.m_currentVideoSettings.m_Sharpness); + void* sh[] = { &CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness }; + CLog::Log(LOGNOTICE,"Setting Sharpness to %f",CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness); vdp_st = vdp_video_mixer_set_attribute_values(videoMixer, ARSIZE(attributes), attributes, sh); CheckStatus(vdp_st, __LINE__); } @@ -671,8 +672,8 @@ void CVDPAU::SetHWUpscaling() void CVDPAU::SetDeinterlacing() { VdpStatus vdp_st; - EDEINTERLACEMODE mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; - EINTERLACEMETHOD method = g_settings.m_currentVideoSettings.m_InterlaceMethod; + EDEINTERLACEMODE mode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD method = CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod; if (method == VS_INTERLACEMETHOD_AUTO) method = AutoInterlaceMethod(); @@ -1381,8 +1382,8 @@ int CVDPAU::Decode(AVCodecContext *avctx, AVFrame *pFrame) outRectVid.y1 = OutHeight; } - EDEINTERLACEMODE mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; - EINTERLACEMETHOD method = g_settings.m_currentVideoSettings.m_InterlaceMethod; + EDEINTERLACEMODE mode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD method = CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod; if (method == VS_INTERLACEMETHOD_AUTO) method = AutoInterlaceMethod(); diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index 30f7ec3d5a..5bfe007d7f 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -64,6 +64,7 @@ #include "settings/AdvancedSettings.h" #include "FileItem.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "GUIUserMessages.h" #include "settings/Settings.h" #include "utils/log.h" @@ -138,8 +139,8 @@ std::vector<SelectionStream> CSelectionStreams::Get(StreamType type) static bool PredicateAudioPriority(const SelectionStream& lh, const SelectionStream& rh) { - PREDICATE_RETURN(lh.type_index == g_settings.m_currentVideoSettings.m_AudioStream - , rh.type_index == g_settings.m_currentVideoSettings.m_AudioStream); + PREDICATE_RETURN(lh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream + , rh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream); if(!g_guiSettings.GetString("locale.audiolanguage").Equals("original")) { @@ -161,14 +162,14 @@ static bool PredicateAudioPriority(const SelectionStream& lh, const SelectionStr static bool PredicateSubtitlePriority(const SelectionStream& lh, const SelectionStream& rh) { - if(!g_settings.m_currentVideoSettings.m_SubtitleOn) + if(!CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) { PREDICATE_RETURN(lh.flags & CDemuxStream::FLAG_FORCED , rh.flags & CDemuxStream::FLAG_FORCED); } - PREDICATE_RETURN(lh.type_index == g_settings.m_currentVideoSettings.m_SubtitleStream - , rh.type_index == g_settings.m_currentVideoSettings.m_SubtitleStream); + PREDICATE_RETURN(lh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream + , rh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream); CStdString subtitle_language = g_langInfo.GetSubtitleLanguage(); if(!g_guiSettings.GetString("locale.subtitlelanguage").Equals("original")) @@ -617,11 +618,11 @@ bool CDVDPlayer::OpenInputStream() } } // end loop over all subtitle files - g_settings.m_currentVideoSettings.m_SubtitleCached = true; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleCached = true; } - SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); - SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); + SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); + SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); m_clock.Reset(); m_dvd.Clear(); m_errorCount = 0; @@ -717,7 +718,7 @@ void CDVDPlayer::OpenDefaultStreams(bool reset) CloseAudioStream(true); // enable subtitles - m_dvdPlayerVideo.EnableSubtitle(g_settings.m_currentVideoSettings.m_SubtitleOn); + m_dvdPlayerVideo.EnableSubtitle(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); // open subtitle stream streams = m_SelectionStreams.Get(STREAM_SUBTITLE, PredicateSubtitlePriority); @@ -925,9 +926,9 @@ void CDVDPlayer::Process() if(m_PlayerOptions.state.size() > 0) ptr->SetState(m_PlayerOptions.state); else if(CDVDInputStreamNavigator* nav = dynamic_cast<CDVDInputStreamNavigator*>(m_pInputStream)) - nav->EnableSubtitleStream(g_settings.m_currentVideoSettings.m_SubtitleOn); + nav->EnableSubtitleStream(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); - g_settings.m_currentVideoSettings.m_SubtitleCached = true; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleCached = true; } if(!OpenDemuxStream()) @@ -2715,7 +2716,7 @@ bool CDVDPlayer::GetSubtitleVisible() { CDVDInputStreamNavigator* pStream = (CDVDInputStreamNavigator*)m_pInputStream; if(pStream->IsInMenu()) - return g_settings.m_currentVideoSettings.m_SubtitleOn; + return CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn; else return pStream->IsSubtitleStreamEnabled(); } @@ -2725,7 +2726,7 @@ bool CDVDPlayer::GetSubtitleVisible() void CDVDPlayer::SetSubtitleVisible(bool bVisible) { - g_settings.m_currentVideoSettings.m_SubtitleOn = bVisible; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = bVisible; m_messenger.Put(new CDVDMsgBool(CDVDMsg::PLAYER_SET_SUBTITLESTREAM_VISIBLE, bVisible)); } diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp index b809b8202e..9ee51c01ae 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -23,6 +23,7 @@ #include "windowing/WindowingFactory.h" #include "settings/AdvancedSettings.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "settings/Settings.h" #include "video/VideoReferenceClock.h" #include "utils/MathUtils.h" @@ -535,8 +536,8 @@ void CDVDPlayerVideo::Process() m_pVideoCodec->SetDropState(bRequestDrop); // ask codec to do deinterlacing if possible - EDEINTERLACEMODE mDeintMode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; - EINTERLACEMETHOD mInt = g_renderManager.AutoInterlaceMethod(g_settings.m_currentVideoSettings.m_InterlaceMethod); + EDEINTERLACEMODE mDeintMode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD mInt = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); unsigned int mFilters = 0; @@ -658,7 +659,7 @@ void CDVDPlayerVideo::Process() } } - if (g_settings.m_currentVideoSettings.m_PostProcess) + if (CMediaSettings::Get().GetCurrentVideoSettings().m_PostProcess) { if (!sPostProcessType.empty()) sPostProcessType += ","; @@ -1364,7 +1365,7 @@ void CDVDPlayerVideo::AutoCrop(DVDVideoPicture *pPicture) { RECT crop; - if (g_settings.m_currentVideoSettings.m_Crop) + if (CMediaSettings::Get().GetCurrentVideoSettings().m_Crop) AutoCrop(pPicture, crop); else { // reset to defaults @@ -1386,16 +1387,16 @@ void CDVDPlayerVideo::AutoCrop(DVDVideoPicture *pPicture) //compare with hysteresis # define HYST(n, o) ((n) > (o) || (n) + 1 < (o)) - if(HYST(g_settings.m_currentVideoSettings.m_CropLeft , crop.left) - || HYST(g_settings.m_currentVideoSettings.m_CropRight , crop.right) - || HYST(g_settings.m_currentVideoSettings.m_CropTop , crop.top) - || HYST(g_settings.m_currentVideoSettings.m_CropBottom, crop.bottom)) + if(HYST(CMediaSettings::Get().GetCurrentVideoSettings().m_CropLeft , crop.left) + || HYST(CMediaSettings::Get().GetCurrentVideoSettings().m_CropRight , crop.right) + || HYST(CMediaSettings::Get().GetCurrentVideoSettings().m_CropTop , crop.top) + || HYST(CMediaSettings::Get().GetCurrentVideoSettings().m_CropBottom, crop.bottom)) { - g_settings.m_currentVideoSettings.m_CropLeft = crop.left; - g_settings.m_currentVideoSettings.m_CropRight = crop.right; - g_settings.m_currentVideoSettings.m_CropTop = crop.top; - g_settings.m_currentVideoSettings.m_CropBottom = crop.bottom; - g_renderManager.SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode); + CMediaSettings::Get().GetCurrentVideoSettings().m_CropLeft = crop.left; + CMediaSettings::Get().GetCurrentVideoSettings().m_CropRight = crop.right; + CMediaSettings::Get().GetCurrentVideoSettings().m_CropTop = crop.top; + CMediaSettings::Get().GetCurrentVideoSettings().m_CropBottom = crop.bottom; + g_renderManager.SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); } # undef HYST } @@ -1403,10 +1404,10 @@ void CDVDPlayerVideo::AutoCrop(DVDVideoPicture *pPicture) void CDVDPlayerVideo::AutoCrop(DVDVideoPicture *pPicture, RECT &crop) { - crop.left = g_settings.m_currentVideoSettings.m_CropLeft; - crop.right = g_settings.m_currentVideoSettings.m_CropRight; - crop.top = g_settings.m_currentVideoSettings.m_CropTop; - crop.bottom = g_settings.m_currentVideoSettings.m_CropBottom; + crop.left = CMediaSettings::Get().GetCurrentVideoSettings().m_CropLeft; + crop.right = CMediaSettings::Get().GetCurrentVideoSettings().m_CropRight; + crop.top = CMediaSettings::Get().GetCurrentVideoSettings().m_CropTop; + crop.bottom = CMediaSettings::Get().GetCurrentVideoSettings().m_CropBottom; int black = 16; // what is black in the image int level = 8; // how high above this should we detect @@ -1561,7 +1562,7 @@ void CDVDPlayerVideo::ResetFrameRateCalc() m_iFrameRateLength = 1; m_iFrameRateErr = 0; - m_bAllowDrop = (!m_bCalcFrameRate && g_settings.m_currentVideoSettings.m_ScalingMethod != VS_SCALINGMETHOD_AUTO) || + m_bAllowDrop = (!m_bCalcFrameRate && CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod != VS_SCALINGMETHOD_AUTO) || g_advancedSettings.m_videoFpsDetect == 0; } @@ -1575,7 +1576,7 @@ void CDVDPlayerVideo::CalcFrameRate() //only calculate the framerate if sync playback to display is on, adjust refreshrate is on, //or scaling method is set to auto - if (!m_bCalcFrameRate && g_settings.m_currentVideoSettings.m_ScalingMethod != VS_SCALINGMETHOD_AUTO) + if (!m_bCalcFrameRate && CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod != VS_SCALINGMETHOD_AUTO) { ResetFrameRateCalc(); return; diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp index 28addd37c0..246961d941 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.cpp +++ b/xbmc/cores/omxplayer/OMXPlayer.cpp @@ -139,8 +139,8 @@ std::vector<OMXSelectionStream> COMXSelectionStreams::Get(StreamType type) static bool PredicateAudioPriority(const OMXSelectionStream& lh, const OMXSelectionStream& rh) { - PREDICATE_RETURN(lh.type_index == g_settings.m_currentVideoSettings.m_AudioStream - , rh.type_index == g_settings.m_currentVideoSettings.m_AudioStream); + PREDICATE_RETURN(lh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream + , rh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream); if(!g_guiSettings.GetString("locale.audiolanguage").Equals("original")) { @@ -162,14 +162,14 @@ static bool PredicateAudioPriority(const OMXSelectionStream& lh, const OMXSelect static bool PredicateSubtitlePriority(const OMXSelectionStream& lh, const OMXSelectionStream& rh) { - if(!g_settings.m_currentVideoSettings.m_SubtitleOn) + if(!CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) { PREDICATE_RETURN(lh.flags & CDemuxStream::FLAG_FORCED , rh.flags & CDemuxStream::FLAG_FORCED); } - PREDICATE_RETURN(lh.type_index == g_settings.m_currentVideoSettings.m_SubtitleStream - , rh.type_index == g_settings.m_currentVideoSettings.m_SubtitleStream); + PREDICATE_RETURN(lh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream + , rh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream); CStdString subtitle_language = g_langInfo.GetSubtitleLanguage(); if(!g_guiSettings.GetString("locale.subtitlelanguage").Equals("original")) @@ -623,11 +623,11 @@ retry: } } // end loop over all subtitle files - g_settings.m_currentVideoSettings.m_SubtitleCached = true; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleCached = true; } - SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); - SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); + SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); + SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); m_av_clock.Reset(); //m_av_clock.OMXReset(); m_dvd.Clear(); @@ -722,7 +722,7 @@ void COMXPlayer::OpenDefaultStreams(bool reset) CloseAudioStream(true); // enable subtitles - m_player_video.EnableSubtitle(g_settings.m_currentVideoSettings.m_SubtitleOn); + m_player_video.EnableSubtitle(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); // open subtitle stream streams = m_SelectionStreams.Get(STREAM_SUBTITLE, PredicateSubtitlePriority); @@ -938,9 +938,9 @@ void COMXPlayer::Process() if(m_PlayerOptions.state.size() > 0) ((CDVDInputStreamNavigator*)m_pInputStream)->SetNavigatorState(m_PlayerOptions.state); else - ((CDVDInputStreamNavigator*)m_pInputStream)->EnableSubtitleStream(g_settings.m_currentVideoSettings.m_SubtitleOn); + ((CDVDInputStreamNavigator*)m_pInputStream)->EnableSubtitleStream(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); - g_settings.m_currentVideoSettings.m_SubtitleCached = true; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleCached = true; } if(!OpenDemuxStream()) @@ -2717,7 +2717,7 @@ bool COMXPlayer::GetSubtitleVisible() { CDVDInputStreamNavigator* pStream = (CDVDInputStreamNavigator*)m_pInputStream; if(pStream->IsInMenu()) - return g_settings.m_currentVideoSettings.m_SubtitleOn; + return CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn; else return pStream->IsSubtitleStreamEnabled(); } @@ -2727,7 +2727,7 @@ bool COMXPlayer::GetSubtitleVisible() void COMXPlayer::SetSubtitleVisible(bool bVisible) { - g_settings.m_currentVideoSettings.m_SubtitleOn = bVisible; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = bVisible; m_messenger.Put(new CDVDMsgBool(CDVDMsg::PLAYER_SET_SUBTITLESTREAM_VISIBLE, bVisible)); } diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp index 3e27f4f3c7..96a44280df 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp @@ -111,7 +111,7 @@ bool OMXPlayerVideo::OpenStream(CDVDStreamInfo &hints) */ m_hints = hints; - m_Deinterlace = ( g_settings.m_currentVideoSettings.m_DeinterlaceMode == VS_DEINTERLACEMODE_OFF ) ? false : true; + m_Deinterlace = ( CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode == VS_DEINTERLACEMODE_OFF ) ? false : true; m_hdmi_clock_sync = (g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF); m_started = false; m_flush = false; @@ -713,10 +713,10 @@ int OMXPlayerVideo::GetFreeSpace() void OMXPlayerVideo::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) { // check if destination rect or video view mode has changed - if ((m_dst_rect != DestRect) || (m_view_mode != g_settings.m_currentVideoSettings.m_ViewMode)) + if ((m_dst_rect != DestRect) || (m_view_mode != CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode)) { m_dst_rect = DestRect; - m_view_mode = g_settings.m_currentVideoSettings.m_ViewMode; + m_view_mode = CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode; } else { diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp index bcd13f6b42..aaaab2a7c1 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp @@ -23,7 +23,7 @@ #include "video/VideoDatabase.h" #include "video/VideoDbUrl.h" #include "settings/GUISettings.h" -#include "settings/Settings.h" +#include "settings/MediaSettings.h" #include "FileItem.h" #include "utils/Variant.h" @@ -78,7 +78,7 @@ bool CDirectoryNodeSeasons::GetContent(CFileItemList& items) const if (items[0]->GetVideoInfoTag()->m_iSeason == 0 || items[1]->GetVideoInfoTag()->m_iSeason == 0) bFlatten = true; // flatten if one season + specials - if (iFlatten > 0 && !bFlatten && g_settings.GetWatchMode("tvshows") == VIDEO_SHOW_UNWATCHED) + if (iFlatten > 0 && !bFlatten && CMediaSettings::Get().GetWatchedMode("tvshows") == WatchedModeUnwatched) { int count = 0; for(int i = 0; i < items.Size(); i++) diff --git a/xbmc/interfaces/legacy/Player.cpp b/xbmc/interfaces/legacy/Player.cpp index 433dea9356..7c2c375d38 100644 --- a/xbmc/interfaces/legacy/Player.cpp +++ b/xbmc/interfaces/legacy/Player.cpp @@ -24,6 +24,7 @@ #include "PlayList.h" #include "PlayListPlayer.h" #include "settings/Settings.h" +#include "settings/MediaSettings.h" #include "Application.h" #include "ApplicationMessenger.h" #include "GUIInfoManager.h" @@ -373,8 +374,8 @@ namespace XBMCAddon { g_application.m_pPlayer->SetSubtitle(nStream); g_application.m_pPlayer->SetSubtitleVisible(true); - g_settings.m_currentVideoSettings.m_SubtitleDelay = 0.0f; - g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = 0.0f; + g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); } } } @@ -384,7 +385,7 @@ namespace XBMCAddon TRACE; if (g_application.m_pPlayer) { - g_settings.m_currentVideoSettings.m_SubtitleOn = bVisible != 0; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = bVisible != 0; g_application.m_pPlayer->SetSubtitleVisible(bVisible != 0); } } @@ -412,7 +413,7 @@ namespace XBMCAddon CLog::Log(LOGWARNING,"'xbmc.Player().disableSubtitles()' is deprecated and will be removed in future releases, please use 'xbmc.Player().showSubtitles(false)' instead"); if (g_application.m_pPlayer) { - g_settings.m_currentVideoSettings.m_SubtitleOn = false; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = false; g_application.m_pPlayer->SetSubtitleVisible(false); } } diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp index dc6324e15b..472ede3fd6 100644 --- a/xbmc/pvr/addons/PVRClients.cpp +++ b/xbmc/pvr/addons/PVRClients.cpp @@ -30,6 +30,7 @@ #include "pvr/PVRDatabase.h" #include "guilib/GUIWindowManager.h" #include "settings/Settings.h" +#include "settings/MediaSettings.h" #include "pvr/channels/PVRChannelGroups.h" #include "pvr/channels/PVRChannelGroupInternal.h" #include "pvr/recordings/PVRRecordings.h" @@ -1032,11 +1033,11 @@ void CPVRClients::SaveCurrentChannelSettings(void) if (!database) return; - if (g_settings.m_currentVideoSettings != g_settings.m_defaultVideoSettings) + if (CMediaSettings::Get().GetCurrentVideoSettings() != CMediaSettings::Get().GetDefaultVideoSettings()) { CLog::Log(LOGDEBUG, "PVR - %s - persisting custom channel settings for channel '%s'", __FUNCTION__, channel->ChannelName().c_str()); - database->PersistChannelSettings(*channel, g_settings.m_currentVideoSettings); + database->PersistChannelSettings(*channel, CMediaSettings::Get().GetCurrentVideoSettings()); } else { @@ -1062,63 +1063,63 @@ void CPVRClients::LoadCurrentChannelSettings(void) if (g_application.m_pPlayer) { /* set the default settings first */ - CVideoSettings loadedChannelSettings = g_settings.m_defaultVideoSettings; + CVideoSettings loadedChannelSettings = CMediaSettings::Get().GetDefaultVideoSettings(); /* try to load the settings from the database */ database->GetChannelSettings(*channel, loadedChannelSettings); - g_settings.m_currentVideoSettings = g_settings.m_defaultVideoSettings; - g_settings.m_currentVideoSettings.m_Brightness = loadedChannelSettings.m_Brightness; - g_settings.m_currentVideoSettings.m_Contrast = loadedChannelSettings.m_Contrast; - g_settings.m_currentVideoSettings.m_Gamma = loadedChannelSettings.m_Gamma; - g_settings.m_currentVideoSettings.m_Crop = loadedChannelSettings.m_Crop; - g_settings.m_currentVideoSettings.m_CropLeft = loadedChannelSettings.m_CropLeft; - g_settings.m_currentVideoSettings.m_CropRight = loadedChannelSettings.m_CropRight; - g_settings.m_currentVideoSettings.m_CropTop = loadedChannelSettings.m_CropTop; - g_settings.m_currentVideoSettings.m_CropBottom = loadedChannelSettings.m_CropBottom; - g_settings.m_currentVideoSettings.m_CustomPixelRatio = loadedChannelSettings.m_CustomPixelRatio; - g_settings.m_currentVideoSettings.m_CustomZoomAmount = loadedChannelSettings.m_CustomZoomAmount; - g_settings.m_currentVideoSettings.m_CustomVerticalShift = loadedChannelSettings.m_CustomVerticalShift; - g_settings.m_currentVideoSettings.m_NoiseReduction = loadedChannelSettings.m_NoiseReduction; - g_settings.m_currentVideoSettings.m_Sharpness = loadedChannelSettings.m_Sharpness; - g_settings.m_currentVideoSettings.m_InterlaceMethod = loadedChannelSettings.m_InterlaceMethod; - g_settings.m_currentVideoSettings.m_OutputToAllSpeakers = loadedChannelSettings.m_OutputToAllSpeakers; - g_settings.m_currentVideoSettings.m_AudioDelay = loadedChannelSettings.m_AudioDelay; - g_settings.m_currentVideoSettings.m_AudioStream = loadedChannelSettings.m_AudioStream; - g_settings.m_currentVideoSettings.m_SubtitleOn = loadedChannelSettings.m_SubtitleOn; - g_settings.m_currentVideoSettings.m_SubtitleDelay = loadedChannelSettings.m_SubtitleDelay; - g_settings.m_currentVideoSettings.m_CustomNonLinStretch = loadedChannelSettings.m_CustomNonLinStretch; - g_settings.m_currentVideoSettings.m_ScalingMethod = loadedChannelSettings.m_ScalingMethod; - g_settings.m_currentVideoSettings.m_PostProcess = loadedChannelSettings.m_PostProcess; - g_settings.m_currentVideoSettings.m_DeinterlaceMode = loadedChannelSettings.m_DeinterlaceMode; + CMediaSettings::Get().GetCurrentVideoSettings() = CMediaSettings::Get().GetDefaultVideoSettings(); + CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness = loadedChannelSettings.m_Brightness; + CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast = loadedChannelSettings.m_Contrast; + CMediaSettings::Get().GetCurrentVideoSettings().m_Gamma = loadedChannelSettings.m_Gamma; + CMediaSettings::Get().GetCurrentVideoSettings().m_Crop = loadedChannelSettings.m_Crop; + CMediaSettings::Get().GetCurrentVideoSettings().m_CropLeft = loadedChannelSettings.m_CropLeft; + CMediaSettings::Get().GetCurrentVideoSettings().m_CropRight = loadedChannelSettings.m_CropRight; + CMediaSettings::Get().GetCurrentVideoSettings().m_CropTop = loadedChannelSettings.m_CropTop; + CMediaSettings::Get().GetCurrentVideoSettings().m_CropBottom = loadedChannelSettings.m_CropBottom; + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio = loadedChannelSettings.m_CustomPixelRatio; + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = loadedChannelSettings.m_CustomZoomAmount; + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = loadedChannelSettings.m_CustomVerticalShift; + CMediaSettings::Get().GetCurrentVideoSettings().m_NoiseReduction = loadedChannelSettings.m_NoiseReduction; + CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness = loadedChannelSettings.m_Sharpness; + CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod = loadedChannelSettings.m_InterlaceMethod; + CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers = loadedChannelSettings.m_OutputToAllSpeakers; + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = loadedChannelSettings.m_AudioDelay; + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = loadedChannelSettings.m_AudioStream; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = loadedChannelSettings.m_SubtitleOn; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = loadedChannelSettings.m_SubtitleDelay; + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomNonLinStretch = loadedChannelSettings.m_CustomNonLinStretch; + CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod = loadedChannelSettings.m_ScalingMethod; + CMediaSettings::Get().GetCurrentVideoSettings().m_PostProcess = loadedChannelSettings.m_PostProcess; + CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode = loadedChannelSettings.m_DeinterlaceMode; /* only change the view mode if it's different */ - if (g_settings.m_currentVideoSettings.m_ViewMode != loadedChannelSettings.m_ViewMode) + if (CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode != loadedChannelSettings.m_ViewMode) { - g_settings.m_currentVideoSettings.m_ViewMode = loadedChannelSettings.m_ViewMode; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = loadedChannelSettings.m_ViewMode; - g_renderManager.SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode); - g_settings.m_currentVideoSettings.m_CustomZoomAmount = g_settings.m_fZoomAmount; - g_settings.m_currentVideoSettings.m_CustomPixelRatio = g_settings.m_fPixelRatio; + g_renderManager.SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = g_settings.m_fZoomAmount; + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio = g_settings.m_fPixelRatio; } /* only change the subtitle stream, if it's different */ - if (g_settings.m_currentVideoSettings.m_SubtitleStream != loadedChannelSettings.m_SubtitleStream) + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream != loadedChannelSettings.m_SubtitleStream) { - g_settings.m_currentVideoSettings.m_SubtitleStream = loadedChannelSettings.m_SubtitleStream; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream = loadedChannelSettings.m_SubtitleStream; - g_application.m_pPlayer->SetSubtitle(g_settings.m_currentVideoSettings.m_SubtitleStream); + g_application.m_pPlayer->SetSubtitle(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream); } /* only change the audio stream if it's different */ - if (g_application.m_pPlayer->GetAudioStream() != g_settings.m_currentVideoSettings.m_AudioStream && - g_settings.m_currentVideoSettings.m_AudioStream >= 0) - g_application.m_pPlayer->SetAudioStream(g_settings.m_currentVideoSettings.m_AudioStream); - - g_application.m_pPlayer->SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); - g_application.m_pPlayer->SetDynamicRangeCompression((long)(g_settings.m_currentVideoSettings.m_VolumeAmplification * 100)); - g_application.m_pPlayer->SetSubtitleVisible(g_settings.m_currentVideoSettings.m_SubtitleOn); - g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); + if (g_application.m_pPlayer->GetAudioStream() != CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream && + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream >= 0) + g_application.m_pPlayer->SetAudioStream(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream); + + g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); + g_application.m_pPlayer->SetDynamicRangeCompression((long)(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification * 100)); + g_application.m_pPlayer->SetSubtitleVisible(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); + g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); /* settings can be saved on next channel switch */ m_bIsValidChannelSettings = true; diff --git a/xbmc/settings/GUISettings.cpp b/xbmc/settings/GUISettings.cpp index 751173dec2..a5a33e678a 100644 --- a/xbmc/settings/GUISettings.cpp +++ b/xbmc/settings/GUISettings.cpp @@ -773,11 +773,11 @@ void CGUISettings::Initialize() AddInt(vp, "videoplayer.errorinaspect", 22021, 0, 0, 1, 20, SPIN_CONTROL_INT_PLUS, MASK_PERCENT, TEXT_NONE); map<int,int> stretch; - stretch.insert(make_pair(630,VIEW_MODE_NORMAL)); - stretch.insert(make_pair(633,VIEW_MODE_WIDE_ZOOM)); - stretch.insert(make_pair(634,VIEW_MODE_STRETCH_16x9)); - stretch.insert(make_pair(631,VIEW_MODE_ZOOM)); - AddInt(vp, "videoplayer.stretch43", 173, VIEW_MODE_NORMAL, stretch, SPIN_CONTROL_TEXT); + stretch.insert(make_pair(630,ViewModeNormal)); + stretch.insert(make_pair(633,ViewModeWideZoom)); + stretch.insert(make_pair(634,ViewModeStretch16x9)); + stretch.insert(make_pair(631,ViewModeZoom)); + AddInt(vp, "videoplayer.stretch43", 173, ViewModeNormal, stretch, SPIN_CONTROL_TEXT); #ifdef HAVE_LIBVDPAU AddBool(NULL, "videoplayer.vdpau_allow_xrandr", 13122, false); #endif diff --git a/xbmc/settings/Makefile b/xbmc/settings/Makefile index 800f3c5611..35f892bd6a 100644 --- a/xbmc/settings/Makefile +++ b/xbmc/settings/Makefile @@ -1,5 +1,6 @@ SRCS=AdvancedSettings.cpp \ GUISettings.cpp \ + MediaSettings.cpp \ MediaSourceSettings.cpp \ Profile.cpp \ Settings.cpp \ diff --git a/xbmc/settings/MediaSettings.cpp b/xbmc/settings/MediaSettings.cpp new file mode 100644 index 0000000000..61c426713a --- /dev/null +++ b/xbmc/settings/MediaSettings.cpp @@ -0,0 +1,211 @@ +/* + * Copyright (C) 2013 Team XBMC + * http://www.xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/>. + * + */ + +#include "MediaSettings.h" +#include "threads/SingleLock.h" +#include "utils/log.h" +#include "utils/XBMCTinyXML.h" +#include "utils/XMLUtils.h" + +using namespace std; + +CMediaSettings::CMediaSettings() +{ + m_watchedModes["movies"] = WatchedModeAll; + m_watchedModes["tvshows"] = WatchedModeAll; + m_watchedModes["musicvideos"] = WatchedModeAll; +} + +CMediaSettings::~CMediaSettings() +{ } + +CMediaSettings& CMediaSettings::Get() +{ + static CMediaSettings sMediaSettings; + return sMediaSettings; +} + +bool CMediaSettings::Load(const TiXmlNode *settings) +{ + if (settings == NULL) + return false; + + CSingleLock lock(m_critical); + const TiXmlElement *pElement = settings->FirstChildElement("defaultvideosettings"); + if (pElement != NULL) + { + int deinterlaceMode; + bool deinterlaceModePresent = XMLUtils::GetInt(pElement, "deinterlacemode", deinterlaceMode, VS_DEINTERLACEMODE_OFF, VS_DEINTERLACEMODE_FORCE); + int interlaceMethod; + bool interlaceMethodPresent = XMLUtils::GetInt(pElement, "interlacemethod", interlaceMethod, VS_INTERLACEMETHOD_AUTO, VS_INTERLACEMETHOD_MAX); + // For smooth conversion of settings stored before the deinterlaceMode existed + if (!deinterlaceModePresent && interlaceMethodPresent) + { + if (interlaceMethod == VS_INTERLACEMETHOD_NONE) + { + deinterlaceMode = VS_DEINTERLACEMODE_OFF; + interlaceMethod = VS_INTERLACEMETHOD_AUTO; + } + else if (interlaceMethod == VS_INTERLACEMETHOD_AUTO) + deinterlaceMode = VS_DEINTERLACEMODE_AUTO; + else + deinterlaceMode = VS_DEINTERLACEMODE_FORCE; + } + m_defaultVideoSettings.m_DeinterlaceMode = (EDEINTERLACEMODE)deinterlaceMode; + m_defaultVideoSettings.m_InterlaceMethod = (EINTERLACEMETHOD)interlaceMethod; + int scalingMethod; + if (!XMLUtils::GetInt(pElement, "scalingmethod", scalingMethod, VS_SCALINGMETHOD_NEAREST, VS_SCALINGMETHOD_MAX)) + scalingMethod = (int)VS_SCALINGMETHOD_LINEAR; + m_defaultVideoSettings.m_ScalingMethod = (ESCALINGMETHOD)scalingMethod; + + XMLUtils::GetInt(pElement, "viewmode", m_defaultVideoSettings.m_ViewMode, ViewModeNormal, ViewModeCustom); + if (!XMLUtils::GetFloat(pElement, "zoomamount", m_defaultVideoSettings.m_CustomZoomAmount, 0.5f, 2.0f)) + m_defaultVideoSettings.m_CustomZoomAmount = 1.0f; + if (!XMLUtils::GetFloat(pElement, "pixelratio", m_defaultVideoSettings.m_CustomPixelRatio, 0.5f, 2.0f)) + m_defaultVideoSettings.m_CustomPixelRatio = 1.0f; + if (!XMLUtils::GetFloat(pElement, "verticalshift", m_defaultVideoSettings.m_CustomVerticalShift, -2.0f, 2.0f)) + m_defaultVideoSettings.m_CustomVerticalShift = 0.0f; + if (!XMLUtils::GetFloat(pElement, "volumeamplification", m_defaultVideoSettings.m_VolumeAmplification, VOLUME_DRC_MINIMUM * 0.01f, VOLUME_DRC_MAXIMUM * 0.01f)) + m_defaultVideoSettings.m_VolumeAmplification = VOLUME_DRC_MINIMUM * 0.01f; + if (!XMLUtils::GetFloat(pElement, "noisereduction", m_defaultVideoSettings.m_NoiseReduction, 0.0f, 1.0f)) + m_defaultVideoSettings.m_NoiseReduction = 0.0f; + XMLUtils::GetBoolean(pElement, "postprocess", m_defaultVideoSettings.m_PostProcess); + if (!XMLUtils::GetFloat(pElement, "sharpness", m_defaultVideoSettings.m_Sharpness, -1.0f, 1.0f)) + m_defaultVideoSettings.m_Sharpness = 0.0f; + XMLUtils::GetBoolean(pElement, "outputtoallspeakers", m_defaultVideoSettings.m_OutputToAllSpeakers); + XMLUtils::GetBoolean(pElement, "showsubtitles", m_defaultVideoSettings.m_SubtitleOn); + if (!XMLUtils::GetFloat(pElement, "brightness", m_defaultVideoSettings.m_Brightness, 0, 100)) + m_defaultVideoSettings.m_Brightness = 50; + if (!XMLUtils::GetFloat(pElement, "contrast", m_defaultVideoSettings.m_Contrast, 0, 100)) + m_defaultVideoSettings.m_Contrast = 50; + if (!XMLUtils::GetFloat(pElement, "gamma", m_defaultVideoSettings.m_Gamma, 0, 100)) + m_defaultVideoSettings.m_Gamma = 20; + if (!XMLUtils::GetFloat(pElement, "audiodelay", m_defaultVideoSettings.m_AudioDelay, -10.0f, 10.0f)) + m_defaultVideoSettings.m_AudioDelay = 0.0f; + if (!XMLUtils::GetFloat(pElement, "subtitledelay", m_defaultVideoSettings.m_SubtitleDelay, -10.0f, 10.0f)) + m_defaultVideoSettings.m_SubtitleDelay = 0.0f; + XMLUtils::GetBoolean(pElement, "autocrop", m_defaultVideoSettings.m_Crop); + XMLUtils::GetBoolean(pElement, "nonlinstretch", m_defaultVideoSettings.m_CustomNonLinStretch); + + m_defaultVideoSettings.m_SubtitleCached = false; + } + + // Read the watchmode settings for the various media views + pElement = settings->FirstChildElement("myvideos"); + if (pElement != NULL) + { + int tmp; + if (XMLUtils::GetInt(pElement, "watchmodemovies", tmp, (int)WatchedModeAll, (int)WatchedModeWatched)) + m_watchedModes["movies"] = (WatchedMode)tmp; + if (XMLUtils::GetInt(pElement, "watchmodetvshows", tmp, (int)WatchedModeAll, (int)WatchedModeWatched)) + m_watchedModes["tvshows"] = (WatchedMode)tmp; + if (XMLUtils::GetInt(pElement, "watchmodemusicvideos", tmp, (int)WatchedModeAll, (int)WatchedModeWatched)) + m_watchedModes["musicvideos"] = (WatchedMode)tmp; + } + + return true; +} + +bool CMediaSettings::Save(TiXmlNode *settings) const +{ + if (settings == NULL) + return false; + + CSingleLock lock(m_critical); + // default video settings + TiXmlElement videoSettingsNode("defaultvideosettings"); + TiXmlNode *pNode = settings->InsertEndChild(videoSettingsNode); + if (pNode == NULL) + return false; + + XMLUtils::SetInt(pNode, "deinterlacemode", m_defaultVideoSettings.m_DeinterlaceMode); + XMLUtils::SetInt(pNode, "interlacemethod", m_defaultVideoSettings.m_InterlaceMethod); + XMLUtils::SetInt(pNode, "scalingmethod", m_defaultVideoSettings.m_ScalingMethod); + XMLUtils::SetFloat(pNode, "noisereduction", m_defaultVideoSettings.m_NoiseReduction); + XMLUtils::SetBoolean(pNode, "postprocess", m_defaultVideoSettings.m_PostProcess); + XMLUtils::SetFloat(pNode, "sharpness", m_defaultVideoSettings.m_Sharpness); + XMLUtils::SetInt(pNode, "viewmode", m_defaultVideoSettings.m_ViewMode); + XMLUtils::SetFloat(pNode, "zoomamount", m_defaultVideoSettings.m_CustomZoomAmount); + XMLUtils::SetFloat(pNode, "pixelratio", m_defaultVideoSettings.m_CustomPixelRatio); + XMLUtils::SetFloat(pNode, "verticalshift", m_defaultVideoSettings.m_CustomVerticalShift); + XMLUtils::SetFloat(pNode, "volumeamplification", m_defaultVideoSettings.m_VolumeAmplification); + XMLUtils::SetBoolean(pNode, "outputtoallspeakers", m_defaultVideoSettings.m_OutputToAllSpeakers); + XMLUtils::SetBoolean(pNode, "showsubtitles", m_defaultVideoSettings.m_SubtitleOn); + XMLUtils::SetFloat(pNode, "brightness", m_defaultVideoSettings.m_Brightness); + XMLUtils::SetFloat(pNode, "contrast", m_defaultVideoSettings.m_Contrast); + XMLUtils::SetFloat(pNode, "gamma", m_defaultVideoSettings.m_Gamma); + XMLUtils::SetFloat(pNode, "audiodelay", m_defaultVideoSettings.m_AudioDelay); + XMLUtils::SetFloat(pNode, "subtitledelay", m_defaultVideoSettings.m_SubtitleDelay); + XMLUtils::SetBoolean(pNode, "autocrop", m_defaultVideoSettings.m_Crop); + XMLUtils::SetBoolean(pNode, "nonlinstretch", m_defaultVideoSettings.m_CustomNonLinStretch); + + pNode = settings->FirstChild("myvideos"); + if (pNode == NULL) + { + TiXmlElement videosNode("myvideos"); + pNode = settings->InsertEndChild(videosNode); + if (pNode == NULL) + return false; + } + + XMLUtils::SetInt(pNode, "watchmodemovies", m_watchedModes.find("movies")->second); + XMLUtils::SetInt(pNode, "watchmodetvshows", m_watchedModes.find("tvshows")->second); + XMLUtils::SetInt(pNode, "watchmodemusicvideos", m_watchedModes.find("musicvideos")->second); + + return true; +} + +int CMediaSettings::GetWatchedMode(const std::string &content) const +{ + CSingleLock lock(m_critical); + WatchedModes::const_iterator it = m_watchedModes.find(GetWatchedContent(content)); + if (it != m_watchedModes.end()) + return it->second; + + return WatchedModeAll; +} + +void CMediaSettings::SetWatchedMode(const std::string &content, WatchedMode mode) +{ + CSingleLock lock(m_critical); + WatchedModes::iterator it = m_watchedModes.find(GetWatchedContent(content)); + if (it != m_watchedModes.end()) + it->second = mode; +} + +void CMediaSettings::CycleWatchedMode(const std::string &content) +{ + CSingleLock lock(m_critical); + WatchedModes::iterator it = m_watchedModes.find(GetWatchedContent(content)); + if (it != m_watchedModes.end()) + { + it->second = (WatchedMode)((int)it->second + 1); + if (it->second > WatchedModeWatched) + it->second = WatchedModeAll; + } +} + +std::string CMediaSettings::GetWatchedContent(const std::string &content) +{ + if (content == "seasons" || content == "episodes") + return "tvshows"; + + return content; +} diff --git a/xbmc/settings/MediaSettings.h b/xbmc/settings/MediaSettings.h new file mode 100644 index 0000000000..9b29fc7268 --- /dev/null +++ b/xbmc/settings/MediaSettings.h @@ -0,0 +1,89 @@ +#pragma once +/* + * Copyright (C) 2013 Team XBMC + * http://www.xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/>. + * + */ + +#include <map> +#include <string> + +#include "settings/ISubSettings.h" +#include "settings/VideoSettings.h" +#include "threads/CriticalSection.h" + +#define VOLUME_DRC_MINIMUM 0 // 0dB +#define VOLUME_DRC_MAXIMUM 6000 // 60dB + +class TiXmlNode; + +typedef enum { + WatchedModeAll = 0, + WatchedModeUnwatched, + WatchedModeWatched +} WatchedMode; + +class CMediaSettings : public ISubSettings +{ +public: + static CMediaSettings& Get(); + + virtual bool Load(const TiXmlNode *settings); + virtual bool Save(TiXmlNode *settings) const; + + const CVideoSettings& GetDefaultVideoSettings() const { return m_defaultVideoSettings; } + CVideoSettings& GetDefaultVideoSettings() { return m_defaultVideoSettings; } + const CVideoSettings& GetCurrentVideoSettings() const { return m_currentVideoSettings; } + CVideoSettings& GetCurrentVideoSettings() { return m_currentVideoSettings; } + + /*! \brief Retreive the watched mode for the given content type + \param content Current content type + \return the current watch mode for this content type, WATCH_MODE_ALL if the content type is unknown. + \sa SetWatchMode + */ + int GetWatchedMode(const std::string &content) const; + + /*! \brief Set the watched mode for the given content type + \param content Current content type + \param value Watched mode to set + \sa GetWatchMode + */ + void SetWatchedMode(const std::string &content, WatchedMode mode); + + /*! \brief Cycle the watched mode for the given content type + \param content Current content type + \sa GetWatchMode, SetWatchMode + */ + void CycleWatchedMode(const std::string &content); + +protected: + CMediaSettings(); + CMediaSettings(const CMediaSettings&); + CMediaSettings const& operator=(CMediaSettings const&); + virtual ~CMediaSettings(); + + static std::string GetWatchedContent(const std::string &content); + +private: + CVideoSettings m_defaultVideoSettings; + CVideoSettings m_currentVideoSettings; + + typedef std::map<std::string, WatchedMode> WatchedModes; + WatchedModes m_watchedModes; + + CCriticalSection m_critical; +}; diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp index 3b25918c1b..8f18e00169 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -157,10 +157,6 @@ void CSettings::Initialize() m_iMyMusicStartWindow = WINDOW_MUSIC_FILES; m_iVideoStartWindow = WINDOW_VIDEO_FILES; - m_watchMode["movies"] = VIDEO_SHOW_ALL; - m_watchMode["tvshows"] = VIDEO_SHOW_ALL; - m_watchMode["musicvideos"] = VIDEO_SHOW_ALL; - m_iSystemTimeTotalUp = 0; m_userAgent = g_sysinfo.GetUserAgent(); @@ -472,18 +468,13 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile) GetInteger(pElement, "needsupdate", m_musicNeedsUpdate, 0, 0, INT_MAX); GetPath(pElement, "defaultlibview", m_defaultMusicLibSource); } + // myvideos settings pElement = pRootElement->FirstChildElement("myvideos"); if (pElement) { GetInteger(pElement, "startwindow", m_iVideoStartWindow, WINDOW_VIDEO_FILES, WINDOW_VIDEO_FILES, WINDOW_VIDEO_NAV); XMLUtils::GetBoolean(pElement, "stackvideos", m_videoStacking); - - // Read the watchmode settings for the various media views - GetInteger(pElement, "watchmodemovies", m_watchMode["movies"], VIDEO_SHOW_ALL, VIDEO_SHOW_ALL, VIDEO_SHOW_WATCHED); - GetInteger(pElement, "watchmodetvshows", m_watchMode["tvshows"], VIDEO_SHOW_ALL, VIDEO_SHOW_ALL, VIDEO_SHOW_WATCHED); - GetInteger(pElement, "watchmodemusicvideos", m_watchMode["musicvideos"], VIDEO_SHOW_ALL, VIDEO_SHOW_ALL, VIDEO_SHOW_WATCHED); - XMLUtils::GetBoolean(pElement, "flatten", m_bMyVideoNavFlatten); GetInteger(pElement, "needsupdate", m_videoNeedsUpdate, 0, 0, INT_MAX); @@ -505,56 +496,6 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile) XMLUtils::GetBoolean(pElement, "addonforeignfilter", m_bAddonForeignFilter); } - pElement = pRootElement->FirstChildElement("defaultvideosettings"); - if (pElement) - { - int deinterlaceMode; - bool deinterlaceModePresent = GetInteger(pElement, "deinterlacemode", deinterlaceMode, VS_DEINTERLACEMODE_OFF, VS_DEINTERLACEMODE_OFF, VS_DEINTERLACEMODE_FORCE); - int interlaceMethod; - bool interlaceMethodPresent = GetInteger(pElement, "interlacemethod", interlaceMethod, VS_INTERLACEMETHOD_AUTO, VS_INTERLACEMETHOD_AUTO, VS_INTERLACEMETHOD_MAX); - // For smooth conversion of settings stored before the deinterlaceMode existed - if (!deinterlaceModePresent && interlaceMethodPresent) - { - if (interlaceMethod == VS_INTERLACEMETHOD_NONE) - { - deinterlaceMode = VS_DEINTERLACEMODE_OFF; - interlaceMethod = VS_INTERLACEMETHOD_AUTO; - } - else if (interlaceMethod == VS_INTERLACEMETHOD_AUTO) - { - deinterlaceMode = VS_DEINTERLACEMODE_AUTO; - } - else - { - deinterlaceMode = VS_DEINTERLACEMODE_FORCE; - } - } - m_defaultVideoSettings.m_DeinterlaceMode = (EDEINTERLACEMODE)deinterlaceMode; - m_defaultVideoSettings.m_InterlaceMethod = (EINTERLACEMETHOD)interlaceMethod; - int scalingMethod; - GetInteger(pElement, "scalingmethod", scalingMethod, VS_SCALINGMETHOD_LINEAR, VS_SCALINGMETHOD_NEAREST, VS_SCALINGMETHOD_MAX); - m_defaultVideoSettings.m_ScalingMethod = (ESCALINGMETHOD)scalingMethod; - - GetInteger(pElement, "viewmode", m_defaultVideoSettings.m_ViewMode, VIEW_MODE_NORMAL, VIEW_MODE_NORMAL, VIEW_MODE_CUSTOM); - GetFloat(pElement, "zoomamount", m_defaultVideoSettings.m_CustomZoomAmount, 1.0f, 0.5f, 2.0f); - GetFloat(pElement, "pixelratio", m_defaultVideoSettings.m_CustomPixelRatio, 1.0f, 0.5f, 2.0f); - GetFloat(pElement, "verticalshift", m_defaultVideoSettings.m_CustomVerticalShift, 0.0f, -2.0f, 2.0f); - GetFloat(pElement, "volumeamplification", m_defaultVideoSettings.m_VolumeAmplification, VOLUME_DRC_MINIMUM * 0.01f, VOLUME_DRC_MINIMUM * 0.01f, VOLUME_DRC_MAXIMUM * 0.01f); - GetFloat(pElement, "noisereduction", m_defaultVideoSettings.m_NoiseReduction, 0.0f, 0.0f, 1.0f); - XMLUtils::GetBoolean(pElement, "postprocess", m_defaultVideoSettings.m_PostProcess); - GetFloat(pElement, "sharpness", m_defaultVideoSettings.m_Sharpness, 0.0f, -1.0f, 1.0f); - XMLUtils::GetBoolean(pElement, "outputtoallspeakers", m_defaultVideoSettings.m_OutputToAllSpeakers); - XMLUtils::GetBoolean(pElement, "showsubtitles", m_defaultVideoSettings.m_SubtitleOn); - GetFloat(pElement, "brightness", m_defaultVideoSettings.m_Brightness, 50, 0, 100); - GetFloat(pElement, "contrast", m_defaultVideoSettings.m_Contrast, 50, 0, 100); - GetFloat(pElement, "gamma", m_defaultVideoSettings.m_Gamma, 20, 0, 100); - GetFloat(pElement, "audiodelay", m_defaultVideoSettings.m_AudioDelay, 0.0f, -10.0f, 10.0f); - GetFloat(pElement, "subtitledelay", m_defaultVideoSettings.m_SubtitleDelay, 0.0f, -10.0f, 10.0f); - XMLUtils::GetBoolean(pElement, "autocrop", m_defaultVideoSettings.m_Crop); - XMLUtils::GetBoolean(pElement, "nonlinstretch", m_defaultVideoSettings.m_CustomNonLinStretch); - - m_defaultVideoSettings.m_SubtitleCached = false; - } // audio settings pElement = pRootElement->FirstChildElement("audio"); if (pElement) @@ -607,10 +548,6 @@ bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *lo XMLUtils::SetInt(pNode, "startwindow", m_iVideoStartWindow); XMLUtils::SetBoolean(pNode, "stackvideos", m_videoStacking); - - XMLUtils::SetInt(pNode, "watchmodemovies", m_watchMode.find("movies")->second); - XMLUtils::SetInt(pNode, "watchmodetvshows", m_watchMode.find("tvshows")->second); - XMLUtils::SetInt(pNode, "watchmodemusicvideos", m_watchMode.find("musicvideos")->second); XMLUtils::SetInt(pNode, "needsupdate", m_videoNeedsUpdate); XMLUtils::SetBoolean(pNode, "flatten", m_bMyVideoNavFlatten); @@ -631,32 +568,6 @@ bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *lo XMLUtils::SetBoolean(pNode, "addonnotifications", m_bAddonNotifications); XMLUtils::SetBoolean(pNode, "addonforeignfilter", m_bAddonForeignFilter); - // default video settings - TiXmlElement videoSettingsNode("defaultvideosettings"); - pNode = pRoot->InsertEndChild(videoSettingsNode); - if (!pNode) return false; - XMLUtils::SetInt(pNode, "deinterlacemode", m_defaultVideoSettings.m_DeinterlaceMode); - XMLUtils::SetInt(pNode, "interlacemethod", m_defaultVideoSettings.m_InterlaceMethod); - XMLUtils::SetInt(pNode, "scalingmethod", m_defaultVideoSettings.m_ScalingMethod); - XMLUtils::SetFloat(pNode, "noisereduction", m_defaultVideoSettings.m_NoiseReduction); - XMLUtils::SetBoolean(pNode, "postprocess", m_defaultVideoSettings.m_PostProcess); - XMLUtils::SetFloat(pNode, "sharpness", m_defaultVideoSettings.m_Sharpness); - XMLUtils::SetInt(pNode, "viewmode", m_defaultVideoSettings.m_ViewMode); - XMLUtils::SetFloat(pNode, "zoomamount", m_defaultVideoSettings.m_CustomZoomAmount); - XMLUtils::SetFloat(pNode, "pixelratio", m_defaultVideoSettings.m_CustomPixelRatio); - XMLUtils::SetFloat(pNode, "verticalshift", m_defaultVideoSettings.m_CustomVerticalShift); - XMLUtils::SetFloat(pNode, "volumeamplification", m_defaultVideoSettings.m_VolumeAmplification); - XMLUtils::SetBoolean(pNode, "outputtoallspeakers", m_defaultVideoSettings.m_OutputToAllSpeakers); - XMLUtils::SetBoolean(pNode, "showsubtitles", m_defaultVideoSettings.m_SubtitleOn); - XMLUtils::SetFloat(pNode, "brightness", m_defaultVideoSettings.m_Brightness); - XMLUtils::SetFloat(pNode, "contrast", m_defaultVideoSettings.m_Contrast); - XMLUtils::SetFloat(pNode, "gamma", m_defaultVideoSettings.m_Gamma); - XMLUtils::SetFloat(pNode, "audiodelay", m_defaultVideoSettings.m_AudioDelay); - XMLUtils::SetFloat(pNode, "subtitledelay", m_defaultVideoSettings.m_SubtitleDelay); - XMLUtils::SetBoolean(pNode, "autocrop", m_defaultVideoSettings.m_Crop); - XMLUtils::SetBoolean(pNode, "nonlinstretch", m_defaultVideoSettings.m_CustomNonLinStretch); - - // audio settings TiXmlElement volumeNode("audio"); pNode = pRoot->InsertEndChild(volumeNode); @@ -894,32 +805,6 @@ static CStdString ToWatchContent(const CStdString &content) return content; } -int CSettings::GetWatchMode(const CStdString& content) const -{ - std::map<CStdString, int>::iterator it = g_settings.m_watchMode.find(ToWatchContent(content)); - if (it != g_settings.m_watchMode.end()) - return it->second; - return VIDEO_SHOW_ALL; -} - -void CSettings::SetWatchMode(const CStdString& content, int value) -{ - std::map<CStdString, int>::iterator it = g_settings.m_watchMode.find(ToWatchContent(content)); - if (it != g_settings.m_watchMode.end()) - it->second = value; -} - -void CSettings::CycleWatchMode(const CStdString& content) -{ - std::map<CStdString, int>::iterator it = g_settings.m_watchMode.find(ToWatchContent(content)); - if (it != g_settings.m_watchMode.end()) - { - it->second++; - if (it->second > VIDEO_SHOW_WATCHED) - it->second = VIDEO_SHOW_ALL; - } -} - void CSettings::LoadUserFolderLayout() { // check them all diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h index 032ca4b4dd..19729791fe 100644 --- a/xbmc/settings/Settings.h +++ b/xbmc/settings/Settings.h @@ -63,20 +63,6 @@ #define VOLUME_MAXIMUM 1.0f // 0dB #define VOLUME_DYNAMIC_RANGE 90.0f // 60dB #define VOLUME_CONTROL_STEPS 90 // 90 steps -#define VOLUME_DRC_MINIMUM 0 // 0dB -#define VOLUME_DRC_MAXIMUM 6000 // 60dB - -#define VIEW_MODE_NORMAL 0 -#define VIEW_MODE_ZOOM 1 -#define VIEW_MODE_STRETCH_4x3 2 -#define VIEW_MODE_WIDE_ZOOM 3 -#define VIEW_MODE_STRETCH_16x9 4 -#define VIEW_MODE_ORIGINAL 5 -#define VIEW_MODE_CUSTOM 6 - -#define VIDEO_SHOW_ALL 0 -#define VIDEO_SHOW_UNWATCHED 1 -#define VIDEO_SHOW_WATCHED 2 /* FIXME: eventually the profile should dictate where special://masterprofile/ is but for now it makes sense to leave all the profile settings in a user writeable location @@ -110,26 +96,6 @@ public: bool DeleteProfile(unsigned int index); void CreateProfileFolders(); - /*! \brief Retreive the watched mode for the given content type - \param content Current content type - \return the current watch mode for this content type, WATCH_MODE_ALL if the content type is unknown. - \sa SetWatchMode, IncrementWatchMode - */ - int GetWatchMode(const CStdString& content) const; - - /*! \brief Set the watched mode for the given content type - \param content Current content type - \param value Watched mode to set - \sa GetWatchMode, IncrementWatchMode - */ - void SetWatchMode(const CStdString& content, int value); - - /*! \brief Cycle the watched mode for the given content type - \param content Current content type - \sa GetWatchMode, SetWatchMode - */ - void CycleWatchMode(const CStdString& content); - CStdString m_pictureExtensions; CStdString m_musicExtensions; CStdString m_videoExtensions; @@ -143,9 +109,6 @@ public: bool m_bMyMusicPlaylistShuffle; int m_iMyMusicStartWindow; - CVideoSettings m_defaultVideoSettings; - CVideoSettings m_currentVideoSettings; - float m_fZoomAmount; // current zoom amount float m_fPixelRatio; // current pixel ratio float m_fVerticalShift; // current vertical shift @@ -326,7 +289,6 @@ private: SubSettings m_subSettings; std::vector<CProfile> m_vecProfiles; - std::map<CStdString, int> m_watchMode; bool m_usingLoginScreen; unsigned int m_lastUsedProfile; unsigned int m_currentProfile; diff --git a/xbmc/settings/VideoSettings.cpp b/xbmc/settings/VideoSettings.cpp index 5b5ead0db0..556288e8af 100644 --- a/xbmc/settings/VideoSettings.cpp +++ b/xbmc/settings/VideoSettings.cpp @@ -33,7 +33,7 @@ CVideoSettings::CVideoSettings() m_DeinterlaceMode = VS_DEINTERLACEMODE_OFF; m_InterlaceMethod = VS_INTERLACEMETHOD_AUTO; m_ScalingMethod = VS_SCALINGMETHOD_LINEAR; - m_ViewMode = VIEW_MODE_NORMAL; + m_ViewMode = ViewModeNormal; m_CustomZoomAmount = 1.0f; m_CustomPixelRatio = 1.0f; m_CustomVerticalShift = 0.0f; diff --git a/xbmc/settings/VideoSettings.h b/xbmc/settings/VideoSettings.h index fe4f0032c5..3ca4c8b89f 100644 --- a/xbmc/settings/VideoSettings.h +++ b/xbmc/settings/VideoSettings.h @@ -94,6 +94,16 @@ enum ESCALINGMETHOD VS_SCALINGMETHOD_MAX // do not use and keep as last enum value. }; +typedef enum { + ViewModeNormal = 0, + ViewModeZoom, + ViewModeStretch4x3, + ViewModeWideZoom, + ViewModeStretch16x9, + ViewModeOriginal, + ViewModeCustom +} ViewMode; + class CVideoSettings { public: diff --git a/xbmc/utils/SaveFileStateJob.h b/xbmc/utils/SaveFileStateJob.h index 6839005ce3..0d24dff601 100644 --- a/xbmc/utils/SaveFileStateJob.h +++ b/xbmc/utils/SaveFileStateJob.h @@ -6,6 +6,7 @@ #include "FileItem.h" #include "pvr/PVRManager.h" #include "pvr/recordings/PVRRecordings.h" +#include "settings/MediaSettings.h" class CSaveFileStateJob : public CJob { @@ -91,9 +92,9 @@ bool CSaveFileStateJob::DoWork() } } - if (g_settings.m_currentVideoSettings != g_settings.m_defaultVideoSettings) + if (CMediaSettings::Get().GetCurrentVideoSettings() != CMediaSettings::Get().GetDefaultVideoSettings()) { - videodatabase.SetVideoSettings(progressTrackingFile, g_settings.m_currentVideoSettings); + videodatabase.SetVideoSettings(progressTrackingFile, CMediaSettings::Get().GetCurrentVideoSettings()); } if (m_item.HasVideoInfoTag() && m_item.GetVideoInfoTag()->HasStreamDetails()) diff --git a/xbmc/video/GUIViewStateVideo.cpp b/xbmc/video/GUIViewStateVideo.cpp index 998f4372e3..18baf2ce62 100644 --- a/xbmc/video/GUIViewStateVideo.cpp +++ b/xbmc/video/GUIViewStateVideo.cpp @@ -27,6 +27,7 @@ #include "VideoDatabase.h" #include "settings/GUISettings.h" #include "settings/AdvancedSettings.h" +#include "settings/MediaSettings.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "FileItem.h" @@ -206,7 +207,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it AddSortMethod(SORT_METHOD_VIDEO_RATING, 563, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating AddSortMethod(SORT_METHOD_DATEADDED, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded - if (g_settings.GetWatchMode(items.GetContent()) == VIDEO_SHOW_ALL) + if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll) AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount SetSortMethod(SORT_METHOD_LABEL_IGNORE_THE); @@ -240,7 +241,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it AddSortMethod(SORT_METHOD_PRODUCTIONCODE, 20368, LABEL_MASKS("%E. %T","%P", "%E. %T","%P")); // Episode. Title, ProductionCode | Episode. Title, ProductionCode AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%E. %T","%J","%E. %T","%J")); // Episode. Title, Date | Episode. Title, Date - if (g_settings.GetWatchMode(items.GetContent()) == VIDEO_SHOW_ALL) + if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll) AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%E. %T", "%V")); // Episode. Title, Playcount | empty, empty } else @@ -251,7 +252,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it AddSortMethod(SORT_METHOD_PRODUCTIONCODE, 20368, LABEL_MASKS("%H. %T","%P", "%H. %T","%P")); // Order. Title, ProductionCode | Episode. Title, ProductionCode AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%H. %T","%J","%H. %T","%J")); // Order. Title, Date | Episode. Title, Date - if (g_settings.GetWatchMode(items.GetContent()) == VIDEO_SHOW_ALL) + if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll) AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%H. %T", "%V")); // Order. Title, Playcount | empty, empty } if (g_guiSettings.GetBool("filelists.ignorethewhensorting")) @@ -300,7 +301,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it AddSortMethod(SORT_METHOD_VIDEO_RUNTIME, 180, LABEL_MASKS("%T", "%D")); // Title, Duration | empty, empty AddSortMethod(SORT_METHOD_DATEADDED, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded - if (g_settings.GetWatchMode(items.GetContent()) == VIDEO_SHOW_ALL) + if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll) AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount CViewState *viewState = CViewStateSettings::Get().Get("videonavtitles"); @@ -332,7 +333,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%B - %T", "%Y")); // Album - Title, Year | empty, empty } - if (g_settings.GetWatchMode(items.GetContent()) == VIDEO_SHOW_ALL) + if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll) AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%T", "%V")); // Title, Playcount | empty, empty CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat"); diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index b67bb41b63..43957e61c0 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -41,6 +41,7 @@ #include "FileItem.h" #include "settings/AdvancedSettings.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "utils/StringUtils.h" @@ -4090,7 +4091,7 @@ bool CVideoDatabase::UpdateOldVersion(int iVersion) if (iVersion < 50) { m_pDS->exec("ALTER TABLE settings ADD ScalingMethod integer"); - m_pDS->exec(PrepareSQL("UPDATE settings set ScalingMethod=%i", g_settings.m_defaultVideoSettings.m_ScalingMethod)); + m_pDS->exec(PrepareSQL("UPDATE settings set ScalingMethod=%i", CMediaSettings::Get().GetDefaultVideoSettings().m_ScalingMethod)); } if (iVersion < 51) { diff --git a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp index adecd7cb08..7b9396485d 100644 --- a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp +++ b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp @@ -34,6 +34,7 @@ #include "settings/AdvancedSettings.h" #include "settings/Settings.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "settings/MediaSourceSettings.h" #include "guilib/LocalizeStrings.h" #include "pvr/PVRManager.h" @@ -87,20 +88,20 @@ void CGUIDialogAudioSubtitleSettings::CreateSettings() m_volume = g_settings.m_fVolumeLevel; AddSlider(AUDIO_SETTINGS_VOLUME, 13376, &m_volume, VOLUME_MINIMUM, VOLUME_MAXIMUM / 100.0f, VOLUME_MAXIMUM, PercentAsDecibel, false); if (SupportsAudioFeature(IPC_AUD_AMP)) - AddSlider(AUDIO_SETTINGS_VOLUME_AMPLIFICATION, 660, &g_settings.m_currentVideoSettings.m_VolumeAmplification, VOLUME_DRC_MINIMUM * 0.01f, (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) / 6000.0f, VOLUME_DRC_MAXIMUM * 0.01f, FormatDecibel, false); + AddSlider(AUDIO_SETTINGS_VOLUME_AMPLIFICATION, 660, &CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, VOLUME_DRC_MINIMUM * 0.01f, (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) / 6000.0f, VOLUME_DRC_MAXIMUM * 0.01f, FormatDecibel, false); if (g_application.m_pPlayer && g_application.m_pPlayer->IsPassthrough()) { EnableSettings(AUDIO_SETTINGS_VOLUME,false); EnableSettings(AUDIO_SETTINGS_VOLUME_AMPLIFICATION,false); } if (SupportsAudioFeature(IPC_AUD_OFFSET)) - AddSlider(AUDIO_SETTINGS_DELAY, 297, &g_settings.m_currentVideoSettings.m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, .025f, g_advancedSettings.m_videoAudioDelayRange, FormatDelay); + AddSlider(AUDIO_SETTINGS_DELAY, 297, &CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, .025f, g_advancedSettings.m_videoAudioDelayRange, FormatDelay); if (SupportsAudioFeature(IPC_AUD_SELECT_STREAM)) AddAudioStreams(AUDIO_SETTINGS_STREAM); // only show stuff available in digital mode if we have digital output if (SupportsAudioFeature(IPC_AUD_OUTPUT_STEREO)) - AddBool(AUDIO_SETTINGS_OUTPUT_TO_ALL_SPEAKERS, 252, &g_settings.m_currentVideoSettings.m_OutputToAllSpeakers, AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode"))); + AddBool(AUDIO_SETTINGS_OUTPUT_TO_ALL_SPEAKERS, 252, &CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers, AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode"))); int settings[3] = { 338, 339, 420 }; //ANALOG, IEC958, HDMI m_outputmode = g_guiSettings.GetInt("audiooutput.mode"); @@ -111,7 +112,7 @@ void CGUIDialogAudioSubtitleSettings::CreateSettings() m_subtitleVisible = g_application.m_pPlayer->GetSubtitleVisible(); AddBool(SUBTITLE_SETTINGS_ENABLE, 13397, &m_subtitleVisible); if (SupportsSubtitleFeature(IPC_SUBS_OFFSET)) - AddSlider(SUBTITLE_SETTINGS_DELAY, 22006, &g_settings.m_currentVideoSettings.m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange, FormatDelay); + AddSlider(SUBTITLE_SETTINGS_DELAY, 22006, &CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange, FormatDelay); if (SupportsSubtitleFeature(IPC_SUBS_SELECT)) AddSubtitleStreams(SUBTITLE_SETTINGS_STREAM); if (SupportsSubtitleFeature(IPC_SUBS_EXTERNAL)) @@ -146,14 +147,14 @@ void CGUIDialogAudioSubtitleSettings::AddAudioStreams(unsigned int id) bool bAC3 = strstr(strAudioCodec.c_str(), "AC3") != 0; if (iNumChannels == 2 && !(bDTS || bAC3)) { // ok, enable these options -/* if (g_settings.m_currentVideoSettings.m_AudioStream == -1) +/* if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream == -1) { // default to stereo stream - g_settings.m_currentVideoSettings.m_AudioStream = 0; + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = 0; }*/ setting.max = 2; for (int i = 0; i <= setting.max; i++) setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(13320 + i))); - m_audioStream = -g_settings.m_currentVideoSettings.m_AudioStream - 1; + m_audioStream = -CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream - 1; m_settings.push_back(setting); return; } @@ -241,12 +242,12 @@ void CGUIDialogAudioSubtitleSettings::OnSettingChanged(SettingInfo &setting) else if (setting.id == AUDIO_SETTINGS_VOLUME_AMPLIFICATION) { if (g_application.m_pPlayer) - g_application.m_pPlayer->SetDynamicRangeCompression((long)(g_settings.m_currentVideoSettings.m_VolumeAmplification * 100)); + g_application.m_pPlayer->SetDynamicRangeCompression((long)(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification * 100)); } else if (setting.id == AUDIO_SETTINGS_DELAY) { if (g_application.m_pPlayer) - g_application.m_pPlayer->SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); + g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); } else if (setting.id == AUDIO_SETTINGS_STREAM) { @@ -256,16 +257,16 @@ void CGUIDialogAudioSubtitleSettings::OnSettingChanged(SettingInfo &setting) if (setting.max == 2) { // we're in the case we want - call the code to switch channels etc. // update the screen setting... - g_settings.m_currentVideoSettings.m_AudioStream = -1 - m_audioStream; + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = -1 - m_audioStream; // call monkeyh1's code here... - //bool bAudioOnAllSpeakers = (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_IEC958) && g_settings.m_currentVideoSettings.m_OutputToAllSpeakers; + //bool bAudioOnAllSpeakers = (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_IEC958) && CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers; return; } } // only change the audio stream if a different one has been asked for if (g_application.m_pPlayer->GetAudioStream() != m_audioStream) { - g_settings.m_currentVideoSettings.m_AudioStream = m_audioStream; + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = m_audioStream; g_application.m_pPlayer->SetAudioStream(m_audioStream); // Set the audio stream to the one selected EnableSettings(AUDIO_SETTINGS_VOLUME, !g_application.m_pPlayer->IsPassthrough()); } @@ -291,16 +292,16 @@ void CGUIDialogAudioSubtitleSettings::OnSettingChanged(SettingInfo &setting) } else if (setting.id == SUBTITLE_SETTINGS_ENABLE) { - g_settings.m_currentVideoSettings.m_SubtitleOn = m_subtitleVisible; - g_application.m_pPlayer->SetSubtitleVisible(g_settings.m_currentVideoSettings.m_SubtitleOn); + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = m_subtitleVisible; + g_application.m_pPlayer->SetSubtitleVisible(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); } else if (setting.id == SUBTITLE_SETTINGS_DELAY) { - g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); + g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); } else if (setting.id == SUBTITLE_SETTINGS_STREAM && setting.max > 0) { - g_settings.m_currentVideoSettings.m_SubtitleStream = m_subtitleStream; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream = m_subtitleStream; g_application.m_pPlayer->SetSubtitle(m_subtitleStream); } else if (setting.id == SUBTITLE_SETTINGS_BROWSER) @@ -345,7 +346,7 @@ void CGUIDialogAudioSubtitleSettings::OnSettingChanged(SettingInfo &setting) g_application.m_pPlayer->SetSubtitle(m_subtitleStream); g_application.m_pPlayer->SetSubtitleVisible(true); } - g_settings.m_currentVideoSettings.m_SubtitleCached = true; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleCached = true; Close(); } } @@ -363,9 +364,9 @@ void CGUIDialogAudioSubtitleSettings::OnSettingChanged(SettingInfo &setting) db.Open(); db.EraseVideoSettings(); db.Close(); - g_settings.m_defaultVideoSettings = g_settings.m_currentVideoSettings; - g_settings.m_defaultVideoSettings.m_SubtitleStream = -1; - g_settings.m_defaultVideoSettings.m_AudioStream = -1; + CMediaSettings::Get().GetDefaultVideoSettings() = CMediaSettings::Get().GetCurrentVideoSettings(); + CMediaSettings::Get().GetDefaultVideoSettings().m_SubtitleStream = -1; + CMediaSettings::Get().GetDefaultVideoSettings().m_AudioStream = -1; g_settings.Save(); } } diff --git a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp index 5fa35c172f..ae73489b19 100644 --- a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp @@ -30,6 +30,7 @@ #include "video/VideoDatabase.h" #include "dialogs/GUIDialogYesNo.h" #include "settings/Settings.h" +#include "settings/MediaSettings.h" #include "addons/Skin.h" #include "pvr/PVRManager.h" @@ -87,7 +88,7 @@ void CGUIDialogVideoSettings::CreateSettings() entries.push_back(make_pair(VS_DEINTERLACEMODE_FORCE , 16041)); if (entries.size()) - AddSpin(VIDEO_SETTINGS_DEINTERLACEMODE, 16037, (int*)&g_settings.m_currentVideoSettings.m_DeinterlaceMode, entries); + AddSpin(VIDEO_SETTINGS_DEINTERLACEMODE, 16037, (int*)&CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode, entries); } { vector<pair<int, int> > entries; @@ -122,8 +123,8 @@ void CGUIDialogVideoSettings::CreateSettings() if (entries.size() > 1) { - AddSpin(VIDEO_SETTINGS_INTERLACEMETHOD, 16038, (int*)&g_settings.m_currentVideoSettings.m_InterlaceMethod, entries); - if (g_settings.m_currentVideoSettings.m_DeinterlaceMode == VS_DEINTERLACEMODE_OFF) + AddSpin(VIDEO_SETTINGS_INTERLACEMETHOD, 16038, (int*)&CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod, entries); + if (CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode == VS_DEINTERLACEMODE_OFF) EnableSettings(VIDEO_SETTINGS_INTERLACEMETHOD, false); } } @@ -155,37 +156,37 @@ void CGUIDialogVideoSettings::CreateSettings() it = entries.erase(it); } - AddSpin(VIDEO_SETTINGS_SCALINGMETHOD, 16300, (int*)&g_settings.m_currentVideoSettings.m_ScalingMethod, entries); + AddSpin(VIDEO_SETTINGS_SCALINGMETHOD, 16300, (int*)&CMediaSettings::Get().GetCurrentVideoSettings().m_ScalingMethod, entries); } if (g_renderManager.Supports(RENDERFEATURE_CROP)) - AddBool(VIDEO_SETTINGS_CROP, 644, &g_settings.m_currentVideoSettings.m_Crop); + AddBool(VIDEO_SETTINGS_CROP, 644, &CMediaSettings::Get().GetCurrentVideoSettings().m_Crop); if (g_renderManager.Supports(RENDERFEATURE_STRETCH) || g_renderManager.Supports(RENDERFEATURE_PIXEL_RATIO)) { const int entries[] = {630, 631, 632, 633, 634, 635, 636 }; - AddSpin(VIDEO_SETTINGS_VIEW_MODE, 629, &g_settings.m_currentVideoSettings.m_ViewMode, 7, entries); + AddSpin(VIDEO_SETTINGS_VIEW_MODE, 629, &CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode, 7, entries); } if (g_renderManager.Supports(RENDERFEATURE_ZOOM)) - AddSlider(VIDEO_SETTINGS_ZOOM, 216, &g_settings.m_currentVideoSettings.m_CustomZoomAmount, 0.5f, 0.01f, 2.0f, FormatFloat); + AddSlider(VIDEO_SETTINGS_ZOOM, 216, &CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount, 0.5f, 0.01f, 2.0f, FormatFloat); if (g_renderManager.Supports(RENDERFEATURE_VERTICAL_SHIFT)) - AddSlider(VIDEO_SETTINGS_VERTICAL_SHIFT, 225, &g_settings.m_currentVideoSettings.m_CustomVerticalShift, -2.0f, 0.01f, 2.0f, FormatFloat); + AddSlider(VIDEO_SETTINGS_VERTICAL_SHIFT, 225, &CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift, -2.0f, 0.01f, 2.0f, FormatFloat); if (g_renderManager.Supports(RENDERFEATURE_PIXEL_RATIO)) - AddSlider(VIDEO_SETTINGS_PIXEL_RATIO, 217, &g_settings.m_currentVideoSettings.m_CustomPixelRatio, 0.5f, 0.01f, 2.0f, FormatFloat); + AddSlider(VIDEO_SETTINGS_PIXEL_RATIO, 217, &CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio, 0.5f, 0.01f, 2.0f, FormatFloat); if (g_renderManager.Supports(RENDERFEATURE_POSTPROCESS)) - AddBool(VIDEO_SETTINGS_POSTPROCESS, 16400, &g_settings.m_currentVideoSettings.m_PostProcess); + AddBool(VIDEO_SETTINGS_POSTPROCESS, 16400, &CMediaSettings::Get().GetCurrentVideoSettings().m_PostProcess); #ifdef HAS_VIDEO_PLAYBACK if (g_renderManager.Supports(RENDERFEATURE_BRIGHTNESS)) - AddSlider(VIDEO_SETTINGS_BRIGHTNESS, 464, &g_settings.m_currentVideoSettings.m_Brightness, 0, 1, 100, FormatInteger); + AddSlider(VIDEO_SETTINGS_BRIGHTNESS, 464, &CMediaSettings::Get().GetCurrentVideoSettings().m_Brightness, 0, 1, 100, FormatInteger); if (g_renderManager.Supports(RENDERFEATURE_CONTRAST)) - AddSlider(VIDEO_SETTINGS_CONTRAST, 465, &g_settings.m_currentVideoSettings.m_Contrast, 0, 1, 100, FormatInteger); + AddSlider(VIDEO_SETTINGS_CONTRAST, 465, &CMediaSettings::Get().GetCurrentVideoSettings().m_Contrast, 0, 1, 100, FormatInteger); if (g_renderManager.Supports(RENDERFEATURE_GAMMA)) - AddSlider(VIDEO_SETTINGS_GAMMA, 466, &g_settings.m_currentVideoSettings.m_Gamma, 0, 1, 100, FormatInteger); + AddSlider(VIDEO_SETTINGS_GAMMA, 466, &CMediaSettings::Get().GetCurrentVideoSettings().m_Gamma, 0, 1, 100, FormatInteger); if (g_renderManager.Supports(RENDERFEATURE_NOISE)) - AddSlider(VIDEO_SETTING_VDPAU_NOISE, 16312, &g_settings.m_currentVideoSettings.m_NoiseReduction, 0.0f, 0.01f, 1.0f, FormatFloat); + AddSlider(VIDEO_SETTING_VDPAU_NOISE, 16312, &CMediaSettings::Get().GetCurrentVideoSettings().m_NoiseReduction, 0.0f, 0.01f, 1.0f, FormatFloat); if (g_renderManager.Supports(RENDERFEATURE_SHARPNESS)) - AddSlider(VIDEO_SETTING_VDPAU_SHARPNESS, 16313, &g_settings.m_currentVideoSettings.m_Sharpness, -1.0f, 0.02f, 1.0f, FormatFloat); + AddSlider(VIDEO_SETTING_VDPAU_SHARPNESS, 16313, &CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness, -1.0f, 0.02f, 1.0f, FormatFloat); if (g_renderManager.Supports(RENDERFEATURE_NONLINSTRETCH)) - AddBool(VIDEO_SETTINGS_NONLIN_STRETCH, 659, &g_settings.m_currentVideoSettings.m_CustomNonLinStretch); + AddBool(VIDEO_SETTINGS_NONLIN_STRETCH, 659, &CMediaSettings::Get().GetCurrentVideoSettings().m_CustomNonLinStretch); #endif AddSeparator(8); AddButton(VIDEO_SETTINGS_MAKE_DEFAULT, 12376); @@ -202,7 +203,7 @@ void CGUIDialogVideoSettings::OnSettingChanged(SettingInfo &setting) } else if (setting.id == VIDEO_SETTINGS_VIEW_MODE) { - g_renderManager.SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode); + g_renderManager.SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); UpdateSetting(VIDEO_SETTINGS_ZOOM); UpdateSetting(VIDEO_SETTINGS_PIXEL_RATIO); UpdateSetting(VIDEO_SETTINGS_NONLIN_STRETCH); @@ -212,8 +213,8 @@ void CGUIDialogVideoSettings::OnSettingChanged(SettingInfo &setting) || setting.id == VIDEO_SETTINGS_NONLIN_STRETCH || setting.id == VIDEO_SETTINGS_VERTICAL_SHIFT) { - g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; - g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); UpdateSetting(VIDEO_SETTINGS_VIEW_MODE); } else @@ -239,15 +240,15 @@ void CGUIDialogVideoSettings::OnSettingChanged(SettingInfo &setting) db.Open(); db.EraseVideoSettings(); db.Close(); - g_settings.m_defaultVideoSettings = g_settings.m_currentVideoSettings; - g_settings.m_defaultVideoSettings.m_SubtitleStream = -1; - g_settings.m_defaultVideoSettings.m_AudioStream = -1; + CMediaSettings::Get().GetDefaultVideoSettings() = CMediaSettings::Get().GetCurrentVideoSettings(); + CMediaSettings::Get().GetDefaultVideoSettings().m_SubtitleStream = -1; + CMediaSettings::Get().GetDefaultVideoSettings().m_AudioStream = -1; g_settings.Save(); } } else if (setting.id == VIDEO_SETTINGS_DEINTERLACEMODE) { - EnableSettings(VIDEO_SETTINGS_INTERLACEMETHOD, g_settings.m_currentVideoSettings.m_DeinterlaceMode != VS_DEINTERLACEMODE_OFF); + EnableSettings(VIDEO_SETTINGS_INTERLACEMETHOD, CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode != VS_DEINTERLACEMODE_OFF); } if (g_PVRManager.IsPlayingRadio() || g_PVRManager.IsPlayingTV()) diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp index c1d33dbb7b..0d26a97f1c 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.cpp +++ b/xbmc/video/windows/GUIWindowFullScreen.cpp @@ -42,6 +42,7 @@ #include "dialogs/GUIDialogKaiToast.h" #include "guilib/GUISliderControl.h" #include "settings/Settings.h" +#include "settings/MediaSettings.h" #include "guilib/GUISelectButtonControl.h" #include "FileItem.h" #include "video/VideoReferenceClock.h" @@ -223,10 +224,10 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) if (g_application.m_pPlayer->GetSubtitleCount() == 0) return true; - g_settings.m_currentVideoSettings.m_SubtitleOn = !g_settings.m_currentVideoSettings.m_SubtitleOn; - g_application.m_pPlayer->SetSubtitleVisible(g_settings.m_currentVideoSettings.m_SubtitleOn); + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = !CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn; + g_application.m_pPlayer->SetSubtitleVisible(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); CStdString sub, lang; - if (g_settings.m_currentVideoSettings.m_SubtitleOn) + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) { SPlayerSubtitleStreamInfo info; g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info); @@ -259,28 +260,28 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) if (g_application.m_pPlayer->GetSubtitleCount() == 0) return true; - if(g_settings.m_currentVideoSettings.m_SubtitleStream < 0) - g_settings.m_currentVideoSettings.m_SubtitleStream = g_application.m_pPlayer->GetSubtitle(); + if(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream < 0) + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream = g_application.m_pPlayer->GetSubtitle(); - if (g_settings.m_currentVideoSettings.m_SubtitleOn) + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) { - g_settings.m_currentVideoSettings.m_SubtitleStream++; - if (g_settings.m_currentVideoSettings.m_SubtitleStream >= g_application.m_pPlayer->GetSubtitleCount()) + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream++; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream >= g_application.m_pPlayer->GetSubtitleCount()) { - g_settings.m_currentVideoSettings.m_SubtitleStream = 0; - g_settings.m_currentVideoSettings.m_SubtitleOn = false; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream = 0; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = false; g_application.m_pPlayer->SetSubtitleVisible(false); } - g_application.m_pPlayer->SetSubtitle(g_settings.m_currentVideoSettings.m_SubtitleStream); + g_application.m_pPlayer->SetSubtitle(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream); } else { - g_settings.m_currentVideoSettings.m_SubtitleOn = true; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = true; g_application.m_pPlayer->SetSubtitleVisible(true); } CStdString sub, lang; - if (g_settings.m_currentVideoSettings.m_SubtitleOn) + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) { SPlayerSubtitleStreamInfo info; g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info); @@ -296,61 +297,61 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) break; case ACTION_SUBTITLE_DELAY_MIN: - g_settings.m_currentVideoSettings.m_SubtitleDelay -= 0.1f; - if (g_settings.m_currentVideoSettings.m_SubtitleDelay < -g_advancedSettings.m_videoSubsDelayRange) - g_settings.m_currentVideoSettings.m_SubtitleDelay = -g_advancedSettings.m_videoSubsDelayRange; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay -= 0.1f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay < -g_advancedSettings.m_videoSubsDelayRange) + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = -g_advancedSettings.m_videoSubsDelayRange; if (g_application.m_pPlayer) - g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); + g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); - ShowSlider(action.GetID(), 22006, g_settings.m_currentVideoSettings.m_SubtitleDelay, + ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange); return true; break; case ACTION_SUBTITLE_DELAY_PLUS: - g_settings.m_currentVideoSettings.m_SubtitleDelay += 0.1f; - if (g_settings.m_currentVideoSettings.m_SubtitleDelay > g_advancedSettings.m_videoSubsDelayRange) - g_settings.m_currentVideoSettings.m_SubtitleDelay = g_advancedSettings.m_videoSubsDelayRange; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay += 0.1f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay > g_advancedSettings.m_videoSubsDelayRange) + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = g_advancedSettings.m_videoSubsDelayRange; if (g_application.m_pPlayer) - g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); + g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); - ShowSlider(action.GetID(), 22006, g_settings.m_currentVideoSettings.m_SubtitleDelay, + ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange); return true; break; case ACTION_SUBTITLE_DELAY: - ShowSlider(action.GetID(), 22006, g_settings.m_currentVideoSettings.m_SubtitleDelay, + ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange, true); return true; break; case ACTION_AUDIO_DELAY: - ShowSlider(action.GetID(), 297, g_settings.m_currentVideoSettings.m_AudioDelay, + ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, true); return true; break; case ACTION_AUDIO_DELAY_MIN: - g_settings.m_currentVideoSettings.m_AudioDelay -= 0.025f; - if (g_settings.m_currentVideoSettings.m_AudioDelay < -g_advancedSettings.m_videoAudioDelayRange) - g_settings.m_currentVideoSettings.m_AudioDelay = -g_advancedSettings.m_videoAudioDelayRange; + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay -= 0.025f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay < -g_advancedSettings.m_videoAudioDelayRange) + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = -g_advancedSettings.m_videoAudioDelayRange; if (g_application.m_pPlayer) - g_application.m_pPlayer->SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); + g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); - ShowSlider(action.GetID(), 297, g_settings.m_currentVideoSettings.m_AudioDelay, + ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange); return true; break; case ACTION_AUDIO_DELAY_PLUS: - g_settings.m_currentVideoSettings.m_AudioDelay += 0.025f; - if (g_settings.m_currentVideoSettings.m_AudioDelay > g_advancedSettings.m_videoAudioDelayRange) - g_settings.m_currentVideoSettings.m_AudioDelay = g_advancedSettings.m_videoAudioDelayRange; + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay += 0.025f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay > g_advancedSettings.m_videoAudioDelayRange) + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = g_advancedSettings.m_videoAudioDelayRange; if (g_application.m_pPlayer) - g_application.m_pPlayer->SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); + g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); - ShowSlider(action.GetID(), 297, g_settings.m_currentVideoSettings.m_AudioDelay, + ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange); return true; @@ -360,16 +361,16 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) if (g_application.m_pPlayer->GetAudioStreamCount() == 1) return true; - if(g_settings.m_currentVideoSettings.m_AudioStream < 0) - g_settings.m_currentVideoSettings.m_AudioStream = g_application.m_pPlayer->GetAudioStream(); + if(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream < 0) + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = g_application.m_pPlayer->GetAudioStream(); - g_settings.m_currentVideoSettings.m_AudioStream++; - if (g_settings.m_currentVideoSettings.m_AudioStream >= g_application.m_pPlayer->GetAudioStreamCount()) - g_settings.m_currentVideoSettings.m_AudioStream = 0; - g_application.m_pPlayer->SetAudioStream(g_settings.m_currentVideoSettings.m_AudioStream); // Set the audio stream to the one selected + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream++; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream >= g_application.m_pPlayer->GetAudioStreamCount()) + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = 0; + g_application.m_pPlayer->SetAudioStream(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream); // Set the audio stream to the one selected CStdString aud; SPlayerAudioStreamInfo info; - g_application.m_pPlayer->GetAudioStreamInfo(g_settings.m_currentVideoSettings.m_AudioStream, info); + g_application.m_pPlayer->GetAudioStreamInfo(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream, info); aud = info.name; CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime); return true; @@ -432,7 +433,7 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) if (m_bShowViewModeInfo) { #ifdef HAS_VIDEO_PLAYBACK - g_renderManager.SetViewMode(++g_settings.m_currentVideoSettings.m_ViewMode); + g_renderManager.SetViewMode(++CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); #endif } m_bShowViewModeInfo = true; @@ -466,67 +467,67 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) break; case ACTION_ZOOM_IN: { - g_settings.m_currentVideoSettings.m_CustomZoomAmount += 0.01f; - if (g_settings.m_currentVideoSettings.m_CustomZoomAmount > 2.f) - g_settings.m_currentVideoSettings.m_CustomZoomAmount = 2.f; - g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; - g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); - ShowSlider(action.GetID(), 216, g_settings.m_currentVideoSettings.m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount += 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount > 2.f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 2.f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 216, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); } return true; break; case ACTION_ZOOM_OUT: { - g_settings.m_currentVideoSettings.m_CustomZoomAmount -= 0.01f; - if (g_settings.m_currentVideoSettings.m_CustomZoomAmount < 0.5f) - g_settings.m_currentVideoSettings.m_CustomZoomAmount = 0.5f; - g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; - g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); - ShowSlider(action.GetID(), 216, g_settings.m_currentVideoSettings.m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount -= 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount < 0.5f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 0.5f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 216, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); } return true; break; case ACTION_INCREASE_PAR: { - g_settings.m_currentVideoSettings.m_CustomPixelRatio += 0.01f; - if (g_settings.m_currentVideoSettings.m_CustomPixelRatio > 2.f) - g_settings.m_currentVideoSettings.m_CustomZoomAmount = 2.f; - g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; - g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); - ShowSlider(action.GetID(), 217, g_settings.m_currentVideoSettings.m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio += 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio > 2.f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 2.f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 217, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); } return true; break; case ACTION_DECREASE_PAR: { - g_settings.m_currentVideoSettings.m_CustomPixelRatio -= 0.01f; - if (g_settings.m_currentVideoSettings.m_CustomZoomAmount < 0.5f) - g_settings.m_currentVideoSettings.m_CustomPixelRatio = 0.5f; - g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; - g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); - ShowSlider(action.GetID(), 217, g_settings.m_currentVideoSettings.m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio -= 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount < 0.5f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio = 0.5f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 217, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); } return true; break; case ACTION_VSHIFT_UP: { - g_settings.m_currentVideoSettings.m_CustomVerticalShift -= 0.01f; - if (g_settings.m_currentVideoSettings.m_CustomVerticalShift < -2.0f) - g_settings.m_currentVideoSettings.m_CustomVerticalShift = -2.0f; - g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; - g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); - ShowSlider(action.GetID(), 225, g_settings.m_currentVideoSettings.m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift -= 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift < -2.0f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = -2.0f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 225, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); } return true; break; case ACTION_VSHIFT_DOWN: { - g_settings.m_currentVideoSettings.m_CustomVerticalShift += 0.01f; - if (g_settings.m_currentVideoSettings.m_CustomVerticalShift > 2.0f) - g_settings.m_currentVideoSettings.m_CustomVerticalShift = 2.0f; - g_settings.m_currentVideoSettings.m_ViewMode = VIEW_MODE_CUSTOM; - g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); - ShowSlider(action.GetID(), 225, g_settings.m_currentVideoSettings.m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift += 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift > 2.0f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = 2.0f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 225, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); } return true; break; @@ -608,17 +609,17 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) float sliderMin = VOLUME_DRC_MINIMUM / 100.0f; if (action.GetID() == ACTION_VOLAMP_UP) - g_settings.m_currentVideoSettings.m_VolumeAmplification += 1.0f; + CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification += 1.0f; else - g_settings.m_currentVideoSettings.m_VolumeAmplification -= 1.0f; + CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification -= 1.0f; - g_settings.m_currentVideoSettings.m_VolumeAmplification = - std::max(std::min(g_settings.m_currentVideoSettings.m_VolumeAmplification, sliderMax), sliderMin); + CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification = + std::max(std::min(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, sliderMax), sliderMin); if (g_application.m_pPlayer) - g_application.m_pPlayer->SetDynamicRangeCompression((long)(g_settings.m_currentVideoSettings.m_VolumeAmplification * 100)); + g_application.m_pPlayer->SetDynamicRangeCompression((long)(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification * 100)); - ShowSlider(action.GetID(), 660, g_settings.m_currentVideoSettings.m_VolumeAmplification, sliderMin, 1.0f, sliderMax); + ShowSlider(action.GetID(), 660, CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, sliderMin, 1.0f, sliderMax); break; } @@ -947,7 +948,7 @@ void CGUIWindowFullScreen::FrameMove() { // get the "View Mode" string CStdString strTitle = g_localizeStrings.Get(629); - CStdString strMode = g_localizeStrings.Get(630 + g_settings.m_currentVideoSettings.m_ViewMode); + CStdString strMode = g_localizeStrings.Get(630 + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); CStdString strInfo; strInfo.Format("%s : %s", strTitle.c_str(), strMode.c_str()); CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW1); @@ -1236,13 +1237,13 @@ void CGUIWindowFullScreen::OnSliderChange(void *data, CGUISliderControl *slider) { if (m_sliderAction == ACTION_AUDIO_DELAY) { - g_settings.m_currentVideoSettings.m_AudioDelay = slider->GetFloatValue(); - g_application.m_pPlayer->SetAVDelay(g_settings.m_currentVideoSettings.m_AudioDelay); + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = slider->GetFloatValue(); + g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); } else if (m_sliderAction == ACTION_SUBTITLE_DELAY) { - g_settings.m_currentVideoSettings.m_SubtitleDelay = slider->GetFloatValue(); - g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay); + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = slider->GetFloatValue(); + g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); } } } diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index b1376612e1..9030a7b1c8 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -55,6 +55,7 @@ #include "settings/Settings.h" #include "settings/AdvancedSettings.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "settings/dialogs/GUIDialogContentSettings.h" #include "guilib/Key.h" #include "guilib/LocalizeStrings.h" @@ -782,9 +783,9 @@ void CGUIWindowVideoBase::AddItemToPlayList(const CFileItemPtr &pItem, CFileItem GetDirectory(pItem->GetPath(), items); FormatAndSort(items); - int watchedMode = g_settings.GetWatchMode(items.GetContent()); - bool unwatchedOnly = watchedMode == VIDEO_SHOW_UNWATCHED; - bool watchedOnly = watchedMode == VIDEO_SHOW_WATCHED; + int watchedMode = CMediaSettings::Get().GetWatchedMode(items.GetContent()); + bool unwatchedOnly = watchedMode == WatchedModeUnwatched; + bool watchedOnly = watchedMode == WatchedModeWatched; for (int i = 0; i < items.Size(); ++i) { if (items[i]->m_bIsFolder) diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp index 404acdea7f..50981c5c7b 100644 --- a/xbmc/video/windows/GUIWindowVideoNav.cpp +++ b/xbmc/video/windows/GUIWindowVideoNav.cpp @@ -44,6 +44,7 @@ #include "settings/Settings.h" #include "settings/AdvancedSettings.h" #include "settings/GUISettings.h" +#include "settings/MediaSettings.h" #include "settings/MediaSourceSettings.h" #include "guilib/Key.h" #include "guilib/LocalizeStrings.h" @@ -162,7 +163,7 @@ bool CGUIWindowVideoNav::OnMessage(CGUIMessage& message) } else if (iControl == CONTROL_BTNSHOWMODE) { - g_settings.CycleWatchMode(m_vecItems->GetContent()); + CMediaSettings::Get().CycleWatchedMode(m_vecItems->GetContent()); g_settings.Save(); OnFilterItems(GetProperty("filter").asString()); return true; @@ -179,10 +180,10 @@ bool CGUIWindowVideoNav::OnMessage(CGUIMessage& message) } else if (iControl == CONTROL_BTNSHOWALL) { - if (g_settings.GetWatchMode(m_vecItems->GetContent()) == VIDEO_SHOW_ALL) - g_settings.SetWatchMode(m_vecItems->GetContent(), VIDEO_SHOW_UNWATCHED); + if (CMediaSettings::Get().GetWatchedMode(m_vecItems->GetContent()) == WatchedModeAll) + CMediaSettings::Get().SetWatchedMode(m_vecItems->GetContent(), WatchedModeUnwatched); else - g_settings.SetWatchMode(m_vecItems->GetContent(), VIDEO_SHOW_ALL); + CMediaSettings::Get().SetWatchedMode(m_vecItems->GetContent(), WatchedModeAll); g_settings.Save(); OnFilterItems(GetProperty("filter").asString()); return true; @@ -534,10 +535,10 @@ void CGUIWindowVideoNav::UpdateButtons() SET_CONTROL_LABEL(CONTROL_FILTER, strLabel); - int watchMode = g_settings.GetWatchMode(m_vecItems->GetContent()); + int watchMode = CMediaSettings::Get().GetWatchedMode(m_vecItems->GetContent()); SET_CONTROL_LABEL(CONTROL_BTNSHOWMODE, g_localizeStrings.Get(16100 + watchMode)); - SET_CONTROL_SELECTED(GetID(), CONTROL_BTNSHOWALL, watchMode != VIDEO_SHOW_ALL); + SET_CONTROL_SELECTED(GetID(), CONTROL_BTNSHOWALL, watchMode != WatchedModeAll); SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE, g_partyModeManager.IsEnabled()); @@ -1655,7 +1656,7 @@ bool CGUIWindowVideoNav::ApplyWatchedFilter(CFileItemList &items) (items.IsSmartPlayList() || (items.HasProperty("library.filter") && items.GetProperty("library.filter").asBoolean()))) node = NODE_TYPE_TITLE_TVSHOWS; // so that the check below works - int watchMode = g_settings.GetWatchMode(m_vecItems->GetContent()); + int watchMode = CMediaSettings::Get().GetWatchedMode(m_vecItems->GetContent()); for (int i = 0; i < items.Size(); i++) { @@ -1663,11 +1664,11 @@ bool CGUIWindowVideoNav::ApplyWatchedFilter(CFileItemList &items) if(item->HasVideoInfoTag() && (node == NODE_TYPE_TITLE_TVSHOWS || node == NODE_TYPE_SEASONS)) { - if (watchMode == VIDEO_SHOW_UNWATCHED) + if (watchMode == WatchedModeUnwatched) item->GetVideoInfoTag()->m_iEpisode = (int)item->GetProperty("unwatchedepisodes").asInteger(); - if (watchMode == VIDEO_SHOW_WATCHED) + if (watchMode == WatchedModeWatched) item->GetVideoInfoTag()->m_iEpisode = (int)item->GetProperty("watchedepisodes").asInteger(); - if (watchMode == VIDEO_SHOW_ALL) + if (watchMode == WatchedModeAll) item->GetVideoInfoTag()->m_iEpisode = (int)item->GetProperty("totalepisodes").asInteger(); item->SetProperty("numepisodes", item->GetVideoInfoTag()->m_iEpisode); listchanged = true; @@ -1675,8 +1676,8 @@ bool CGUIWindowVideoNav::ApplyWatchedFilter(CFileItemList &items) if (filterWatched) { - if((watchMode==VIDEO_SHOW_WATCHED && item->GetVideoInfoTag()->m_playCount== 0) - || (watchMode==VIDEO_SHOW_UNWATCHED && item->GetVideoInfoTag()->m_playCount > 0)) + if((watchMode==WatchedModeWatched && item->GetVideoInfoTag()->m_playCount== 0) + || (watchMode==WatchedModeUnwatched && item->GetVideoInfoTag()->m_playCount > 0)) { items.Remove(i); i--; |