summaryrefslogtreecommitdiff
path: root/dvbosd.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-11-20 14:31:13 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2004-11-20 14:31:13 +0100
commit20f6194d4f8b132730a71979c307233e4520f3ee (patch)
treeeb6c3c5df3abb44d49d4b8b607f06b6438ec9f67 /dvbosd.c
parentedc1440ed8ad50e075dc39de9ac5dee1f552542b (diff)
downloadvdr-20f6194d4f8b132730a71979c307233e4520f3ee.tar.gz
vdr-20f6194d4f8b132730a71979c307233e4520f3ee.tar.bz2
Now checking available OSD memory at runtime
Diffstat (limited to 'dvbosd.c')
-rw-r--r--dvbosd.c15
1 files changed, 12 insertions, 3 deletions
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;