RENDER_STEREO_MODE CStereoscopicsManager::GetPreferredPlaybackMode(void) { RENDER_STEREO_MODE playbackMode = m_lastStereoMode; int preferredMode = CSettings::Get().GetInt("videoscreen.preferedstereoscopicmode"); if (preferredMode == RENDER_STEREO_MODE_AUTO) // automatic mode, detect by movie { if (g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) playbackMode = GetStereoModeOfPlayingVideo(); else if (playbackMode == RENDER_STEREO_MODE_OFF) playbackMode = GetNextSupportedStereoMode(RENDER_STEREO_MODE_OFF); } else // predefined mode { playbackMode = (RENDER_STEREO_MODE) preferredMode; } return playbackMode; }
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(CVariant{g_localizeStrings.Get(36528)}); else pDlgSelect->SetHeading(CVariant{heading}); // 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 ); } // inject AUTO pseudo mode after OFF if (i == RENDER_STEREO_MODE_OFF) { selectableModes.push_back(RENDER_STEREO_MODE_AUTO); pDlgSelect->Add(GetLabelForStereoMode(RENDER_STEREO_MODE_AUTO)); } } pDlgSelect->Open(); int iItem = pDlgSelect->GetSelectedLabel(); if (iItem > -1 && pDlgSelect->IsConfirmed()) mode = (RENDER_STEREO_MODE) selectableModes[iItem]; else mode = GetStereoMode(); return mode; }
void CStereoscopicsManager::SetStereoMode(const RENDER_STEREO_MODE &mode) { RENDER_STEREO_MODE currentMode = GetStereoMode(); RENDER_STEREO_MODE applyMode = mode; // resolve automatic mode before applying if (mode == RENDER_STEREO_MODE_AUTO) { if (g_infoManager.EvaluateBool("videoplayer.isstereoscopic")) applyMode = GetStereoModeOfPlayingVideo(); else applyMode = RENDER_STEREO_MODE_OFF; } if (applyMode != currentMode && applyMode >= RENDER_STEREO_MODE_OFF) { if (!g_Windowing.SupportsStereo(applyMode)) return; CSettings::Get().SetInt("videoscreen.stereoscopicmode", applyMode); } }
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::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; } }
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; } }