-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnulldevice.c
105 lines (86 loc) · 3.09 KB
/
nulldevice.c
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
#include "nulldevice.h"
#include <vdr/osd.h>
#include <vdr/player.h>
class cNullOsd : public cOsd {
public:
cNullOsd(int Left, int Top, uint Level) : cOsd(Left, Top, Level) {}
virtual ~cNullOsd() {}
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null) { return 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 oeOk; }
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas) { return oeOk; }
virtual void SaveRegion(int x1, int y1, int x2, int y2) {}
virtual void RestoreRegion(void) {}
virtual eOsdError SetPalette(const cPalette &Palette, int Area) { return oeOk; }
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) {}
};
class cNullOsdProvider : public cOsdProvider {
protected:
virtual cOsd *CreateOsd(int Left, int Top, uint Level) { return new cNullOsd(Left, Top, Level); }
virtual bool ProvidesTrueColor(void) { return true; }
virtual int StoreImageData(const cImage &Image) { return 0; }
virtual void DropImageData(int ImageHandle) {}
public:
cNullOsdProvider() : cOsdProvider()
{
isyslog("dbus2vdr: Null-Osd-Provider created");
}
virtual ~cNullOsdProvider()
{
isyslog("dbus2vdr: Null-Osd-Provider destroyed");
}
};
class cNullPlayer : public cPlayer {
public:
cNullPlayer(void);
virtual ~cNullPlayer(void);
};
cNullPlayer::cNullPlayer(void)
{
isyslog("dbus2vdr: Null-Player created");
}
cNullPlayer::~cNullPlayer(void)
{
Detach();
isyslog("dbus2vdr: Null-Player destroyed");
}
class cNullControl : public cControl {
public:
static cNullPlayer *Player;
virtual void Hide(void) {}
cNullControl(void);
virtual ~cNullControl(void);
};
cNullPlayer *cNullControl::Player = NULL;
cNullControl::cNullControl(void)
:cControl(Player = new cNullPlayer)
{
isyslog("dbus2vdr: Null-Control created");
}
cNullControl::~cNullControl(void)
{
delete Player;
Player = NULL;
isyslog("dbus2vdr: Null-Control destroyed");
}
void cNullDevice::MakePrimaryDevice(bool On)
{
cDevice::MakePrimaryDevice(On);
if (On) {
new cNullOsdProvider();
if (cNullControl::Player == NULL) {
cControl::Launch(new cNullControl());
cControl::Attach();
}
}
else if (cNullControl::Player)
cControl::Shutdown();
}