summarylogtreecommitdiffstats
path: root/zappilot-0.0.5-vdr-2.3.1-porting.diff
blob: fae635a7507f0eda72b646ccebe2122e73517aa6 (plain)
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
--- b/zappilotosd.c	2015-06-24 14:32:15.000000000 +0200
+++ a/zappilotosd.c	2015-10-22 18:39:36.000000000 +0200
@@ -69,7 +69,7 @@ cZappilotOsd::~cZappilotOsd(void)
 
 void cZappilotOsd::DisplayChannel(const cChannel *Channel)
 {
-   int BufSize = 255;
+   int BufSize = 1020;
    if (Channel)
    {
       if (Channel->GroupSep())
@@ -172,11 +172,11 @@ void cZappilotOsd::UpdateEPGInfo(int Now
    titleFollowingInfo = NULL;
    subtitlePresentInfo = NULL;
    subtitleFollowingInfo = NULL;
-   cSchedulesLock SchedulesLock;
-   const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
+   LOCK_SCHEDULES_READ;
+   LOCK_CHANNELS_READ;
    if (Schedules)
    {
-      const cSchedule *Schedule = Schedules->GetSchedule(Channels.GetByNumber(PilotChannelNumber)->GetChannelID());
+      const cSchedule *Schedule = Schedules->GetSchedule(Channels->GetByNumber(PilotChannelNumber)->GetChannelID());
       if (Schedule)
       {
          // Get Present event
@@ -267,9 +267,9 @@ void cZappilotOsd::UpdateEPGInfo(int Now
 void cZappilotOsd::Show()
 {
    // find the actual current
-   cChannel *Channel =  Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
-   currentChannel = Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
-
+   LOCK_CHANNELS_READ;
+   const cChannel *Channel =  Channels->GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
+   currentChannel = Channel;
    if (Channel)
    {
       PilotChannelNumber = Channel->Number();
@@ -333,13 +333,14 @@ eOSState cZappilotOsd::ProcessKey(eKeys
          case k1 ... k9:
             if (number >= 0)
             {
-               if (number > Channels.MaxNumber())
+               LOCK_CHANNELS_READ;
+               if (number > Channels->MaxNumber())
                   number = Key - k0;
                else
                   number = number * 10 + Key - k0;
                if (number > 0)
                {
-                  cChannel *channel = Channels.GetByNumber(number);
+                  const cChannel *channel = Channels->GetByNumber(number);
                   if (channel)
                   {
                      PilotChannelNumber = channel->Number();
@@ -363,7 +364,8 @@ eOSState cZappilotOsd::ProcessKey(eKeys
             if (config.fastbrowse)
             {
                CursorDown();
-               cChannel *channel = Channels.GetByNumber(PilotChannelNumber);
+               LOCK_CHANNELS_READ;
+               const cChannel *channel = Channels->GetByNumber(PilotChannelNumber);
                if (channel)
                   group = channel->Index()-1;
                break;
@@ -380,7 +382,8 @@ eOSState cZappilotOsd::ProcessKey(eKeys
             if (config.fastbrowse)
             {
                CursorUp();
-               cChannel *channel = Channels.GetByNumber(PilotChannelNumber);
+               LOCK_CHANNELS_READ;
+               const cChannel *channel = Channels->GetByNumber(PilotChannelNumber);
                if (channel)
                   group = channel->Index()-1;
                break;
@@ -396,7 +399,8 @@ eOSState cZappilotOsd::ProcessKey(eKeys
             {
                if (group < 0)
                {
-                  cChannel *channel = Channels.GetByNumber(PilotChannelNumber);
+                  LOCK_CHANNELS_READ;
+                  const cChannel *channel = Channels->GetByNumber(PilotChannelNumber);
                   if (channel)
                      group = channel->Index();
                }
@@ -405,15 +409,18 @@ eOSState cZappilotOsd::ProcessKey(eKeys
                   int SaveGroup = group;
                   if (NORMALKEY(Key) == kRight)
                   {
-                     group = Channels.GetNextGroup(group);
+                     LOCK_CHANNELS_READ;
+                     group = Channels->GetNextGroup(group);
                   }
                   else
                   {
-                     group = Channels.GetPrevGroup(group < 1 ? 1 : group);
+                   LOCK_CHANNELS_READ;
+                   group = Channels->GetPrevGroup(group < 1 ? 1 : group);
                   }
                   if (group < 0)
                      group = SaveGroup;
-                  cChannel *channel = Channels.Get(group);
+                  LOCK_CHANNELS_READ;
+                  const cChannel *channel = Channels->Get(group);
                   if (channel)
                   {
                      //DisplayChannel(channel);
@@ -449,7 +456,8 @@ eOSState cZappilotOsd::ProcessKey(eKeys
             else
             {
                CursorUp();
-               cChannel *channel = Channels.GetByNumber(PilotChannelNumber);
+               LOCK_CHANNELS_READ;
+               const cChannel *channel = Channels->GetByNumber(PilotChannelNumber);
                if (channel)
                   group = channel->Index()-1;
                break;
@@ -466,20 +474,22 @@ eOSState cZappilotOsd::ProcessKey(eKeys
             else
             {
                CursorDown();
-               cChannel *channel = Channels.GetByNumber(PilotChannelNumber);
+               LOCK_CHANNELS_READ;
+               const cChannel *channel = Channels->GetByNumber(PilotChannelNumber);
                if (channel)
-                  group = channel->Index()-1;
+                 group = channel->Index()-1;
                break;
             }
          case kNone:
             if (number && (int)cTimeMs::Now() - lastTime > 1000)
             {
-               if (Channels.GetByNumber(number))
+               LOCK_CHANNELS_READ;
+               if (Channels->GetByNumber(number))
                {
                   PilotChannelNumber = number;
                   lastTime = cTimeMs::Now();
                   number = 0;
-                  cChannel *channel = Channels.GetByNumber(PilotChannelNumber);
+                  const cChannel *channel = Channels->GetByNumber(PilotChannelNumber);
                   if (channel)
                      group = channel->Index()-1;
                }
@@ -553,7 +563,8 @@ eOSState cZappilotOsd::ProcessKey(eKeys
             {
                if (group < 0)
                {
-                  cChannel *channel = Channels.GetByNumber(PilotChannelNumber);
+                  LOCK_CHANNELS_READ;
+                  const cChannel *channel = Channels->GetByNumber(PilotChannelNumber);
                   if (channel)
                      group = channel->Index();
                }
@@ -562,15 +573,18 @@ eOSState cZappilotOsd::ProcessKey(eKeys
                   int SaveGroup = group;
                   if (NORMALKEY(Key) == kBlue)
                   {
-                     group = Channels.GetNextGroup(group);
+                     LOCK_CHANNELS_READ;
+                     group = Channels->GetNextGroup(group);
                   }
                   else
                   {
-                     group = Channels.GetPrevGroup(group < 1 ? 1 : group);
+                     LOCK_CHANNELS_READ;                  
+                     group = Channels->GetPrevGroup(group < 1 ? 1 : group);
                   }
                   if (group < 0)
                      group = SaveGroup;
-                  cChannel *channel = Channels.Get(group);
+                  LOCK_CHANNELS_READ;                                       
+                  const cChannel *channel = Channels->Get(group);
                   if (channel)
                   {
                      //DisplayChannel(channel);
@@ -663,8 +677,8 @@ eOSState cZappilotOsd::ProcessKey(eKeys
 void cZappilotOsd::CursorUp()
 {
    int n = PilotChannelNumber + 1;
-   cChannel *channel;
-   channel = Channels.GetByNumber(n, 1);
+   LOCK_CHANNELS_READ;
+   const cChannel *channel = Channels->GetByNumber(n, 1);
    if (channel)
    {
       n = channel->Number();
@@ -678,8 +692,8 @@ void cZappilotOsd::CursorUp()
 void cZappilotOsd::CursorDown()
 {
    int n = PilotChannelNumber - 1;
-   cChannel *channel;
-   channel = Channels.GetByNumber(n, -1);
+   LOCK_CHANNELS_READ;
+   const cChannel *channel = Channels->GetByNumber(n, -1);
    if (channel)
    {
       n = channel->Number();
@@ -693,9 +707,13 @@ void cZappilotOsd::CursorDown()
 void cZappilotOsd::CursorOK()
 {
    DrawMenu(0,2);
-   if (currentChannel != Channels.GetByNumber(PilotChannelNumber))
+   LOCK_CHANNELS_READ;
+   const cChannel* chan = Channels->GetByNumber(PilotChannelNumber);
+
+   if (currentChannel != chan)
    {
-     cChannel *Channel =  Channels.GetByNumber(PilotChannelNumber);
+     LOCK_CHANNELS_READ;
+     const cChannel *Channel =  Channels->GetByNumber(PilotChannelNumber);
      if (Channel)
      {
         cDevice::PrimaryDevice()->SwitchChannel(Channel, true);
@@ -750,7 +768,8 @@ void cZappilotOsd::DisplayInfo(int delta
       displayTimer = NULL;
       displayChannel = Skins.Current()->DisplayChannel(true);
    }
-   cChannel *channel = Channels.GetByNumber(PilotChannelNumber);
+   LOCK_CHANNELS_READ;
+   const cChannel *channel = Channels->GetByNumber(PilotChannelNumber);
 
    if (!isempty(titlePresentInfo))
    {
@@ -778,14 +797,17 @@ void cZappilotOsd::DisplayExtraInfo()
       displayEvent = NULL;
    }
 
-   displayEvent = new cMenuEvent(Present,false,true);
+
+   LOCK_TIMERS_READ;
+   LOCK_CHANNELS_READ;
+   displayEvent = new cMenuEvent(Timers, Channels, Present,false,true);
    displayEvent->Display();
 }
 
 
 void cZappilotOsd::DisplayTimer()
 {
-
+ 
    if (displayChannel)
    {
       delete displayChannel;
@@ -797,13 +819,17 @@ void cZappilotOsd::DisplayTimer()
       displayEvent = NULL;
    }
 
+   LOCK_TIMERS_WRITE;
+
    cTimer *timer = new cTimer(Present);
-   cTimer *t = Timers.GetTimer(timer);
+   cTimer *t = Timers->GetMatch(Present);
+
    if (t)
    {
       delete timer;
       timer = t;
    }
+
    displayTimer=new cMenuEditTimer(timer, !t);
    displayTimer->Display();
 }
diff -rupN b/zappilotosd.h a/zappilotosd.h
--- b/zappilotosd.h	2015-06-24 14:32:15.000000000 +0200
+++ a/zappilotosd.h	2015-10-22 18:40:02.000000000 +0200
@@ -39,7 +39,7 @@ class cZappilotOsd : public cOsdObject
       int offset;
       int lines;
       int type;
-      cChannel* currentChannel;
+      const cChannel* currentChannel;
 
    public:
       cZappilotOsd(void);