From 20f6194d4f8b132730a71979c307233e4520f3ee Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 20 Nov 2004 14:31:13 +0100 Subject: [PATCH] Now checking available OSD memory at runtime --- CONTRIBUTORS | 1 + HISTORY | 1 + dvbosd.c | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index bf0ce28b..dc465a71 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -539,6 +539,7 @@ Oliver Endriss for adding a sample setup for 'DisiCon-4 Single Cable Network' to 'diseqc.conf' for reporting a problem with the name of the remote control for which the keys are being learned overwriting the date/time in the 'classic' skin + for making cDvbOsd check available OSD memory at runtime Reinhard Walter Buchner for adding some satellites to 'sources.conf' diff --git a/HISTORY b/HISTORY index 9e85e997..1455e33a 100644 --- a/HISTORY +++ b/HISTORY @@ -3157,3 +3157,4 @@ Video Disk Recorder Revision History - Fixed a possible recursion in cControl::Shutdown() (thanks to Sascha Volkenandt). - Now setting the VPID before the APID in live mode to avoid unnecessary overhead in the firmware (thanks to Werner Fink). +- Now checking available OSD memory at runtime (thanks to Oliver Endriss). diff --git a/dvbosd.c b/dvbosd.c index 39032fd7..fbf6f61c 100644 --- a/dvbosd.c +++ b/dvbosd.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbosd.c 1.24 2004/07/18 10:20:05 kls Exp $ + * $Id: dvbosd.c 1.25 2004/11/20 14:29:25 kls Exp $ */ #include "dvbosd.h" @@ -18,11 +18,12 @@ // --- cDvbOsd --------------------------------------------------------------- #define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 -#define MAXOSDMEMORY 92000 // number of bytes available to the OSD (depends on firmware version, but there is no way of determining the actual value) +#define MAXOSDMEMORY 92000 // number of bytes available to the OSD (for unmodified DVB cards) class cDvbOsd : public cOsd { private: int osdDev; + int osdMem; bool shown; void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL); public: @@ -40,6 +41,14 @@ cDvbOsd::cDvbOsd(int Left, int Top, int OsdDev) if (osdDev < 0) esyslog("ERROR: illegal OSD device handle (%d)!", osdDev); else { + osdMem = MAXOSDMEMORY; +#ifdef OSD_CAP_MEMSIZE + // modified DVB cards may have more OSD memory: + osd_cap_t cap; + cap.cmd = OSD_CAP_MEMSIZE; + if (ioctl(osdDev, OSD_GET_CAPABILITY, &cap) == 0) + osdMem = cap.val; +#endif // must clear all windows here to avoid flashing effects - doesn't work if done // in Flush() only for the windows that are actually used... for (int i = 0; i < MAXNUMWINDOWS; i++) { @@ -74,7 +83,7 @@ eOsdError cDvbOsd::CanHandleAreas(const tArea *Areas, int NumAreas) return oeWrongAlignment; TotalMemory += Areas[i].Width() * Areas[i].Height() / (8 / Areas[i].bpp); } - if (TotalMemory > MAXOSDMEMORY) + if (TotalMemory > osdMem) return oeOutOfMemory; } return Result;