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());
void Clean(void)
Marks the dirty area as clean.
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
virtual void SetActive(bool On)
Sets this OSD to be the active one.
const tColor * Colors(int &NumColors) const
Returns a pointer to the complete color table and stores the number of valid entries in NumColors...
virtual void Flush(void)
Actually commits all data to the OSD hardware.
virtual void SetActive(bool On)
Sets this OSD to be the active one.
bool Dirty(int &x1, int &y1, int &x2, int &y2)
Tells whether there is a dirty area and returns the bounding rectangle of that area (relative to the ...
cDvbOsdProvider(int OsdDev)
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
The cOsd class is the interface to the "On Screen Display".
void Cmd(OSD_Command cmd, int color=0, int x0=0, int y0=0, int x1=0, int y1=0, const void *data=NULL)
virtual cOsd * CreateOsd(int Left, int Top, uint Level)
Returns a pointer to a newly created cOsd object, which will be located at the given coordinates...
const tIndex * Data(int x, int y) const
Returns the address of the index byte at the given coordinates.
cDvbSdFfOsd(int Left, int Top, int OsdDev, uint Level)
cBitmap * GetBitmap(int Area)
Returns a pointer to the bitmap for the given Area, or NULL if no such bitmap exists.
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.