Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Suggestion: Simplify vdr update for modded dvb-cards



On Mittwoch, 3. November 2004 19:29, Christoph Hermanns wrote:
> 
> As owner of a modded Nexus dvb-card with 4MB RAM it is a little bit nasty  
> for me
> to edit the dvbosd.c file every time when i want to compile a new fresh  
> vdr version
> and change the line 21
> #define MAXOSDMEMORY  92000 // number of bytes available to the OSD  
> (depends on firmware version, but there is no way of determining the  
> actual value)
> into
> #define MAXOSDMEMORY  1000000 // for 4mb mod
> 
> 
> I suggest to introduce a user option in the Make.config file
> to change the MAXOSDMEMORY value if necessary, because i easily copy my  
> personal
> Make.config file from the previous vdr version to the new one i want to  
> compile.
> 
> For example:
> 
> In Make.config :
> 
> MAXOSDMEMORY=1000000
> 
> and in dvbosd.c :
> 
> ifndef MAXOSDMEMORY
> #define MAXOSDMEMORY  92000 // default number of bytes available to the OSD
> endif
> 
> 
> should change the behaviour as needed.
> Any other suggestions are welcome of course.

This is my way[tm] to do it:

--------------------------------  snip ---------------------------------
--- vdr-1.3.12.org/dvbosd.c	Sun Jul 18 15:51:42 2004
+++ vdr-1.3.12/dvbosd.c	Sun Jul 18 19:37:25 2004
@@ -23,6 +23,7 @@
 class cDvbOsd : public cOsd {
 private:
   int osdDev;
+  long osdMaxMem;
   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,13 @@ cDvbOsd::cDvbOsd(int Left, int Top, int 
   if (osdDev < 0)
      esyslog("ERROR: illegal OSD device handle (%d)!", osdDev);
   else {
+     osdMaxMem = MAXOSDMEMORY;
+#ifdef OSD_CAP_MEMSIZE
+     osd_cap_t cap;
+     cap.cmd = OSD_CAP_MEMSIZE;
+     if (ioctl(osdDev, OSD_GET_CAPABILITY, &cap) == 0)
+        osdMaxMem = 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 +82,7 @@ eOsdError cDvbOsd::CanHandleAreas(const 
             return oeWrongAlignment;
          TotalMemory += Areas[i].Width() * Areas[i].Height() / (8 / Areas[i].bpp);
          }
-     if (TotalMemory > MAXOSDMEMORY)
+     if (TotalMemory > osdMaxMem)
         return oeOutOfMemory;
      }
   return Result;
--------------------------------  snip ---------------------------------

So, if you use a recent driver and up-to-date user-space headers, the
size of the OSD memory will be detected automagically.

If you use an old driver or old headers OSD size will bet set for 2MB
cards (for backward compatibility).

I have submitted this patch to Klaus some time ago but he didn't have the
time to look into this yet.

HTH
Oliver
-- 
--------------------------------------------------------
VDR Remote Plugin available at
http://www.escape-edv.de/endriss/vdr/
--------------------------------------------------------




Home | Main Index | Thread Index