From 0e75aa82fe7d79e99f5369b379feaf2950eb92b3 Mon Sep 17 00:00:00 2001 From: scop Date: Mon, 14 Mar 2005 16:45:38 +0000 Subject: OSD flush rate limit patch from Luca Olivetti. --- HISTORY | 2 ++ dxr3osd_subpicture.c | 21 ++++++++++++++++++--- dxr3osd_subpicture.h | 19 ++++++++++++++++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index b8bd21b..48a2c64 100644 --- a/HISTORY +++ b/HISTORY @@ -255,3 +255,5 @@ NOTE: I havent found time to include all of the languages, will be done in pre2 - avoid hang in pause mode with VDR >= 1.3.18 (Luca Olivetti) - avoid high CPU usage in pause mode (Luca Olivetti, Klaus Schmidinger) - improved GetSTC(): fixes DVB subtitles sync problems (Mikko Tuumanen) +- limit OSD flush rate: prevents OSD from going berserk due to being + refreshed too often (Luca Olivetti, Ville Skyttä) diff --git a/dxr3osd_subpicture.c b/dxr3osd_subpicture.c index bc49086..07405e1 100644 --- a/dxr3osd_subpicture.c +++ b/dxr3osd_subpicture.c @@ -5,10 +5,15 @@ #define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 // ================================== -//! constructor cDxr3SubpictureOsd::cDxr3SubpictureOsd(int Left, int Top) : cOsd(Left, Top) { shown = false; +#if VDRVERSNUM >= 10318 + last = new cTimeMs(); + last->Set(-FLUSHRATE); +#else + last = time_ms() - FLUSHRATE; +#endif Spu = &cSPUEncoder::Instance(); // must clear all windows here to avoid flashing effects - doesn't work if done @@ -33,6 +38,9 @@ cDxr3SubpictureOsd::~cDxr3SubpictureOsd() Spu->Cmd(OSD_Close); } } +#if VDRVERSNUM >= 10318 + delete last; +#endif } // ================================== @@ -49,8 +57,7 @@ eOsdError cDxr3SubpictureOsd::CanHandleAreas(const tArea *Areas, int NumAreas) for (int i = 0; i < NumAreas; i++) { - // at the moment we dont support 256 color palette - if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4/* && Areas[i].bpp != 8*/) + if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8) { return oeBppNotSupported; } @@ -79,6 +86,14 @@ void cDxr3SubpictureOsd::RestoreRegion() // ================================== void cDxr3SubpictureOsd::Flush() { +#if VDRVERSNUM >= 10318 + if (last->Elapsed()Set(); +#else + if (time_ms()-last= 10307 +/* + The OSD goes berserk in some setups if it's refreshed too often. + If it doesn't happen for you or you don't like the small delay this + causes, change this to 0. Experiment with larger values if the default + of 25ms does not calm down your OSD. +*/ +#define FLUSHRATE 25 + // ================================== // osd interface for => vdr1,3,7 class cDxr3SubpictureOsd : public cOsd { private: - cSPUEncoder* Spu; ///< interface to cSPUEncoder - bool shown; ///< is the osd shown? + cSPUEncoder* Spu; + bool shown; +#if VDRVERSNUM >= 10318 + cTimeMs *last; +#else + int last; +#endif public: cDxr3SubpictureOsd(int Left, int Top/*, int SpuDev*/); -- cgit v1.2.3