From bc9cb23ed73c7b85210c8948135773b973fc2927 Mon Sep 17 00:00:00 2001 From: kamel5 Date: Fri, 11 Dec 2020 18:14:16 +0100 Subject: [PATCH] Refresh imgCache if OsdProvider was changed (Thanks to lnj @vdr-portal.de) --- config.c | 10 ++++++++++ config.h | 2 ++ designer.c | 11 ++++++++++- skindesigner.c | 18 +++++++++++++++++- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index af8661b..3521615 100644 --- a/config.c +++ b/config.c @@ -462,6 +462,16 @@ bool cDesignerConfig::OsdSizeChanged(void) { return false; } +// If softhddevice is suspended, it gives the video size 0x0 +// We use this for detect a play mode change and drop the cache, because it is corrupted after being suspended +bool cDesignerConfig::PlayModeChanged(void) { + if (mode_changed) { + mode_changed = 0; + return true; + } + return false; +} + void cDesignerConfig::SetOSDFonts(void) { fontFix = Setup.FontFix; fontOsd = Setup.FontOsd; diff --git a/config.h b/config.h index 50860de..cffab3f 100644 --- a/config.h +++ b/config.h @@ -92,6 +92,7 @@ public: bool SkinChanged(void); void SetOSDSize(void); bool OsdSizeChanged(void); + bool PlayModeChanged(void); void SetOSDFonts(void); bool OsdFontsChanged(void); void SetOsdLanguage(void) { osdLanguage = Setup.OSDLanguage; }; @@ -118,6 +119,7 @@ public: int FPS; //TemplateReload on Setup Close bool setupCloseDoReload; + int mode_changed; }; #ifdef DEFINE_CONFIG diff --git a/designer.c b/designer.c index b6f35b1..c0dd20a 100644 --- a/designer.c +++ b/designer.c @@ -171,6 +171,7 @@ void cSkinDesigner::ListCustomTokens(void) { } skindesignerapi::ISkinDisplayPlugin *cSkinDesigner::GetDisplayPlugin(int plugId) { + Init(); map::iterator hit = pluginViews.find(plugId); if (hit == pluginViews.end()) return NULL; @@ -194,7 +195,7 @@ void cSkinDesigner::Init(void) { config.SetOSDFonts(); } dsyslog("skindesigner: initializing skin %s", skin.c_str()); - + config.CheckDecimalPoint(); plgManager->Reset(); @@ -235,6 +236,14 @@ void cSkinDesigner::Init(void) { watch.Stop("templates loaded and caches created"); } } + else if (config.PlayModeChanged()) + { + dsyslog ("skindesigner: drop image cache"); + if (imgCache) + delete imgCache; + imgCache = new cImageCache(); + imgCache->SetPathes(); + } } void cSkinDesigner::DeleteViews(void) { diff --git a/skindesigner.c b/skindesigner.c index f88c074..0f9889a 100644 --- a/skindesigner.c +++ b/skindesigner.c @@ -7,6 +7,7 @@ */ #include #include +#include #define DEFINE_CONFIG 1 #include "config.h" @@ -20,7 +21,7 @@ #endif -static const char *VERSION = "1.2.8.4"; +static const char *VERSION = "1.2.8.6"; static const char *DESCRIPTION = trNOOP("Skin Designer"); class cPluginSkinDesigner : public cPlugin, public skindesignerapi::SkindesignerAPI { @@ -175,6 +176,21 @@ void cPluginSkinDesigner::Housekeeping(void) { } void cPluginSkinDesigner::MainThreadHook(void) { + int w, h; + double a; + static int mode; + cDevice::PrimaryDevice()->GetVideoSize(w, h, a); + + if (!w && !h && !mode) { + mode = 1; + config.mode_changed = 1; + dsyslog("skindesigner: w %d h %d mode changed to %d\n", w, h, mode); + } + else if (w && h && mode) { + mode = 0; + config.mode_changed = 1; + dsyslog("skindesigner: w %d h %d mode changed to %d\n", w, h, mode); + } } cString cPluginSkinDesigner::Active(void) {