movieplayer: Add screensaver function when movie player is paused

This commit is contained in:
defans
2016-01-03 12:24:59 +01:00
committed by M. Liebmann
parent fdf8bd4860
commit f661cb2ee3
2 changed files with 48 additions and 0 deletions

View File

@@ -44,6 +44,7 @@
#include <gui/plugins.h>
#include <gui/videosettings.h>
#include <gui/streaminfo2.h>
#include <gui/screensaver.h>
#include <driver/screenshot.h>
#include <driver/volume.h>
#include <driver/display.h>
@@ -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);
}
}