- screensaver: user pictureviewer instead of videoDecoder ...

... to avoid interrupts while playing and keep pictures unscaled
This commit is contained in:
vanhofen
2014-12-24 23:24:11 +01:00
committed by svenhoefer
parent 4cf5e8ffd1
commit ecc98b7def
2 changed files with 22 additions and 7 deletions

View File

@@ -45,6 +45,7 @@ CScreenSaver::CScreenSaver()
{ {
thrScreenSaver = 0; thrScreenSaver = 0;
m_frameBuffer = CFrameBuffer::getInstance(); m_frameBuffer = CFrameBuffer::getInstance();
m_viewer = new CPictureViewer();
index = 0; index = 0;
} }
@@ -53,6 +54,8 @@ CScreenSaver::~CScreenSaver()
if(thrScreenSaver) if(thrScreenSaver)
pthread_cancel(thrScreenSaver); pthread_cancel(thrScreenSaver);
thrScreenSaver = 0; thrScreenSaver = 0;
delete m_viewer;
} }
@@ -70,6 +73,18 @@ void CScreenSaver::Start()
{ {
CAudioMute::getInstance()->enableMuteIcon(false); CAudioMute::getInstance()->enableMuteIcon(false);
m_viewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling);
m_viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY);
if (g_settings.video_Format == 3)
m_viewer->SetAspectRatio(16.0/9);
else
m_viewer->SetAspectRatio(4.0/3);
m_viewer->Cleanup();
videoDecoder->StopPicture();
if(!thrScreenSaver) if(!thrScreenSaver)
{ {
//printf("[%s] %s: starting thread\n", __FILE__, __FUNCTION__); //printf("[%s] %s: starting thread\n", __FILE__, __FUNCTION__);
@@ -91,6 +106,7 @@ void CScreenSaver::Stop()
pthread_cancel(thrScreenSaver); pthread_cancel(thrScreenSaver);
thrScreenSaver = 0; thrScreenSaver = 0;
m_frameBuffer->paintBackground(); //clear entire screen
CAudioMute::getInstance()->enableMuteIcon(true); CAudioMute::getInstance()->enableMuteIcon(true);
} }
@@ -152,7 +168,6 @@ bool CScreenSaver::ReadDir()
for (p = curr_ext; *p; ++p) for (p = curr_ext; *p; ++p)
*p = (char)tolower(*p); *p = (char)tolower(*p);
//printf("%s\n",curr_ext); //printf("%s\n",curr_ext);
if((strcmp(".jpg",curr_ext)) if((strcmp(".jpg",curr_ext))
//|| (strcmp(".png",curr_ext)) //|| (strcmp(".png",curr_ext))
//|| (strcmp(".bmp",curr_ext)) //|| (strcmp(".bmp",curr_ext))
@@ -204,11 +219,10 @@ void CScreenSaver::PaintPicture()
return; return;
} }
printf("[CScreenSaver] ShowPicture: %s\n", v_bg_files.at(index).c_str()); printf("[CScreenSaver] PaintPicture: %s\n", v_bg_files.at(index).c_str());
videoDecoder->StopPicture(); m_viewer->ShowImage(v_bg_files.at(index).c_str(), false /*unscaled*/);
videoDecoder->ShowPicture(v_bg_files.at(index).c_str());
index++;
index++;
if(index == v_bg_files.size()) if(index == v_bg_files.size())
index = 0; index = 0;
} }

View File

@@ -39,6 +39,7 @@ class CScreenSaver
static void* ScreenSaverPrg(void *arg); static void* ScreenSaverPrg(void *arg);
vector<string> v_bg_files; vector<string> v_bg_files;
unsigned int index; unsigned int index;
CPictureViewer *m_viewer;
bool ReadDir(); bool ReadDir();
void PaintPicture(); void PaintPicture();