/
osd.h
138 lines (104 loc) · 4.05 KB
/
osd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef __DBUS2VDR_OSD_H
#define __DBUS2VDR_OSD_H
#include "message.h"
#include <vdr/osd.h>
class cDBusOsdProvider;
class cDBusOsd : public cOsd
{
private:
friend class cDBusOsdProvider;
static int osd_number;
cDBusOsdProvider& provider;
int osd_index;
cString osd_dir;
int counter;
protected:
cDBusOsd(cDBusOsdProvider& Provider, int Left, int Top, uint Level);
// virtual void SetActive(bool On) { cOsd::SetActive(On); }
public:
virtual ~cDBusOsd();
// virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
// virtual void DestroyPixmap(cPixmap *Pixmap);
// virtual void DrawImage(const cPoint &Point, const cImage &Image);
// virtual void DrawImage(const cPoint &Point, int ImageHandle);
// virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas) { return cOsd::CanHandleAreas(Areas, NumAreas); }
// virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
// virtual void SaveRegion(int x1, int y1, int x2, int y2);
// virtual void RestoreRegion(void);
// virtual eOsdError SetPalette(const cPalette &Palette, int Area);
// virtual void DrawPixel(int x, int y, tColor Color);
// virtual void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false, bool Overlay = false);
// virtual void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width = 0, int Height = 0, int Alignment = taDefault);
// virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color);
// virtual void DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants = 0);
// virtual void DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type);
virtual void Flush(void);
///< Actually commits all data to the OSD hardware.
///< Flush() should return as soon as possible.
///< For a true color OSD using the default implementation with in memory
///< pixmaps, the Flush() function should basically do something like this:
///<
///< LOCK_PIXMAPS;
///< while (cPixmapMemory *pm = RenderPixmaps()) {
///< int w = pm->ViewPort().Width();
///< int h = pm->ViewPort().Height();
///< int d = w * sizeof(tColor);
///< MyOsdDrawPixmap(Left() + pm->ViewPort().X(), Top() + pm->ViewPort().Y(), pm->Data(), w, h, h * d);
///< delete pm;
///< }
};
class cDbusOsdMsg : public cListObject
{
public:
const char *action;
cString file;
int left, top, vx, vy;
cDbusOsdMsg(const char *Action, const cString& File, int Left, int Top, int Vx, int Vy)
:action(Action),file(File),left(Left),top(Top),vx(Vx),vy(Vy)
{
}
virtual ~cDbusOsdMsg(void);
};
class cDBusOsdProvider : public cOsdProvider, public cThread
{
friend class cDBusMessageOsd;
private:
static cDBusOsdProvider *_provider;
cMutex msgMutex;
cCondVar msgCond;
cList<cDbusOsdMsg> msgQueue;
protected:
virtual cOsd *CreateOsd(int Left, int Top, uint Level);
virtual bool ProvidesTrueColor(void) { return true; }
// virtual int StoreImageData(const cImage &Image);
// virtual void DropImageData(int ImageHandle);
virtual void Action(void);
public:
cDBusOsdProvider(void);
virtual ~cDBusOsdProvider();
void SendMessage(cDbusOsdMsg *Msg);
};
class cDBusMessageOsd : public cDBusMessage
{
friend class cDBusDispatcherOsd;
public:
enum eAction { dmoCreateProvider, dmoDeleteProvider };
virtual ~cDBusMessageOsd(void);
protected:
virtual void Process(void);
private:
cDBusMessageOsd(eAction action, DBusConnection* conn, DBusMessage* msg);
void CreateProvider(void);
void DeleteProvider(void);
eAction _action;
};
class cDBusDispatcherOsd : public cDBusMessageDispatcher
{
public:
cDBusDispatcherOsd(void);
virtual ~cDBusDispatcherOsd(void);
protected:
virtual cDBusMessage *CreateMessage(DBusConnection* conn, DBusMessage* msg);
virtual bool OnIntrospect(DBusMessage *msg, cString &Data);
};
#endif