screensaver.cpp: use fallback if video decoder is busy

This commit is contained in:
GetAway
2019-01-13 11:13:24 +01:00
parent acc651e528
commit 8b7de5fc8f
3 changed files with 19 additions and 8 deletions

View File

@@ -38,6 +38,7 @@
#include <signal.h> #include <signal.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <memory.h> #include <memory.h>
#include <math.h> #include <math.h>
@@ -50,6 +51,7 @@
#include <gui/osd_helpers.h> #include <gui/osd_helpers.h>
#include <gui/pictureviewer.h> #include <gui/pictureviewer.h>
#include <system/debug.h> #include <system/debug.h>
#include <zapit/settings.h>
#include <global.h> #include <global.h>
#include <hardware/video.h> #include <hardware/video.h>
#include <cs_api.h> #include <cs_api.h>
@@ -1546,15 +1548,24 @@ void CFrameBuffer::Clear()
//memset(getFrameBufferPointer(), 0, stride * yRes); //memset(getFrameBufferPointer(), 0, stride * yRes);
} }
bool CFrameBuffer::showFrame(const std::string & filename) bool CFrameBuffer::showFrame(const std::string & filename, bool fallback)
{ {
std::string picture = getIconPath(filename, ""); std::string picture = getIconPath(filename, "");
if (access(picture.c_str(), F_OK) == 0){ if (access(picture.c_str(), F_OK) == 0)
videoDecoder->ShowPicture(picture.c_str()); {
return true; if (videoDecoder->ShowPicture(picture.c_str()))
return true;
else
{
if (fallback) {
return g_PicViewer->DisplayImage(picture, 0, 0, getScreenWidth(true), getScreenHeight(true), TM_NONE);
}
else
dprintf(DEBUG_NORMAL,"[CFrameBuffer]\[%s - %d], fallback is disabled, paint of image was stopped: %s\n", __func__, __LINE__, picture.c_str());
}
} }
else else
printf("[CFrameBuffer]\[%s - %d], image not found: %s\n", __func__, __LINE__, picture.c_str()); dprintf(DEBUG_NORMAL,"[CFrameBuffer]\[%s - %d], image not found: %s\n", __func__, __LINE__, picture.c_str());
return false; return false;
} }

View File

@@ -266,7 +266,7 @@ class CFrameBuffer : public sigc::trackable
void RestoreScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp); void RestoreScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp);
void Clear(); void Clear();
bool showFrame(const std::string & filename); bool showFrame(const std::string & filename, bool fallback = false);
void stopFrame(); void stopFrame();
bool loadBackgroundPic(const std::string & filename, bool show = true); bool loadBackgroundPic(const std::string & filename, bool show = true);
bool Lock(void); bool Lock(void);

View File

@@ -302,7 +302,7 @@ void CScreenSaver::paint()
dprintf(DEBUG_INFO, "[CScreenSaver] %s - %d : %s\n", __func__, __LINE__, v_bg_files.at(index).c_str()); dprintf(DEBUG_INFO, "[CScreenSaver] %s - %d : %s\n", __func__, __LINE__, v_bg_files.at(index).c_str());
#if HAVE_ARM_HARDWARE #if HAVE_ARM_HARDWARE
m_frameBuffer->showFrame(v_bg_files.at(index)); m_frameBuffer->showFrame(v_bg_files.at(index), true);
#else #else
paintImage(v_bg_files.at(index), 0, 0, m_frameBuffer->getScreenWidth(true), m_frameBuffer->getScreenHeight(true)); paintImage(v_bg_files.at(index), 0, 0, m_frameBuffer->getScreenWidth(true), m_frameBuffer->getScreenHeight(true));
#endif #endif
@@ -322,7 +322,7 @@ void CScreenSaver::paint()
scr_clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]); scr_clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]);
scr_clock->disableSaveBg(); scr_clock->disableSaveBg();
scr_clock->doPaintBg(false); scr_clock->doPaintBg(false);
m_frameBuffer->showFrame("blackscreen.jpg"); m_frameBuffer->showFrame("blackscreen.jpg", true);
} }
scr_clock->setTextColor(clr.i_color); scr_clock->setTextColor(clr.i_color);