void CStereoscopicsManager::OnSettingChanged(const CSetting *setting) { if (setting == NULL) return; const std::string &settingId = setting->GetId(); if (settingId == "videoscreen.stereoscopicmode") { RENDER_STEREO_MODE mode = GetStereoMode(); CLog::Log(LOGDEBUG, "StereoscopicsManager: stereo mode setting changed to %s", GetLabelForStereoMode(mode).c_str()); ApplyStereoMode(mode); } }
RENDER_STEREO_MODE CStereoscopicsManager::GetStereoModeByUserChoice(const std::string &heading) { RENDER_STEREO_MODE mode = GetStereoMode(); // if no stereo mode is set already, suggest mode of current video by preselecting it if (mode == RENDER_STEREO_MODE_OFF && g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) mode = GetStereoModeOfPlayingVideo(); CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDlgSelect->Reset(); if (heading.empty()) pDlgSelect->SetHeading(g_localizeStrings.Get(36528).c_str()); else pDlgSelect->SetHeading(heading.c_str()); // prepare selectable stereo modes std::vector<RENDER_STEREO_MODE> selectableModes; for (int i = RENDER_STEREO_MODE_OFF; i < RENDER_STEREO_MODE_COUNT; i++) { RENDER_STEREO_MODE selectableMode = (RENDER_STEREO_MODE) i; if (g_Windowing.SupportsStereo(selectableMode)) { selectableModes.push_back(selectableMode); std::string label = GetLabelForStereoMode((RENDER_STEREO_MODE) i); pDlgSelect->Add( label ); if (mode == selectableMode) pDlgSelect->SetSelected( label ); } } pDlgSelect->DoModal(); int iItem = pDlgSelect->GetSelectedLabel(); if (iItem > -1 && pDlgSelect->IsConfirmed()) mode = (RENDER_STEREO_MODE) selectableModes[iItem]; else mode = GetStereoMode(); return mode; }
void CStereoscopicsManager::OnPlaybackStarted(void) { STEREOSCOPIC_PLAYBACK_MODE playbackMode = (STEREOSCOPIC_PLAYBACK_MODE) CSettings::Get().GetInt("videoplayer.stereoscopicplaybackmode"); RENDER_STEREO_MODE mode = GetStereoMode(); // early return if playback mode should be ignored and we're in no stereoscopic mode right now if (playbackMode == STEREOSCOPIC_PLAYBACK_MODE_IGNORE && mode == RENDER_STEREO_MODE_OFF) return; if (!g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) { // exit stereo mode if started item is not stereoscopic // and if user prefers to stop 3D playback when movie is finished if (mode != RENDER_STEREO_MODE_OFF && CSettings::Get().GetBool("videoplayer.quitstereomodeonstop")) SetStereoMode(RENDER_STEREO_MODE_OFF); return; } // if we're not in stereomode yet, restore previously selected stereo mode in case it was user selected if (m_stereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED) { SetStereoMode(m_stereoModeSetByUser); return; } RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode(); RENDER_STEREO_MODE playing = GetStereoModeOfPlayingVideo(); if (mode != RENDER_STEREO_MODE_OFF) { // don't change mode if user selected to not exit stereomode on playback stop // users selecting this option usually have to manually switch their TV into 3D mode // and would be annoyed by having to switch TV modes when next movies comes up // @todo probably add a new setting for just this behavior if (CSettings::Get().GetBool("videoplayer.quitstereomodeonstop") == false) return; // only change to new stereo mode if not yet in preferred stereo mode if (mode == preferred || (preferred == RENDER_STEREO_MODE_AUTO && mode == playing)) return; } switch (playbackMode) { case STEREOSCOPIC_PLAYBACK_MODE_ASK: // Ask { CApplicationMessenger::Get().MediaPause(); CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDlgSelect->Reset(); pDlgSelect->SetHeading(CVariant{g_localizeStrings.Get(36527)}); int idx_playing = -1; // add choices int idx_preferred = pDlgSelect->Add(g_localizeStrings.Get(36524) // preferred + " (" + GetLabelForStereoMode(preferred) + ")"); int idx_mono = pDlgSelect->Add(GetLabelForStereoMode(RENDER_STEREO_MODE_MONO)); // mono / 2d if (playing != RENDER_STEREO_MODE_OFF && playing != preferred && preferred != RENDER_STEREO_MODE_AUTO && g_Windowing.SupportsStereo(playing)) // same as movie idx_playing = pDlgSelect->Add(g_localizeStrings.Get(36532) + " (" + GetLabelForStereoMode(playing) + ")"); int idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select pDlgSelect->Open(); if(pDlgSelect->IsConfirmed()) { int iItem = pDlgSelect->GetSelectedLabel(); if (iItem == idx_preferred) mode = preferred; else if (iItem == idx_mono) mode = RENDER_STEREO_MODE_MONO; else if (iItem == idx_playing) mode = RENDER_STEREO_MODE_AUTO; else if (iItem == idx_select) mode = GetStereoModeByUserChoice(); SetStereoModeByUser( mode ); } CApplicationMessenger::Get().MediaUnPause(); } break; case STEREOSCOPIC_PLAYBACK_MODE_PREFERRED: // Stereoscopic SetStereoMode( preferred ); break; case 2: // Mono SetStereoMode( RENDER_STEREO_MODE_MONO ); break; default: break; } }
void CStereoscopicsManager::ApplyStereoMode(const RENDER_STEREO_MODE &mode, bool notify) { RENDER_STEREO_MODE currentMode = g_graphicsContext.GetStereoMode(); CLog::Log(LOGDEBUG, "StereoscopicsManager::ApplyStereoMode: trying to apply stereo mode. Current: %s | Target: %s", ConvertGuiStereoModeToString(currentMode), ConvertGuiStereoModeToString(mode)); if (currentMode != mode) { g_graphicsContext.SetStereoMode(mode); CLog::Log(LOGDEBUG, "StereoscopicsManager: stereo mode changed to %s", ConvertGuiStereoModeToString(mode)); if (notify) CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36501), GetLabelForStereoMode(mode)); } }
void CStereoscopicsManager::OnPlaybackStarted(void) { if (!g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) return; STEREOSCOPIC_PLAYBACK_MODE playbackMode = (STEREOSCOPIC_PLAYBACK_MODE) CSettings::Get().GetInt("videoplayer.stereoscopicplaybackmode"); RENDER_STEREO_MODE mode = GetStereoMode(); // early return if playback mode should be ignored and we're in no stereoscopic mode right now if (playbackMode == STEREOSCOPIC_PLAYBACK_MODE_IGNORE && mode == RENDER_STEREO_MODE_OFF) return; if (mode != RENDER_STEREO_MODE_OFF) return; switch (playbackMode) { case STEREOSCOPIC_PLAYBACK_MODE_ASK: // Ask { CApplicationMessenger::Get().MediaPause(); CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDlgSelect->Reset(); pDlgSelect->SetHeading(g_localizeStrings.Get(36527).c_str()); RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode(); RENDER_STEREO_MODE playing = GetStereoModeOfPlayingVideo(); int idx_playing = -1; // add choices int idx_preferred = pDlgSelect->Add(g_localizeStrings.Get(36524) // preferred + " (" + GetLabelForStereoMode(preferred) + ")"); int idx_mono = pDlgSelect->Add(GetLabelForStereoMode(RENDER_STEREO_MODE_MONO)); // mono / 2d if(playing != RENDER_STEREO_MODE_OFF && playing != preferred && g_Windowing.SupportsStereo(playing)) idx_playing = pDlgSelect->Add(g_localizeStrings.Get(36532) + " (" + GetLabelForStereoMode(playing) + ")"); int idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select pDlgSelect->DoModal(); if(pDlgSelect->IsConfirmed()) { int iItem = pDlgSelect->GetSelectedLabel(); if (iItem == idx_preferred) mode = preferred; else if (iItem == idx_mono) mode = RENDER_STEREO_MODE_MONO; else if (iItem == idx_playing) mode = playing; else if (iItem == idx_select) mode = GetStereoModeByUserChoice(); SetStereoMode(mode); } CApplicationMessenger::Get().MediaUnPause(); } break; case STEREOSCOPIC_PLAYBACK_MODE_PREFERRED: // Stereoscopic SetStereoMode( GetPreferredPlaybackMode() ); break; case 2: // Mono SetStereoMode( RENDER_STEREO_MODE_MONO ); break; default: break; } }
RENDER_STEREO_MODE CStereoscopicsManager::GetStereoModeOfPlayingVideo(void) { RENDER_STEREO_MODE mode = RENDER_STEREO_MODE_OFF; std::string playerMode = g_infoManager.GetLabel(VIDEOPLAYER_STEREOSCOPIC_MODE); if (!playerMode.empty()) { int convertedMode = ConvertVideoToGuiStereoMode(playerMode); if (convertedMode > -1) mode = (RENDER_STEREO_MODE) convertedMode; } CLog::Log(LOGDEBUG, "StereoscopicsManager: autodetected GUI stereo mode for movie mode %s is: %s", playerMode.c_str(), GetLabelForStereoMode(mode).c_str()); return mode; }
void CStereoscopicsManager::OnPlaybackStarted(void) { if (!g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) return; // only change stereo mode if not yet in stereo mode RENDER_STEREO_MODE mode = GetStereoMode(); if (mode != RENDER_STEREO_MODE_OFF) return; int playbackMode = CSettings::Get().GetInt("videoplayer.stereoscopicplaybackmode"); switch (playbackMode) { case 0: // Ask { CApplicationMessenger::Get().MediaPause(); CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDlgSelect->Reset(); pDlgSelect->SetHeading(g_localizeStrings.Get(36527).c_str()); RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode(); RENDER_STEREO_MODE playing = GetStereoModeOfPlayingVideo(); int idx_preferred = -1 , idx_playing = -1 , idx_mono = -1 , idx_select = -1; // add choices idx_preferred = pDlgSelect->Add( g_localizeStrings.Get(36530) + " (" + GetLabelForStereoMode(preferred) + ")"); if(preferred != RENDER_STEREO_MODE_MONO) idx_mono = pDlgSelect->Add( g_localizeStrings.Get(36529) ); // mono / 2d if(playing != RENDER_STEREO_MODE_OFF && g_Windowing.SupportsStereo(playing)) idx_playing = pDlgSelect->Add( g_localizeStrings.Get(36532) + " (" + GetLabelForStereoMode(playing) + ")"); idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select pDlgSelect->DoModal(); if(pDlgSelect->IsConfirmed()) { int iItem = pDlgSelect->GetSelectedLabel(); if (iItem == idx_preferred) mode = preferred; else if (iItem == idx_mono) mode = RENDER_STEREO_MODE_MONO; else if (iItem == idx_playing) mode = playing; else if (iItem == idx_select) mode = GetStereoModeByUserChoice(); SetStereoMode(mode); } CApplicationMessenger::Get().MediaUnPause(); } break; case 1: // Stereoscopic SetStereoMode( GetPreferredPlaybackMode() ); break; default: break; } }