10 #include <linux/dvb/osd.h>
12 #include <sys/ioctl.h>
13 #include <sys/unistd.h>
14 #include <vdr/tools.h>
18 #define MAXNUMWINDOWS 7 // OSD windows are counted 1...7
19 #define MAXOSDMEMORY 92000 // number of bytes available to the OSD (for unmodified DVB cards)
26 void Cmd(OSD_Command cmd,
int color = 0,
int x0 = 0,
int y0 = 0,
int x1 = 0,
int y1 = 0,
const void *data = NULL);
34 virtual void Flush(
void);
38 :
cOsd(Left, Top, Level)
46 #ifdef OSD_CAP_MEMSIZE
49 cap.cmd = OSD_CAP_MEMSIZE;
50 if (ioctl(
osdDev, OSD_GET_CAPABILITY, &cap) == 0)
69 Cmd(OSD_SetWindow, 0, i + 1);
77 Cmd(OSD_SetWindow, 0, i + 1);
92 for (
int i = 0; i < NumAreas; i++) {
93 if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8)
95 if ((Areas[i].
Width() & (8 / Areas[i].bpp - 1)) != 0)
99 TotalMemory += Areas[i].
Width() * Areas[i].
Height() / (8 / Areas[i].
bpp);
111 Cmd(OSD_SetWindow, 0, i + 1);
119 void cDvbSdFfOsd::Cmd(OSD_Command cmd,
int color,
int x0,
int y0,
int x1,
int y1,
const void *data)
129 dc.data = (
void *)data;
130 ioctl(
osdDev, OSD_SEND_CMD, &dc);
139 for (
int i = 0; (Bitmap =
GetBitmap(i)) != NULL; i++) {
140 Cmd(OSD_SetWindow, 0, i + 1);
143 int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
144 if (!
shown || Bitmap->
Dirty(x1, y1, x2, y2)) {
147 x2 = Bitmap->
Width() - 1;
148 y2 = Bitmap->
Height() - 1;
153 while ((x1 > 0 || x2 < Bitmap->
Width() - 1) && ((x2 - x1) & 7) != 7) {
154 if (x2 < Bitmap->
Width() - 1)
160 while ((y1 > 0 || y2 < Bitmap->
Height() - 1) && (((x2 - x1 + 1) * (y2 - y1 + 1) / 2) & 7) != 0) {
161 if (y2 < Bitmap->
Height() - 1)
166 while ((x1 > 0 || x2 < Bitmap->
Width() - 1) && (((x2 - x1 + 1) * (y2 - y1 + 1) / 2) & 7) != 0) {
167 if (x2 < Bitmap->
Width() - 1)
178 for (
int i = 0; i < NumColors; i++) {
180 colors[i] = (Colors[i] & 0xFF000000) | ((Colors[i] & 0x0000FF) << 16) | (Colors[i] & 0x00FF00) | ((Colors[i] & 0xFF0000) >> 16);
184 Cmd(OSD_SetPalette, 0, NumColors - 1, 0, 0, 0, Colors);
187 Cmd(OSD_SetBlock, Bitmap->
Width(), x1, y1, x2, y2, Bitmap->
Data(x1, y1));
193 for (
int i = 0; (Bitmap =
GetBitmap(i)) != NULL; i++) {
194 Cmd(OSD_SetWindow, 0, i + 1);
195 Cmd(OSD_MoveWindow, 0,
Left() + Bitmap->
X0(),
Top() + Bitmap->
Y0());