-
Notifications
You must be signed in to change notification settings - Fork 0
/
dummy_player.c
103 lines (87 loc) · 2.4 KB
/
dummy_player.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
/*
* dummy_player.c: Player that does nothing (saves CPU time)
*
* See the main source file '.c' for copyright information and
* how to reach the author.
*
*/
#include <vdr/status.h>
#include "dummy_player.h"
#include "timer.h"
#ifndef STILLPICTURE_INTERVAL
# define STILLPICTURE_INTERVAL (5*1000) // 5 sec
#endif
// --- cDummyPlayerControl --------------------------------------------------
extern const unsigned char v_mpg_vdrlogo[]; // vdrlogo_720x576.c
extern const int v_mpg_vdrlogo_length; // vdrlogo_720x576.c
//extern const unsigned char v_mpg_nosignal[];// nosignal_720x576.c
//extern const int v_mpg_nosignal_length; // nosignal_720x576.c
extern const unsigned char v_mpg_black[]; // black_720x576.c
extern const int v_mpg_black_length; // black_720x576.c
class cDummyPlayer : public cPlayer {
protected:
virtual void Activate(bool On)
{
if(On) {
TimerHandler();
CreateTimerEvent(this, &cDummyPlayer::TimerHandler,
STILLPICTURE_INTERVAL);
} else {
CancelTimerEvents(this);
}
}
bool TimerHandler(void)
{
if(! cDummyPlayerControl::UseBlankImage)
DeviceStillPicture(v_mpg_vdrlogo, v_mpg_vdrlogo_length);
else
DeviceStillPicture(v_mpg_black, v_mpg_black_length);
//DeviceStillPicture(v_mpg_nosignal, v_mpg_nosignal_length);
return true;
}
public:
cDummyPlayer(void) {};
virtual ~cDummyPlayer()
{
Activate(false);
Detach();
}
};
// --- cDummyPlayerControl --------------------------------------------------
cDummyPlayer *cDummyPlayerControl::m_Player = NULL;
cMutex cDummyPlayerControl::m_Lock;
bool cDummyPlayerControl::UseBlankImage = false;
cDummyPlayerControl::cDummyPlayerControl(void) :
cControl(OpenPlayer())
{
cStatus::MsgReplaying(this, "none", NULL, true);
}
cDummyPlayerControl::~cDummyPlayerControl()
{
cStatus::MsgReplaying(this, NULL, NULL, false);
Close();
}
cDummyPlayer *cDummyPlayerControl::OpenPlayer(void)
{
m_Lock.Lock();
if(!m_Player)
m_Player = new cDummyPlayer;
m_Lock.Unlock();
return m_Player;
}
void cDummyPlayerControl::Close(void)
{
m_Lock.Lock();
if(m_Player)
delete m_Player;
m_Player = NULL;
m_Lock.Unlock();
}
eOSState cDummyPlayerControl::ProcessKey(eKeys Key)
{
if(!ISMODELESSKEY(Key) || Key == kBack || Key == kStop) {
Close();
return osEnd;
}
return osContinue;
}