diff options
author | Garrett Brown <themagnificentmrb@gmail.com> | 2018-03-15 17:29:34 -0700 |
---|---|---|
committer | Garrett Brown <themagnificentmrb@gmail.com> | 2018-03-30 10:46:12 -0700 |
commit | 981f05652ffa4b0e614e5f18754f048eb4327f2a (patch) | |
tree | 591e7dc06459d0027c4c3e23da76b36e7f72e6ae | |
parent | e4848348fc992b4688682a043f01a29d4751899e (diff) |
Replace uses of singleton with CServiceBroker
The final stop is to grep the codebase and make all the substitutions
required.
-rw-r--r-- | xbmc/Application.cpp | 4 | ||||
-rw-r--r-- | xbmc/GUIInfoManager.cpp | 8 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/VideoPlayer.cpp | 5 | ||||
-rw-r--r-- | xbmc/interfaces/builtins/GUIBuiltins.cpp | 2 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/GUIOperations.cpp | 14 | ||||
-rw-r--r-- | xbmc/settings/DisplaySettings.cpp | 10 | ||||
-rw-r--r-- | xbmc/video/VideoThumbLoader.cpp | 13 | ||||
-rw-r--r-- | xbmc/windowing/rpi/RPIUtils.cpp | 4 | ||||
-rw-r--r-- | xbmc/windows/GUIWindowLoginScreen.cpp | 2 |
9 files changed, 43 insertions, 19 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 8589a381a2..aba4221df7 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2107,7 +2107,7 @@ bool CApplication::OnAction(const CAction &action) } // forward action to graphic context and see if it can handle it - if (CStereoscopicsManager::GetInstance().OnAction(action)) + if (CServiceBroker::GetStereoscopicsManager().OnAction(action)) return true; if (m_appPlayer.IsPlaying()) @@ -3485,7 +3485,7 @@ void CApplication::OnAVChange() { CLog::LogF(LOGDEBUG, "CApplication::OnAVChange"); - CStereoscopicsManager::GetInstance().OnStreamChange(); + CServiceBroker::GetStereoscopicsManager().OnStreamChange(); CGUIMessage msg(GUI_MSG_PLAYBACK_AVCHANGE, 0, 0); g_windowManager.SendThreadMessage(msg); diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 48245902a9..7de7de494e 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -10411,8 +10411,10 @@ std::string CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, std:: case LISTITEM_STEREOSCOPIC_MODE: { std::string stereoMode = item->GetProperty("stereomode").asString(); + if (stereoMode.empty() && item->HasVideoInfoTag()) - stereoMode = CStereoscopicsManager::GetInstance().NormalizeStereoMode(item->GetVideoInfoTag()->m_streamDetails.GetStereoMode()); + stereoMode = CStereoscopicsManager::NormalizeStereoMode(item->GetVideoInfoTag()->m_streamDetails.GetStereoMode()); + return stereoMode; } case LISTITEM_IMDBNUMBER: @@ -10661,8 +10663,10 @@ bool CGUIInfoManager::GetItemBool(const CGUIListItem *item, int condition) const else if (condition == LISTITEM_IS_STEREOSCOPIC) { std::string stereoMode = pItem->GetProperty("stereomode").asString(); + if (stereoMode.empty() && pItem->HasVideoInfoTag()) - stereoMode = CStereoscopicsManager::GetInstance().NormalizeStereoMode(pItem->GetVideoInfoTag()->m_streamDetails.GetStereoMode()); + stereoMode = CStereoscopicsManager::NormalizeStereoMode(pItem->GetVideoInfoTag()->m_streamDetails.GetStereoMode()); + if (!stereoMode.empty() && stereoMode != "mono") return true; } diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index f8f9a3b495..84213e9338 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -3673,7 +3673,10 @@ bool CVideoPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.stills = true; if (hint.stereo_mode.empty()) - hint.stereo_mode = CStereoscopicsManager::GetInstance().DetectStereoModeByString(m_item.GetPath()); + { + const CStereoscopicsManager &stereoscopicsManager = CServiceBroker::GetStereoscopicsManager(); + hint.stereo_mode = stereoscopicsManager.DetectStereoModeByString(m_item.GetPath()); + } if (hint.flags & AV_DISPOSITION_ATTACHED_PIC) return false; diff --git a/xbmc/interfaces/builtins/GUIBuiltins.cpp b/xbmc/interfaces/builtins/GUIBuiltins.cpp index 26234c87d6..3d2e503ce0 100644 --- a/xbmc/interfaces/builtins/GUIBuiltins.cpp +++ b/xbmc/interfaces/builtins/GUIBuiltins.cpp @@ -392,7 +392,7 @@ static int SetProperty(const std::vector<std::string>& params) */ static int SetStereoMode(const std::vector<std::string>& params) { - CAction action = CStereoscopicsManager::GetInstance().ConvertActionCommandToAction("SetStereoMode", params[0]); + CAction action = CStereoscopicsManager::ConvertActionCommandToAction("SetStereoMode", params[0]); if (action.GetID() != ACTION_NONE) CApplicationMessenger::GetInstance().SendMsg(TMSG_GUI_ACTION, WINDOW_INVALID, -1, static_cast<void*>(new CAction(action))); else diff --git a/xbmc/interfaces/json-rpc/GUIOperations.cpp b/xbmc/interfaces/json-rpc/GUIOperations.cpp index e5a0627825..893deb9ad0 100644 --- a/xbmc/interfaces/json-rpc/GUIOperations.cpp +++ b/xbmc/interfaces/json-rpc/GUIOperations.cpp @@ -107,7 +107,7 @@ JSONRPC_STATUS CGUIOperations::SetFullscreen(const std::string &method, ITranspo JSONRPC_STATUS CGUIOperations::SetStereoscopicMode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CAction action = CStereoscopicsManager::GetInstance().ConvertActionCommandToAction("SetStereoMode", parameterObject["mode"].asString()); + CAction action = CStereoscopicsManager::ConvertActionCommandToAction("SetStereoMode", parameterObject["mode"].asString()); if (action.GetID() != ACTION_NONE) { CApplicationMessenger::GetInstance().SendMsg(TMSG_GUI_ACTION, WINDOW_INVALID, -1, static_cast<void*>(new CAction(action))); @@ -152,7 +152,11 @@ JSONRPC_STATUS CGUIOperations::GetPropertyValue(const std::string &property, CVa else if (property == "fullscreen") result = g_application.IsFullScreen(); else if (property == "stereoscopicmode") - result = GetStereoModeObjectFromGuiMode( CStereoscopicsManager::GetInstance().GetStereoMode() ); + { + const CStereoscopicsManager &stereoscopicsManager = CServiceBroker::GetStereoscopicsManager(); + + result = GetStereoModeObjectFromGuiMode(stereoscopicsManager.GetStereoMode()); + } else return InvalidParams; @@ -161,8 +165,10 @@ JSONRPC_STATUS CGUIOperations::GetPropertyValue(const std::string &property, CVa CVariant CGUIOperations::GetStereoModeObjectFromGuiMode(const RENDER_STEREO_MODE &mode) { + const CStereoscopicsManager &stereoscopicsManager = CServiceBroker::GetStereoscopicsManager(); + CVariant modeObj(CVariant::VariantTypeObject); - modeObj["mode"] = CStereoscopicsManager::GetInstance().ConvertGuiStereoModeToString(mode); - modeObj["label"] = CStereoscopicsManager::GetInstance().GetLabelForStereoMode(mode); + modeObj["mode"] = stereoscopicsManager.ConvertGuiStereoModeToString(mode); + modeObj["label"] = stereoscopicsManager.GetLabelForStereoMode(mode); return modeObj; } diff --git a/xbmc/settings/DisplaySettings.cpp b/xbmc/settings/DisplaySettings.cpp index 9666eb622f..97ec3c051b 100644 --- a/xbmc/settings/DisplaySettings.cpp +++ b/xbmc/settings/DisplaySettings.cpp @@ -762,24 +762,28 @@ void CDisplaySettings::SettingOptionsScreensFiller(SettingConstPtr setting, std: void CDisplaySettings::SettingOptionsStereoscopicModesFiller(SettingConstPtr setting, std::vector< std::pair<std::string, int> > &list, int ¤t, void *data) { + const CStereoscopicsManager &stereoscopicsManager = CServiceBroker::GetStereoscopicsManager(); + for (int i = RENDER_STEREO_MODE_OFF; i < RENDER_STEREO_MODE_COUNT; i++) { RENDER_STEREO_MODE mode = (RENDER_STEREO_MODE) i; if (CServiceBroker::GetRenderSystem().SupportsStereo(mode)) - list.push_back(std::make_pair(CStereoscopicsManager::GetInstance().GetLabelForStereoMode(mode), mode)); + list.push_back(std::make_pair(stereoscopicsManager.GetLabelForStereoMode(mode), mode)); } } void CDisplaySettings::SettingOptionsPreferredStereoscopicViewModesFiller(SettingConstPtr setting, std::vector< std::pair<std::string, int> > &list, int ¤t, void *data) { - list.push_back(std::make_pair(CStereoscopicsManager::GetInstance().GetLabelForStereoMode(RENDER_STEREO_MODE_AUTO), RENDER_STEREO_MODE_AUTO)); // option for autodetect + const CStereoscopicsManager &stereoscopicsManager = CServiceBroker::GetStereoscopicsManager(); + + list.push_back(std::make_pair(stereoscopicsManager.GetLabelForStereoMode(RENDER_STEREO_MODE_AUTO), RENDER_STEREO_MODE_AUTO)); // option for autodetect // don't add "off" to the list of preferred modes as this doesn't make sense for (int i = RENDER_STEREO_MODE_OFF +1; i < RENDER_STEREO_MODE_COUNT; i++) { RENDER_STEREO_MODE mode = (RENDER_STEREO_MODE) i; // also skip "mono" mode which is no real stereoscopic mode if (mode != RENDER_STEREO_MODE_MONO && CServiceBroker::GetRenderSystem().SupportsStereo(mode)) - list.push_back(std::make_pair(CStereoscopicsManager::GetInstance().GetLabelForStereoMode(mode), mode)); + list.push_back(std::make_pair(stereoscopicsManager.GetLabelForStereoMode(mode), mode)); } } diff --git a/xbmc/video/VideoThumbLoader.cpp b/xbmc/video/VideoThumbLoader.cpp index 117469b781..59c3a87faf 100644 --- a/xbmc/video/VideoThumbLoader.cpp +++ b/xbmc/video/VideoThumbLoader.cpp @@ -662,10 +662,14 @@ void CVideoThumbLoader::DetectAndAddMissingItemData(CFileItem &item) } } + const CStereoscopicsManager &stereoscopicsManager = CServiceBroker::GetStereoscopicsManager(); + std::string stereoMode; + // detect stereomode for videos if (item.HasVideoInfoTag()) stereoMode = item.GetVideoInfoTag()->m_streamDetails.GetStereoMode(); + if (stereoMode.empty()) { std::string path = item.GetPath(); @@ -676,14 +680,17 @@ void CVideoThumbLoader::DetectAndAddMissingItemData(CFileItem &item) CVideoSettings itemVideoSettings; m_videoDatabase->Open(); if (m_videoDatabase->GetVideoSettings(item, itemVideoSettings) && itemVideoSettings.m_StereoMode != RENDER_STEREO_MODE_OFF) - stereoMode = CStereoscopicsManager::GetInstance().ConvertGuiStereoModeToString( (RENDER_STEREO_MODE) itemVideoSettings.m_StereoMode ); + { + stereoMode = CStereoscopicsManager::ConvertGuiStereoModeToString(static_cast<RENDER_STEREO_MODE>(itemVideoSettings.m_StereoMode)); + } m_videoDatabase->Close(); // still empty, try grabbing from filename //! @todo in case of too many false positives due to using the full path, extract the filename only using string utils if (stereoMode.empty()) - stereoMode = CStereoscopicsManager::GetInstance().DetectStereoModeByString( path ); + stereoMode = stereoscopicsManager.DetectStereoModeByString(path); } + if (!stereoMode.empty()) - item.SetProperty("stereomode", CStereoscopicsManager::GetInstance().NormalizeStereoMode(stereoMode)); + item.SetProperty("stereomode", CStereoscopicsManager::NormalizeStereoMode(stereoMode)); } diff --git a/xbmc/windowing/rpi/RPIUtils.cpp b/xbmc/windowing/rpi/RPIUtils.cpp index 268a1a1b52..882bd21be6 100644 --- a/xbmc/windowing/rpi/RPIUtils.cpp +++ b/xbmc/windowing/rpi/RPIUtils.cpp @@ -170,7 +170,7 @@ bool CRPIUtils::SetNativeResolution(const RESOLUTION_INFO res, EGLSurface m_nati { CLog::Log(LOGDEBUG, "EGL set HDMI mode (%d,%d)=%d %s%s\n", GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), success, - CStereoscopicsManager::GetInstance().ConvertGuiStereoModeToString(stereo_mode), + CStereoscopicsManager::ConvertGuiStereoModeToString(stereo_mode), mode3d==HDMI_3D_FORMAT_FRAME_PACKING ? " FP" : mode3d==HDMI_3D_FORMAT_SBS_HALF ? " SBS" : mode3d==HDMI_3D_FORMAT_TB_HALF ? " TB" : ""); sem_wait(&m_tv_synced); @@ -179,7 +179,7 @@ bool CRPIUtils::SetNativeResolution(const RESOLUTION_INFO res, EGLSurface m_nati { CLog::Log(LOGERROR, "EGL failed to set HDMI mode (%d,%d)=%d %s%s\n", GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), success, - CStereoscopicsManager::GetInstance().ConvertGuiStereoModeToString(stereo_mode), + CStereoscopicsManager::ConvertGuiStereoModeToString(stereo_mode), mode3d==HDMI_3D_FORMAT_FRAME_PACKING ? " FP" : mode3d==HDMI_3D_FORMAT_SBS_HALF ? " SBS" : mode3d==HDMI_3D_FORMAT_TB_HALF ? " TB" : ""); } m_DllBcmHost->vc_tv_unregister_callback(CallbackTvServiceCallback); diff --git a/xbmc/windows/GUIWindowLoginScreen.cpp b/xbmc/windows/GUIWindowLoginScreen.cpp index 913aac3f3b..bd9d68f88a 100644 --- a/xbmc/windows/GUIWindowLoginScreen.cpp +++ b/xbmc/windows/GUIWindowLoginScreen.cpp @@ -354,7 +354,7 @@ void CGUIWindowLoginScreen::LoadProfile(unsigned int profile) g_windowManager.ChangeActiveWindow(firstWindow); g_application.UpdateLibraries(); - CStereoscopicsManager::GetInstance().Initialize(); + CServiceBroker::GetStereoscopicsManager().Initialize(); // if the user interfaces has been fully initialized let everyone know if (uiInitializationFinished) |