mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
framebuffer: add optional fallback handlings for showFrame() methode
This commit is contained in:
@@ -1549,36 +1549,67 @@ void CFrameBuffer::Clear()
|
|||||||
//memset(getFrameBufferPointer(), 0, stride * yRes);
|
//memset(getFrameBufferPointer(), 0, stride * yRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFrameBuffer::showFrame(const std::string & filename, bool fallback)
|
bool CFrameBuffer::showFrame(const std::string & filename, int fallback_mode)
|
||||||
{
|
{
|
||||||
std::string picture = getIconPath(filename, "");
|
std::string picture = getIconPath(filename, "");
|
||||||
#if HAVE_COOL_HARDWARE
|
bool ret = false;
|
||||||
(void)fallback;
|
|
||||||
if (access(picture.c_str(), F_OK) == 0)
|
|
||||||
{
|
|
||||||
videoDecoder->ShowPicture(picture.c_str());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
dprintf(DEBUG_NORMAL,"[CFrameBuffer]\[%s - %d], image not found: %s\n", __func__, __LINE__, picture.c_str());
|
|
||||||
|
|
||||||
return false;
|
if (access(picture.c_str(), F_OK) == 0)
|
||||||
|
{
|
||||||
|
#if HAVE_COOL_HARDWARE //FIXME: inside libcs no return value available
|
||||||
|
videoDecoder->ShowPicture(picture.c_str());
|
||||||
|
res = true;
|
||||||
|
#else
|
||||||
|
if (videoDecoder->ShowPicture(picture.c_str()))
|
||||||
|
ret = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dprintf(DEBUG_NORMAL,"[CFrameBuffer]\[%s - %d], image not found: %s\n", __func__, __LINE__, picture.c_str());
|
||||||
|
picture = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
if (fallback_mode)
|
||||||
|
{
|
||||||
|
if ((fallback_mode & SHOW_FRAME_FALLBACK_MODE_IMAGE) && !picture.empty())
|
||||||
|
ret = g_PicViewer->DisplayImage(picture, 0, 0, getScreenWidth(true), getScreenHeight(true), TM_NONE);
|
||||||
|
else
|
||||||
|
ret = false;
|
||||||
|
|
||||||
|
if (!ret && (fallback_mode & SHOW_FRAME_FALLBACK_MODE_BLACKSCREEN))
|
||||||
|
{
|
||||||
|
paintBoxRel(0, 0, getScreenWidth(true), getScreenHeight(true), COL_BLACK, 0);
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fallback_mode & SHOW_FRAME_FALLBACK_MODE_CALLBACK)
|
||||||
|
{
|
||||||
|
if (!OnFallbackShowFrame.empty())
|
||||||
|
{
|
||||||
|
OnFallbackShowFrame();
|
||||||
|
OnFallbackShowFrame.clear();
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dprintf(DEBUG_NORMAL,"[CFrameBuffer]\[%s - %d], fallback mode SHOW_FRAME_FALLBACK_MODE_CALLBACK is enabled but empty, callback ignored...\n", __func__, __LINE__);
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dprintf(DEBUG_NORMAL,"[CFrameBuffer]\[%s - %d], fallback mode is disabled, ignore black screen, image paint and callback actions: %s\n", __func__, __LINE__, picture.c_str());
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CFrameBuffer::stopFrame()
|
void CFrameBuffer::stopFrame()
|
||||||
{
|
{
|
||||||
|
@@ -266,7 +266,15 @@ 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 fallback = false);
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SHOW_FRAME_FALLBACK_MODE_OFF = 0,
|
||||||
|
SHOW_FRAME_FALLBACK_MODE_IMAGE = 1,
|
||||||
|
SHOW_FRAME_FALLBACK_MODE_BLACKSCREEN = 2,
|
||||||
|
SHOW_FRAME_FALLBACK_MODE_CALLBACK = 4
|
||||||
|
};
|
||||||
|
bool showFrame(const std::string & filename, int fallback_mode = SHOW_FRAME_FALLBACK_MODE_OFF);
|
||||||
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);
|
||||||
@@ -339,6 +347,7 @@ class CFrameBuffer : public sigc::trackable
|
|||||||
void doPaintMuteIcon(bool mode) { do_paint_mute_icon = mode; }
|
void doPaintMuteIcon(bool mode) { do_paint_mute_icon = mode; }
|
||||||
void blit(void) {}
|
void blit(void) {}
|
||||||
sigc::signal<void> OnAfterSetPallette;
|
sigc::signal<void> OnAfterSetPallette;
|
||||||
|
sigc::signal<void> OnFallbackShowFrame;
|
||||||
const char *fb_name;
|
const char *fb_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user