summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY2
-rw-r--r--dxr3osd_subpicture.c21
-rw-r--r--dxr3osd_subpicture.h19
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()<FLUSHRATE) return;
+ last->Set();
+#else
+ if (time_ms()-last<FLUSHRATE) return;
+ last = time_ms();
+#endif
+
cBitmap *Bitmap;
for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++)
diff --git a/dxr3osd_subpicture.h b/dxr3osd_subpicture.h
index e128380..e20566b 100644
--- a/dxr3osd_subpicture.h
+++ b/dxr3osd_subpicture.h
@@ -2,17 +2,30 @@
#define _DXR3OSD_SUBPICTURE_H_
#include "dxr3vdrincludes.h"
-#include "dxr3spuencoder.h"
+#include "dxr3interface_spu_encoder.h"
#if VDRVERSNUM >= 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*/);