screensaver.cpp: use fallback if video decoder is busy

Origin commit data
------------------
Commit: 7c66036c2a
Author: GetAway <get-away@t-online.de>
Date: 2019-03-12 (Tue, 12 Mar 2019)
This commit is contained in:
GetAway
2019-03-12 22:00:11 +01:00
committed by vanhofen
parent d60c56091f
commit 0c5556a9f7
2 changed files with 17 additions and 6 deletions

View File

@@ -38,6 +38,7 @@
#include <signal.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <memory.h>
#include <math.h>
@@ -50,6 +51,7 @@
#include <gui/osd_helpers.h>
#include <gui/pictureviewer.h>
#include <system/debug.h>
#include <zapit/settings.h>
#include <global.h>
#include <hardware/video.h>
#include <cs_api.h>
@@ -1541,15 +1543,24 @@ void CFrameBuffer::Clear()
//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, "");
if (access(picture.c_str(), F_OK) == 0){
videoDecoder->ShowPicture(picture.c_str());
return true;
if (access(picture.c_str(), F_OK) == 0)
{
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
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;
}

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 Clear();
bool showFrame(const std::string & filename);
bool showFrame(const std::string & filename, bool fallback = false);
void stopFrame();
bool loadBackgroundPic(const std::string & filename, bool show = true);
bool Lock(void);