Mailing List archive

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

[linux-dvb] OSD_FillBlock not working with color '0'



The OSD_FillBlock call apparently doesn't work as expected with
color '0'. To demonstrate this I have put together a short example
that does the following:

1. Opens an OSD window at position (100, 100) with a width and
   height of 100.

2. Sets the colors to 0=red, 1=green, 2=blue and 3=yellow.

3. Fills the entire window with "green".

4. Fills the lower right quarter of the window with "red".
   This is color #0, so apparently drawing with color 0 over
   an area that has already been drawn to with a different color
   works.

5. Sets up an array filled with 0x00 (TestColor) and calls OSD_SetBlock
   to fill the upper left quarter of the window with "red". Apparently this
   doesn't work.

6. Fills the array with 0x02 (blue) and calls OSD_SetBlock to fill the
   center of the window with "blue". This works fine.

Please note that this is just a simple example for demonstration
purposes. In the actual application VDR of course has bitmaps that
are filled with a combination of colors, one of them being 0x00.

To prove that the example actually works with a different color, try
setting TestColor to 3 in the source and run the program again. Now
the upper left corner gets filled with "yellow".

In order to make VDR work with fewer memory for the OSD I need to
use OSD windows that have only 2bpp. That mode should give us 4 colors,
but if color 0 can't be used when drawing bitmaps, we end up with
only 3 colors, which makes it very hard to create an interactive menu.

My guess would be that this should only be a very small bug in the firmware
(maybe at some point when copying the bitmap data a value of 0x00 is simply
skipped?), so I sincerely hope that one of the driver developers could find
it in his/her heart to look into this, even though the OSD has no meaning for
'convergence'. It would mean a lot for VDR, because then the OSD could be as
large as the entire tv screen, and I could implement a whole new EPG window
(much like the SKY-digital EPG).

Ok, there is, of course, another possibility: I did something wrong.
In that case, I would appreciate any hints that could set me on the right track :-)

Here's the test program. Save it as 'test.c' and compile it with

  g++ -I../DVB/ost/include test.c

------------------------------------------------------------------------------------
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <ost/osd.h>

int f = -1;

void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL)
{
  if (f >= 0) {
     osd_cmd_t dc;
     dc.cmd   = cmd;
     dc.color = color;
     dc.x0    = x0;
     dc.y0    = y0;
     dc.x1    = x1;
     dc.y1    = y1;
     dc.data  = (void *)data;
     // must block all signals, otherwise the command might not be fully executed
     sigset_t set, oldset;
     sigfillset(&set);
     sigprocmask(SIG_BLOCK, &set, &oldset);
     ioctl(f, OSD_SEND_CMD, &dc);
     sigprocmask(SIG_SETMASK, &oldset, NULL);
     usleep(10);
     }
}

int main(void)
{
  const int TestColor = 0; // change this to 3 for testing

  f = open("/dev/ost/osd", O_RDWR);
  if (f >= 0) {
     Cmd(OSD_Open, 2, 100, 100, 200, 200);
     Cmd(OSD_SetColor, 0, 127,   0,   0, 255); // red
     Cmd(OSD_SetColor, 1,   0, 127,   0, 255); // green
     Cmd(OSD_SetColor, 2,   0,   0, 127, 255); // blue
     Cmd(OSD_SetColor, 3, 127, 127,   0, 255); // yellow
     Cmd(OSD_FillBlock, 1,  0,  0, 100, 100);
     sleep(1);
     Cmd(OSD_FillBlock, 0, 50, 50, 100, 100);

     char a[10000];
     memset(a, TestColor, sizeof(a));
     sleep(1);
     Cmd(OSD_SetBlock, 101,  0,  0, 63, 63, a);
     memset(a, 2, sizeof(a));
     sleep(1);
     Cmd(OSD_SetBlock, 101, 20, 20, 83, 83, a);

     sleep(20);

     Cmd(OSD_Close);
     close(f);
     }
}
------------------------------------------------------------------------------------

Klaus
-- 
_______________________________________________________________

Klaus Schmidinger                       Phone: +49-8635-6989-10
CadSoft Computer GmbH                   Fax:   +49-8635-6989-40
Hofmark 2                               Email:   kls@cadsoft.de
D-84568 Pleiskirchen, Germany           URL:     www.cadsoft.de
_______________________________________________________________


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index