* updated kmbox (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / vdr / vdr-pin / pin-vdr-dev.diff
blob4e6dd3c77e6ffa52076f665d345144e16c7a48d4
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../vdr-pin/pin-vdr-dev.diff
5 # Copyright (C) 2007 - 2008 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 --- vdr-1.5.11/osd.c.orig 2007-10-12 14:38:36.000000000 +0200
18 +++ vdr-1.5.11/osd.c 2007-11-15 17:41:53.000000000 +0100
19 @@ -719,6 +719,7 @@
20 int cOsd::osdTop = 0;
21 int cOsd::osdWidth = 0;
22 int cOsd::osdHeight = 0;
23 +bool cOsd::pinValid = false; // PIN PATCH
24 cVector<cOsd *> cOsd::Osds;
26 cOsd::cOsd(int Left, int Top, uint Level)
27 --- vdr-1.5.11/vdr.c.orig 2007-11-03 15:46:29.000000000 +0100
28 +++ vdr-1.5.11/vdr.c 2007-11-15 17:45:53.000000000 +0100
29 @@ -886,6 +886,7 @@
30 cOsdObject *Interact = Menu ? Menu : cControl::Control();
31 eKeys key = Interface->GetKey(!Interact || !Interact->NeedsFastResponse());
32 if (ISREALKEY(key)) {
33 + cStatus::MsgUserAction(key, Interact); // PIN PATCH
34 EITScanner.Activity();
35 // Cancel shutdown countdown:
36 if (ShutdownHandler.countdown)
37 @@ -955,10 +956,12 @@
38 cControl::Control()->Hide();
39 cPlugin *plugin = cPluginManager::GetPlugin(PluginName);
40 if (plugin) {
41 + if (!cStatus::MsgPluginProtected(plugin)) { // PIN PATCH
42 Menu = plugin->MainMenuAction();
43 if (Menu)
44 Menu->Show();
46 + }
47 else
48 esyslog("ERROR: unknown plugin '%s'", PluginName);
50 --- vdr-1.5.11/menu.c.orig 2007-11-15 01:20:44.000000000 +0100
51 +++ vdr-1.5.11/menu.c 2007-11-15 17:38:34.000000000 +0100
52 @@ -672,6 +672,7 @@
53 Add(new cMenuEditBitItem( tr("VPS"), &data.flags, tfVps));
54 Add(new cMenuEditIntItem( tr("Priority"), &data.priority, 0, MAXPRIORITY));
55 Add(new cMenuEditIntItem( tr("Lifetime"), &data.lifetime, 0, MAXLIFETIME));
56 + Add(new cMenuEditBoolItem(tr("Child protection"), &data.fskProtection)); // PIN PATCH
57 Add(new cMenuEditStrItem( tr("File"), data.file, sizeof(data.file)));
58 SetFirstDayItem();
60 @@ -2150,6 +2151,9 @@
62 cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
63 if (ri) {
64 + if (cStatus::MsgReplayProtected(GetRecording(ri), ri->Name(), base,
65 + ri->IsDirectory()) == true) // PIN PATCH
66 + return osContinue; // PIN PATCH
67 if (ri->IsDirectory())
68 Open();
69 else {
70 @@ -3277,6 +3281,7 @@
71 if (item) {
72 cPlugin *p = cPluginManager::GetPlugin(item->PluginIndex());
73 if (p) {
74 + if (!cStatus::MsgPluginProtected(p)) { // PIN PATCH
75 cOsdObject *menu = p->MainMenuAction();
76 if (menu) {
77 if (menu->IsMenu())
78 @@ -3288,6 +3293,7 @@
82 + }
83 state = osEnd;
85 break;
86 @@ -4084,6 +4090,7 @@
87 for (int i = 0; i < MAXRECORDCONTROLS; i++) {
88 if (!RecordControls[i]) {
89 RecordControls[i] = new cRecordControl(device, Timer, Pause);
90 + cStatus::MsgRecordingFile(RecordControls[i]->FileName()); // PIN PATCH
91 return RecordControls[i]->Process(time(NULL));
94 --- vdr/timers.c.orig 2008-02-16 15:47:40.000000000 +0100
95 +++ vdr/timers.c 2008-03-07 20:41:54.000000000 +0100
96 @@ -46,6 +46,7 @@
97 stop -= 2400;
98 priority = Pause ? Setup.PausePriority : Setup.DefaultPriority;
99 lifetime = Pause ? Setup.PauseLifetime : Setup.DefaultLifetime;
100 + fskProtection = 0; // PIN PATCH
101 *file = 0;
102 aux = NULL;
103 event = NULL;
104 @@ -85,6 +86,7 @@
105 Utf8Strn0Cpy(file, Event->Title(), sizeof(file));
106 aux = NULL;
107 event = NULL; // let SetEvent() be called to get a log message
108 + cStatus::MsgTimerCreation(this, Event); // PIN PATCH
111 cTimer::cTimer(const cTimer &Timer)
112 @@ -118,6 +120,7 @@
113 stop = Timer.stop;
114 priority = Timer.priority;
115 lifetime = Timer.lifetime;
116 + fskProtection = Timer.fskProtection; // PIN PATCH
117 strncpy(file, Timer.file, sizeof(file));
118 free(aux);
119 aux = Timer.aux ? strdup(Timer.aux) : NULL;
120 @@ -312,6 +315,7 @@
121 result = false;
124 + fskProtection = aux && strstr(aux, "<pin-plugin><protected>yes</protected></pin-plugin>"); // PIN PATCH
125 free(channelbuffer);
126 free(daybuffer);
127 free(filebuffer);
128 @@ -621,6 +625,33 @@
129 Matches(); // refresh start and end time
132 +void cTimer::SetFskProtection(int aFlag) // PIN PATCH
134 + char* p;
135 + char* tmp = 0;
137 + fskProtection = aFlag;
139 + if (fskProtection && (!aux || !strstr(aux, "<pin-plugin><protected>yes</protected></pin-plugin>")))
141 + // add protection info to aux
143 + if (aux) { tmp = strdup(aux); free(aux); }
144 + asprintf(&aux,"%s<pin-plugin><protected>yes</protected></pin-plugin>", tmp ? tmp : "");
146 + else if (!fskProtection && aux && (p = strstr(aux, "<pin-plugin><protected>yes</protected></pin-plugin>")))
148 + // remove protection info to aux
150 + asprintf(&tmp, "%.*s%s", p-aux, aux, p+strlen("<pin-plugin><protected>yes</protected></pin-plugin>"));
151 + free(aux);
152 + aux = strdup(tmp);
155 + if (tmp)
156 + free(tmp);
159 // --- cTimers ---------------------------------------------------------------
161 cTimers Timers;
162 --- vdr-1.5.11/device.c.orig 2007-11-03 14:30:09.000000000 +0100
163 +++ vdr-1.5.11/device.c 2007-11-15 17:35:40.000000000 +0100
164 @@ -395,6 +395,7 @@
165 if (NumUsableSlots && !CamSlots.Get(j)->Assign(device[i], true))
166 continue; // CAM slot can't be used with this device
167 bool ndr;
168 + if (cStatus::MsgChannelProtected(0, Channel) == false) // PIN PATCH
169 if (device[i]->ProvidesChannel(Channel, Priority, &ndr)) { // this device is basicly able to do the job
170 if (NumUsableSlots && device[i]->CamSlot() && device[i]->CamSlot() != CamSlots.Get(j))
171 ndr = true; // using a different CAM slot requires detaching receivers
172 @@ -758,6 +759,11 @@
174 eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
176 + // I hope 'LiveView = false' indicates a channel switch for recording, // PIN PATCH
177 + // I really don't know, but it works ... // PIN PATCH
178 + if (LiveView && cStatus::MsgChannelProtected(this, Channel) == true) // PIN PATCH
179 + return scrNotAvailable; // PIN PATCH
181 if (LiveView) {
182 StopReplay();
183 DELETENULL(liveSubtitle);
184 --- vdr-1.5.11/osd.h.orig 2007-10-12 16:28:44.000000000 +0200
185 +++ vdr-1.5.11/osd.h 2007-11-15 01:20:44.000000000 +0100
186 @@ -400,6 +400,7 @@
187 ///< 7: vertical, falling, upper
188 virtual void Flush(void);
189 ///< Actually commits all data to the OSD hardware.
190 + static bool pinValid; // PIN PATCH
193 class cOsdProvider {
194 --- vdr-1.5.11/status.c.orig 2005-12-31 16:10:10.000000000 +0100
195 +++ vdr-1.5.11/status.c 2007-11-15 01:20:44.000000000 +0100
196 @@ -112,3 +112,49 @@
197 for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
198 sm->OsdProgramme(PresentTime, PresentTitle, PresentSubtitle, FollowingTime, FollowingTitle, FollowingSubtitle);
201 +bool cStatus::MsgChannelProtected(const cDevice* Device, const cChannel* Channel) // PIN PATCH
203 + for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
204 + if (sm->ChannelProtected(Device, Channel) == true)
205 + return true;
207 + return false;
210 +bool cStatus::MsgReplayProtected(const cRecording* Recording, const char* Name,
211 + const char* Base, bool isDirectory) // PIN PATCH
213 + for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
214 + if (sm->ReplayProtected(Recording, Name, Base, isDirectory) == true)
215 + return true;
217 + return false;
220 +void cStatus::MsgRecordingFile(const char* FileName)
222 + for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) // PIN PATCH
223 + sm->RecordingFile(FileName);
226 +void cStatus::MsgTimerCreation(cTimer* Timer, const cEvent *Event)
228 + for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) // PIN PATCH
229 + sm->TimerCreation(Timer, Event);
232 +bool cStatus::MsgPluginProtected(cPlugin* Plugin) // PIN PATCH
234 + for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
235 + if (sm->PluginProtected(Plugin) == true)
236 + return true;
238 + return false;
241 +void cStatus::MsgUserAction(const eKeys key, const cOsdObject* Interact) // PIN PATCH
243 + for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
244 + sm->UserAction(key, Interact);
246 --- vdr-1.5.11/status.h.orig 2007-08-12 12:34:40.000000000 +0200
247 +++ vdr-1.5.11/status.h 2007-11-15 01:20:44.000000000 +0100
248 @@ -14,6 +14,7 @@
249 #include "device.h"
250 #include "player.h"
251 #include "tools.h"
252 +#include "plugin.h"
254 class cStatus : public cListObject {
255 private:
256 @@ -67,6 +68,22 @@
257 // The OSD displays the single line Text with the current channel information.
258 virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle) {}
259 // The OSD displays the given programme information.
260 + virtual bool ChannelProtected(const cDevice *Device, const cChannel* Channel) { return false; } // PIN PATCH
261 + // Checks if a channel is protected.
262 + virtual bool ReplayProtected(const cRecording* Recording, const char* Name,
263 + const char* Base, bool isDirectory) { return false; } // PIN PATCH
264 + // Checks if a recording is protected.
265 + virtual void RecordingFile(const char* FileName) {} // PIN PATCH
266 + // The given DVB device has started recording to FileName. FileName is the name of the
267 + // recording directory
268 + virtual void TimerCreation(cTimer* Timer, const cEvent *Event) {} // PIN PATCH
269 + // The given timer is created
270 + virtual bool PluginProtected(cPlugin* Plugin) { return false; } // PIN PATCH
271 + // Checks if a plugin is protected.
272 + virtual void UserAction(const eKeys key, const cOsdObject* Interact) {} // PIN PATCH
273 + // report user action
276 public:
277 cStatus(void);
278 virtual ~cStatus();
279 @@ -86,6 +103,13 @@
280 static void MsgOsdTextItem(const char *Text, bool Scroll = false);
281 static void MsgOsdChannel(const char *Text);
282 static void MsgOsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
283 + static bool MsgChannelProtected(const cDevice* Device, const cChannel* Channel); // PIN PATCH
284 + static bool MsgReplayProtected(const cRecording* Recording, const char* Name,
285 + const char* Base, bool isDirectory); // PIN PATCH
286 + static void MsgRecordingFile(const char* FileName); // PIN PATCH
287 + static void MsgTimerCreation(cTimer* Timer, const cEvent *Event); // PIN PATCH
288 + static bool MsgPluginProtected(cPlugin* Plugin); // PIN PATCH
289 + static void MsgUserAction(const eKeys key, const cOsdObject* Interact); // PIN PATCH
292 #endif //__STATUS_H
293 --- vdr-1.5.11/timers.h.orig 2007-06-03 15:24:58.000000000 +0200
294 +++ vdr-1.5.11/timers.h 2007-11-15 01:20:44.000000000 +0100
295 @@ -37,6 +37,7 @@
296 int start;
297 int stop;
298 int priority;
299 + int fskProtection; // PIN PATCH
300 int lifetime;
301 char file[MaxFileName];
302 char *aux;
303 @@ -58,6 +59,7 @@
304 int Start(void) const { return start; }
305 int Stop(void) const { return stop; }
306 int Priority(void) const { return priority; }
307 + int FskProtection(void) const { return fskProtection; } // PIN PATCH
308 int Lifetime(void) const { return lifetime; }
309 const char *File(void) const { return file; }
310 time_t FirstDay(void) const { return weekdays ? day : 0; }
311 @@ -86,6 +88,7 @@
312 void SetInVpsMargin(bool InVpsMargin);
313 void SetPriority(int Priority);
314 void SetFlags(uint Flags);
315 + void SetFskProtection(int aFlag); // PIN PATCH
316 void ClrFlags(uint Flags);
317 void InvFlags(uint Flags);
318 bool HasFlags(uint Flags) const;