Refresh imgCache if OsdProvider was changed (Thanks to lnj @vdr-portal.de)

This commit is contained in:
kamel5 2020-12-11 18:14:16 +01:00
parent df8c8e2993
commit bc9cb23ed7
4 changed files with 39 additions and 2 deletions

View File

@ -462,6 +462,16 @@ bool cDesignerConfig::OsdSizeChanged(void) {
return false; 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) { void cDesignerConfig::SetOSDFonts(void) {
fontFix = Setup.FontFix; fontFix = Setup.FontFix;
fontOsd = Setup.FontOsd; fontOsd = Setup.FontOsd;

View File

@ -92,6 +92,7 @@ public:
bool SkinChanged(void); bool SkinChanged(void);
void SetOSDSize(void); void SetOSDSize(void);
bool OsdSizeChanged(void); bool OsdSizeChanged(void);
bool PlayModeChanged(void);
void SetOSDFonts(void); void SetOSDFonts(void);
bool OsdFontsChanged(void); bool OsdFontsChanged(void);
void SetOsdLanguage(void) { osdLanguage = Setup.OSDLanguage; }; void SetOsdLanguage(void) { osdLanguage = Setup.OSDLanguage; };
@ -118,6 +119,7 @@ public:
int FPS; int FPS;
//TemplateReload on Setup Close //TemplateReload on Setup Close
bool setupCloseDoReload; bool setupCloseDoReload;
int mode_changed;
}; };
#ifdef DEFINE_CONFIG #ifdef DEFINE_CONFIG

View File

@ -171,6 +171,7 @@ void cSkinDesigner::ListCustomTokens(void) {
} }
skindesignerapi::ISkinDisplayPlugin *cSkinDesigner::GetDisplayPlugin(int plugId) { skindesignerapi::ISkinDisplayPlugin *cSkinDesigner::GetDisplayPlugin(int plugId) {
Init();
map<int, cViewPlugin*>::iterator hit = pluginViews.find(plugId); map<int, cViewPlugin*>::iterator hit = pluginViews.find(plugId);
if (hit == pluginViews.end()) if (hit == pluginViews.end())
return NULL; return NULL;
@ -194,7 +195,7 @@ void cSkinDesigner::Init(void) {
config.SetOSDFonts(); config.SetOSDFonts();
} }
dsyslog("skindesigner: initializing skin %s", skin.c_str()); dsyslog("skindesigner: initializing skin %s", skin.c_str());
config.CheckDecimalPoint(); config.CheckDecimalPoint();
plgManager->Reset(); plgManager->Reset();
@ -235,6 +236,14 @@ void cSkinDesigner::Init(void) {
watch.Stop("templates loaded and caches created"); 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) { void cSkinDesigner::DeleteViews(void) {

View File

@ -7,6 +7,7 @@
*/ */
#include <getopt.h> #include <getopt.h>
#include <vdr/plugin.h> #include <vdr/plugin.h>
#include <vdr/device.h>
#define DEFINE_CONFIG 1 #define DEFINE_CONFIG 1
#include "config.h" #include "config.h"
@ -20,7 +21,7 @@
#endif #endif
static const char *VERSION = "1.2.8.4"; static const char *VERSION = "1.2.8.6";
static const char *DESCRIPTION = trNOOP("Skin Designer"); static const char *DESCRIPTION = trNOOP("Skin Designer");
class cPluginSkinDesigner : public cPlugin, public skindesignerapi::SkindesignerAPI { class cPluginSkinDesigner : public cPlugin, public skindesignerapi::SkindesignerAPI {
@ -175,6 +176,21 @@ void cPluginSkinDesigner::Housekeeping(void) {
} }
void cPluginSkinDesigner::MainThreadHook(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) { cString cPluginSkinDesigner::Active(void) {