diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index f28953e74..697c8927e 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -190,6 +191,7 @@ void CMoviePlayerGui::Init(void) keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_NORMAL; isLuaPlay = false; blockedFromPlugin = false; + m_screensaver=false; } void CMoviePlayerGui::cutNeutrino() @@ -952,6 +954,32 @@ void CMoviePlayerGui::PlayFileLoop(void) } showSubtitle(0); + if (playstate == CMoviePlayerGui::PAUSE && (msg == CRCInput::RC_timeout || msg == NeutrinoMessages::EVT_TIMER)) + { + int delay = time(NULL) - m_idletime; + int screensaver_delay = g_settings.screensaver_delay; + if (screensaver_delay != 0 && delay > screensaver_delay*60 && !m_screensaver) { + videoDecoder->setBlank(true); + screensaver(true); + } + } + else + { + m_idletime = time(NULL); + if (m_screensaver) + { + videoDecoder->setBlank(false); + screensaver(false); + //ignore first keypress stop - just quit the screensaver and call infoviewer + if (msg == CRCInput::RC_stop) { + g_RCInput->clearRCMsg(); + callInfoViewer(); + continue; + } + + } + } + if (msg == (neutrino_msg_t) g_settings.mpkey_plugin) { g_PluginList->startPlugin_by_name(g_settings.movieplayer_plugin.c_str ()); } else if (msg == (neutrino_msg_t) g_settings.mpkey_stop) { @@ -2238,3 +2266,18 @@ size_t CMoviePlayerGui::GetReadCount() //printf("GetReadCount: %lld\n", res); return (size_t) res; } + +void CMoviePlayerGui::screensaver(bool on) +{ + if (on) + { + m_screensaver = true; + CScreenSaver::getInstance()->Start(); + } + else + { + CScreenSaver::getInstance()->Stop(); + m_screensaver = false; + m_idletime = time(NULL); + } +} diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index ba1f2fadf..fcef1ea6f 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -107,6 +107,11 @@ class CMoviePlayerGui : public CMenuTarget unsigned short currentapid, currentac3; repeat_mode_enum repeat_mode; + /* screensaver */ + int m_idletime; + bool m_screensaver; + void screensaver(bool on); + /* subtitles vars */ unsigned short numsubs; std::string slanguage[MAX_PLAYBACK_PIDS];