summaryrefslogtreecommitdiff
path: root/patches/vdr-1.7.17.diff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/vdr-1.7.17.diff')
-rw-r--r--patches/vdr-1.7.17.diff416
1 files changed, 416 insertions, 0 deletions
diff --git a/patches/vdr-1.7.17.diff b/patches/vdr-1.7.17.diff
new file mode 100644
index 0000000..5909652
--- /dev/null
+++ b/patches/vdr-1.7.17.diff
@@ -0,0 +1,416 @@
+--- ../vdr-1.7.17.plain//device.c 2011-02-25 16:12:03.000000000 +0100
++++ device.c 2011-03-31 11:47:58.122037275 +0200
+@@ -665,6 +665,7 @@
+ cChannel *channel;
+ while ((channel = Channels.GetByNumber(n, Direction)) != NULL) {
+ // try only channels which are currently available
++ if (!cStatus::MsgChannelProtected(0, channel)) // PIN PATCH
+ if (GetDevice(channel, 0, true))
+ break;
+ n = channel->Number() + Direction;
+@@ -686,6 +687,12 @@
+
+ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
+ {
++ // I hope 'LiveView = false' indicates a channel switch for recording, // PIN PATCH
++ // I really don't know, but it works ... // PIN PATCH
++
++ if (LiveView && cStatus::MsgChannelProtected(this, Channel)) // PIN PATCH
++ return scrNotAvailable; // PIN PATCH
++
+ if (LiveView) {
+ StopReplay();
+ DELETENULL(liveSubtitle);
+--- ../vdr-1.7.17.plain//menu.c 2011-02-27 13:37:48.000000000 +0100
++++ menu.c 2011-03-31 12:17:34.903691287 +0200
+@@ -918,6 +918,16 @@
+ Add(new cMenuEditBitItem( tr("VPS"), &data.flags, tfVps));
+ Add(new cMenuEditIntItem( tr("Priority"), &data.priority, 0, MAXPRIORITY));
+ Add(new cMenuEditIntItem( tr("Lifetime"), &data.lifetime, 0, MAXLIFETIME));
++
++ // PIN PATCH
++ if (cOsd::pinValid || !data.fskProtection) Add(new cMenuEditBoolItem(tr("Childlock"),&data.fskProtection));
++ else {
++ char* buf = 0;
++ asprintf(&buf, "%s\t%s", tr("Childlock"), data.fskProtection ? tr("yes") : tr("no"));
++ Add(new cOsdItem(buf));
++ free(buf);
++ }
++
+ Add(file = new cMenuEditStrItem( tr("File"), data.file, sizeof(data.file)));
+ SetFirstDayItem();
+ }
+@@ -2276,7 +2286,10 @@
+ for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) {
+ if (!base || (strstr(recording->Name(), base) == recording->Name() && recording->Name()[strlen(base)] == FOLDERDELIMCHAR)) {
+ cMenuRecordingItem *Item = new cMenuRecordingItem(recording, level);
+- if (*Item->Text() && (!Item->IsDirectory() || (!LastItem || !LastItem->IsDirectory() || strcmp(Item->Text(), LastItemText) != 0))) {
++
++ if (*Item->Text() && (!Item->IsDirectory() || (!LastItem || !LastItem->IsDirectory() || strcmp(Item->Text(), LastItemText) != 0))
++ && (!cStatus::MsgReplayProtected(GetRecording(Item), Item->Name(), base,
++ Item->IsDirectory(), true))) { // PIN PATCH
+ Add(Item);
+ LastItem = Item;
+ free(LastItemText);
+@@ -2326,6 +2339,9 @@
+ {
+ cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
+ if (ri) {
++ if (cStatus::MsgReplayProtected(GetRecording(ri), ri->Name(), base,
++ ri->IsDirectory()) == true) // PIN PATCH
++ return osContinue; // PIN PATCH
+ if (ri->IsDirectory())
+ Open();
+ else {
+@@ -3305,28 +3321,32 @@
+
+ // Basic menu items:
+
+- Add(new cOsdItem(hk(tr("Schedule")), osSchedule));
+- Add(new cOsdItem(hk(tr("Channels")), osChannels));
+- Add(new cOsdItem(hk(tr("Timers")), osTimers));
+- Add(new cOsdItem(hk(tr("Recordings")), osRecordings));
++ // PIN PATCH
++ if (!cStatus::MsgMenuItemProtected("Schedule", true)) Add(new cOsdItem(hk(tr("Schedule")), osSchedule));
++ if (!cStatus::MsgMenuItemProtected("Channels", true)) Add(new cOsdItem(hk(tr("Channels")), osChannels));
++ if (!cStatus::MsgMenuItemProtected("Timers", true)) Add(new cOsdItem(hk(tr("Timers")), osTimers));
++ if (!cStatus::MsgMenuItemProtected("Recordings", true)) Add(new cOsdItem(hk(tr("Recordings")), osRecordings));
+
+ // Plugins:
+
+ for (int i = 0; ; i++) {
+ cPlugin *p = cPluginManager::GetPlugin(i);
+ if (p) {
++ if (!cStatus::MsgPluginProtected(p, true)) { // PIN PATCH
+ const char *item = p->MainMenuEntry();
+ if (item)
+ Add(new cMenuPluginItem(hk(item), i));
+ }
++ }
+ else
+ break;
+ }
+
+ // More basic menu items:
+
+- Add(new cOsdItem(hk(tr("Setup")), osSetup));
++ if (!cStatus::MsgMenuItemProtected("Setup", true)) Add(new cOsdItem(hk(tr("Setup")), osSetup)); // PIN PATCH
+ if (Commands.Count())
++ if (!cStatus::MsgMenuItemProtected("Commands", true)) // PIN PATCH
+ Add(new cOsdItem(hk(tr("Commands")), osCommands));
+
+ Update(true);
+@@ -3402,6 +3422,14 @@
+ eOSState state = cOsdMenu::ProcessKey(Key);
+ HadSubMenu |= HasSubMenu();
+
++ // > PIN PATCH
++ cOsdItem* item = Get(Current());
++
++ if (item && item->Text() && state != osContinue && state != osUnknown && state != osBack)
++ if (cStatus::MsgMenuItemProtected(item->Text()))
++ return osContinue;
++ // PIN PATCH <
++
+ switch (state) {
+ case osSchedule: return AddSubMenu(new cMenuSchedule);
+ case osChannels: return AddSubMenu(new cMenuChannels);
+@@ -3427,6 +3455,7 @@
+ if (item) {
+ cPlugin *p = cPluginManager::GetPlugin(item->PluginIndex());
+ if (p) {
++ if (!cStatus::MsgPluginProtected(p)) { // PIN PATCH
+ cOsdObject *menu = p->MainMenuAction();
+ if (menu) {
+ if (menu->IsMenu())
+@@ -3438,6 +3467,7 @@
+ }
+ }
+ }
++ }
+ state = osEnd;
+ }
+ break;
+@@ -3608,6 +3638,8 @@
+ Channel = Direction > 0 ? Channels.Next(Channel) : Channels.Prev(Channel);
+ if (!Channel && Setup.ChannelsWrap)
+ Channel = Direction > 0 ? Channels.First() : Channels.Last();
++
++ if (!cStatus::MsgChannelProtected(0, Channel)) // PIN PATCH
+ if (Channel && !Channel->GroupSep() && cDevice::GetDevice(Channel, 0, true))
+ return Channel;
+ }
+@@ -4241,6 +4273,7 @@
+ for (int i = 0; i < MAXRECORDCONTROLS; i++) {
+ if (!RecordControls[i]) {
+ RecordControls[i] = new cRecordControl(device, Timer, Pause);
++ cStatus::MsgRecordingFile(RecordControls[i]->FileName()); // PIN PATCH
+ return RecordControls[i]->Process(time(NULL));
+ }
+ }
+--- ../vdr-1.7.17.plain//osd.c 2011-03-12 16:32:33.000000000 +0100
++++ osd.c 2011-03-31 11:57:37.102037290 +0200
+@@ -1576,6 +1576,7 @@
+ int cOsd::osdWidth = 0;
+ int cOsd::osdHeight = 0;
+ cVector<cOsd *> cOsd::Osds;
++bool cOsd::pinValid = false; // PIN PATCH
+
+ cOsd::cOsd(int Left, int Top, uint Level)
+ {
+--- ../vdr-1.7.17.plain//osd.h 2011-03-12 17:06:48.000000000 +0100
++++ osd.h 2011-03-31 11:58:26.802037290 +0200
+@@ -917,6 +917,7 @@
+ ///< MyOsdDrawPixmap(Left() + pm->ViewPort().X(), Top() + pm->ViewPort().Y(), pm->Data(), w, h, h * d);
+ ///< delete pm;
+ ///< }
++ static bool pinValid; // PIN PATCH
+ };
+
+ #define MAXOSDIMAGES 64
+--- ../vdr-1.7.17.plain//status.c 2008-02-16 15:46:31.000000000 +0100
++++ status.c 2011-03-31 11:40:45.532037296 +0200
+@@ -124,3 +124,55 @@
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ sm->OsdProgramme(PresentTime, PresentTitle, PresentSubtitle, FollowingTime, FollowingTitle, FollowingSubtitle);
+ }
++
++bool cStatus::MsgChannelProtected(const cDevice* Device, const cChannel* Channel) // PIN PATCH
++{
++ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
++ if (sm->ChannelProtected(Device, Channel) == true)
++ return true;
++
++ return false;
++}
++
++bool cStatus::MsgReplayProtected(const cRecording* Recording, const char* Name,
++ const char* Base, bool isDirectory, int menuView) // PIN PATCH
++{
++ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
++ if (sm->ReplayProtected(Recording, Name, Base, isDirectory, menuView) == true)
++ return true;
++ return false;
++}
++
++void cStatus::MsgRecordingFile(const char* FileName)
++{
++ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) // PIN PATCH
++ sm->RecordingFile(FileName);
++}
++
++void cStatus::MsgTimerCreation(cTimer* Timer, const cEvent *Event)
++{
++ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) // PIN PATCH
++ sm->TimerCreation(Timer, Event);
++}
++
++bool cStatus::MsgPluginProtected(cPlugin* Plugin, int menuView) // PIN PATCH
++{
++ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
++ if (sm->PluginProtected(Plugin, menuView) == true)
++ return true;
++ return false;
++}
++
++void cStatus::MsgUserAction(const eKeys key, const cOsdObject* Interact) // PIN PATCH
++{
++ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
++ sm->UserAction(key, Interact);
++}
++
++bool cStatus::MsgMenuItemProtected(const char* Name, int menuView) // PIN PATCH
++{
++ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
++ if (sm->MenuItemProtected(Name, menuView) == true)
++ return true;
++ return false;
++}
+--- ../vdr-1.7.17.plain//status.h 2008-02-16 16:00:33.000000000 +0100
++++ status.h 2011-03-31 11:40:45.532037296 +0200
+@@ -14,6 +14,7 @@
+ #include "device.h"
+ #include "player.h"
+ #include "tools.h"
++#include "plugin.h"
+
+ enum eTimerChange { tcMod, tcAdd, tcDel };
+
+@@ -80,6 +81,24 @@
+ // The OSD displays the single line Text with the current channel information.
+ virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle) {}
+ // The OSD displays the given programme information.
++ virtual bool ChannelProtected(const cDevice *Device, const cChannel* Channel) { return false; } // PIN PATCH
++ // Checks if a channel is protected.
++ virtual bool ReplayProtected(const cRecording* Recording, const char* Name,
++ const char* Base, bool isDirectory, int menuView = false) { return false; } // PIN PATCH
++ // Checks if a recording is protected.
++ virtual void RecordingFile(const char* FileName) {} // PIN PATCH
++ // The given DVB device has started recording to FileName. FileName is the name of the
++ // recording directory
++ virtual void TimerCreation(cTimer* Timer, const cEvent *Event) {} // PIN PATCH
++ // The given timer is created
++ virtual bool PluginProtected(cPlugin* Plugin, int menuView = false) { return false; } // PIN PATCH
++ // Checks if a plugin is protected.
++ virtual void UserAction(const eKeys key, const cOsdObject* Interact) {} // PIN PATCH
++ // report user action
++ virtual bool MenuItemProtected(const char* Name, int menuView = false) { return false; } // PIN PATCH
++ // Checks if a menu entry is protected.
++
++
+ public:
+ cStatus(void);
+ virtual ~cStatus();
+@@ -101,6 +120,15 @@
+ static void MsgOsdTextItem(const char *Text, bool Scroll = false);
+ static void MsgOsdChannel(const char *Text);
+ static void MsgOsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
++ static bool MsgChannelProtected(const cDevice* Device, const cChannel* Channel); // PIN PATCH
++ static bool MsgReplayProtected(const cRecording* Recording, const char* Name,
++ const char* Base, bool isDirectory, int menuView = false); // PIN PATCH
++ static void MsgRecordingFile(const char* FileName); // PIN PATCH
++ static void MsgTimerCreation(cTimer* Timer, const cEvent *Event); // PIN PATCH
++ static bool MsgPluginProtected(cPlugin* Plugin, int menuView = false); // PIN PATCH
++ static void MsgUserAction(const eKeys key, const cOsdObject* Interact);
++ static bool MsgMenuItemProtected(const char* Name, int menuView = false); // PIN PATCH
++
+ };
+
+ #endif //__STATUS_H
+--- ../vdr-1.7.17.plain//timers.c 2010-01-16 12:18:53.000000000 +0100
++++ timers.c 2011-03-31 12:07:34.363691286 +0200
+@@ -46,6 +46,7 @@
+ stop -= 2400;
+ priority = Pause ? Setup.PausePriority : Setup.DefaultPriority;
+ lifetime = Pause ? Setup.PauseLifetime : Setup.DefaultLifetime;
++ fskProtection = 0; // PIN PATCH
+ *file = 0;
+ aux = NULL;
+ event = NULL;
+@@ -84,6 +85,7 @@
+ stop -= 2400;
+ priority = Setup.DefaultPriority;
+ lifetime = Setup.DefaultLifetime;
++ fskProtection = 0; // PIN PATCH
+ *file = 0;
+ const char *Title = Event->Title();
+ if (!isempty(Title))
+@@ -95,6 +97,7 @@
+ }
+ aux = NULL;
+ event = NULL; // let SetEvent() be called to get a log message
++ cStatus::MsgTimerCreation(this, Event);
+ }
+
+ cTimer::cTimer(const cTimer &Timer)
+@@ -129,6 +132,7 @@
+ stop = Timer.stop;
+ priority = Timer.priority;
+ lifetime = Timer.lifetime;
++ fskProtection = Timer.fskProtection; // PIN PATCH
+ strncpy(file, Timer.file, sizeof(file));
+ free(aux);
+ aux = Timer.aux ? strdup(Timer.aux) : NULL;
+@@ -323,6 +327,7 @@
+ result = false;
+ }
+ }
++ fskProtection = aux && strstr(aux, "<pin-plugin><protected>yes</protected></pin-plugin>"); // PIN PATCH
+ free(channelbuffer);
+ free(daybuffer);
+ free(filebuffer);
+@@ -632,6 +637,33 @@
+ Matches(); // refresh start and end time
+ }
+
++void cTimer::SetFskProtection(int aFlag)
++{
++ char* p;
++ char* tmp = 0;
++
++ fskProtection = aFlag;
++
++ if (fskProtection && (!aux || !strstr(aux, "<pin-plugin><protected>yes</protected></pin-plugin>")))
++ {
++ // add protection info to aux
++
++ if (aux) { tmp = strdup(aux); free(aux); }
++ asprintf(&aux,"%s<pin-plugin><protected>yes</protected></pin-plugin>", tmp ? tmp : "");
++ }
++ else if (!fskProtection && aux && (p = strstr(aux, "<pin-plugin><protected>yes</protected></pin-plugin>")))
++ {
++ // remove protection info to aux
++
++ asprintf(&tmp, "%.*s%s", p-aux, aux, p+strlen("<pin-plugin><protected>yes</protected></pin-plugin>"));
++ free(aux);
++ aux = strdup(tmp);
++ }
++
++ if (tmp)
++ free(tmp);
++}
++
+ // --- cTimers ---------------------------------------------------------------
+
+ cTimers Timers;
+--- ../vdr-1.7.17.plain//timers.h 2008-02-16 15:33:23.000000000 +0100
++++ timers.h 2011-03-31 11:40:45.532037296 +0200
+@@ -37,6 +37,7 @@
+ int start;
+ int stop;
+ int priority;
++ int fskProtection; // PIN PATCH
+ int lifetime;
+ mutable char file[MaxFileName];
+ char *aux;
+@@ -58,6 +59,7 @@
+ int Start(void) const { return start; }
+ int Stop(void) const { return stop; }
+ int Priority(void) const { return priority; }
++ int FskProtection(void) const { return fskProtection; } // PIN PATCH
+ int Lifetime(void) const { return lifetime; }
+ const char *File(void) const { return file; }
+ time_t FirstDay(void) const { return weekdays ? day : 0; }
+@@ -86,6 +88,7 @@
+ void SetInVpsMargin(bool InVpsMargin);
+ void SetPriority(int Priority);
+ void SetFlags(uint Flags);
++ void SetFskProtection(int aFlag); // PIN PATCH
+ void ClrFlags(uint Flags);
+ void InvFlags(uint Flags);
+ bool HasFlags(uint Flags) const;
+--- ../vdr-1.7.17.plain//vdr.c 2010-12-12 14:42:00.000000000 +0100
++++ vdr.c 2011-03-31 12:09:31.913691288 +0200
+@@ -929,6 +929,7 @@
+ cOsdObject *Interact = Menu ? Menu : cControl::Control();
+ eKeys key = Interface->GetKey(!Interact || !Interact->NeedsFastResponse());
+ if (ISREALKEY(key)) {
++ cStatus::MsgUserAction(key, Interact); // PIN PATCH
+ EITScanner.Activity();
+ // Cancel shutdown countdown:
+ if (ShutdownHandler.countdown)
+@@ -1001,10 +1002,12 @@
+ cControl::Control()->Hide();
+ cPlugin *plugin = cPluginManager::GetPlugin(PluginName);
+ if (plugin) {
++ if (!cStatus::MsgPluginProtected(plugin)) {
+ Menu = plugin->MainMenuAction();
+ if (Menu)
+ Menu->Show();
+ }
++ }
+ else
+ esyslog("ERROR: unknown plugin '%s'", PluginName);
+ }
+@@ -1218,9 +1221,11 @@
+ // Instant resume of the last viewed recording:
+ case kPlay:
+ if (cReplayControl::LastReplayed()) {
++ if (cStatus::MsgReplayProtected(0, cReplayControl::LastReplayed(), 0, false) == false) { // PIN PATCH
+ cControl::Shutdown();
+ cControl::Launch(new cReplayControl);
+ }
++ }
+ break;
+ default: break;
+ }