--- ../vdr-1.4.5//device.c 2006-09-03 12:13:25.000000000 +0200 +++ device.c 2007-01-28 19:24:06.000000000 +0100 @@ -581,8 +581,10 @@ int n = CurrentChannel() + Direction; int first = n; cChannel *channel; - while ((channel = Channels.GetByNumber(n, Direction)) != NULL) { + while ((channel = Channels.GetByNumber(n, Direction)) != NULL) + { // try only channels which are currently available + if (cStatus::MsgChannelProtected(0, channel) == false) // PIN PATCH if (PrimaryDevice()->ProvidesChannel(channel, Setup.PrimaryLimit) || PrimaryDevice()->CanReplay() && GetDevice(channel, 0)) break; n = channel->Number() + Direction; @@ -604,6 +606,11 @@ 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) == true) // PIN PATCH + return scrNotAvailable; // PIN PATCH + if (LiveView) StopReplay(); --- ../vdr-1.4.5//i18n.c 2006-10-14 11:26:41.000000000 +0200 +++ i18n.c 2007-01-28 19:24:06.000000000 +0100 @@ -6126,6 +6126,27 @@ "Ingen titel", "Bez názvu", }, + { "Childlock", // PIN PATCH + "Kindersicherung", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "Adulte", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + }, { NULL } }; --- ../vdr-1.4.5//menu.c 2006-12-02 12:12:02.000000000 +0100 +++ menu.c 2007-02-03 12:16:23.000000000 +0100 @@ -664,6 +664,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(new cMenuEditStrItem( tr("File"), data.file, sizeof(data.file), tr(FileNameChars))); SetFirstDayItem(); } @@ -1913,7 +1923,9 @@ for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) { if (!base || (strstr(recording->Name(), base) == recording->Name() && recording->Name()[strlen(base)] == '~')) { cMenuRecordingItem *Item = new cMenuRecordingItem(recording, level); - if (*Item->Text() && (!LastItem || strcmp(Item->Text(), LastItemText) != 0)) { + if ((*Item->Text() && (!LastItem || strcmp(Item->Text(), LastItemText) != 0)) + && (!cStatus::MsgReplayProtected(GetRecording(Item), Item->Name(), base, + Item->IsDirectory(), true))) { // PIN PATCH Add(Item); LastItem = Item; free(LastItemText); @@ -1963,6 +1975,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 { @@ -2818,28 +2833,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); @@ -2927,6 +2946,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); @@ -2952,6 +2979,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()) @@ -2963,6 +2991,7 @@ } } } + } state = osEnd; } break; @@ -3126,6 +3155,7 @@ if (Direction) { while (Channel) { Channel = Direction > 0 ? Channels.Next(Channel) : Channels.Prev(Channel); + if (cStatus::MsgChannelProtected(0, Channel) == false) // PIN PATCH if (Channel && !Channel->GroupSep() && (cDevice::PrimaryDevice()->ProvidesChannel(Channel, Setup.PrimaryLimit) || cDevice::GetDevice(Channel, 0))) return Channel; } @@ -3663,6 +3693,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.4.5//osd.c 2006-02-26 15:31:31.000000000 +0100 +++ osd.c 2007-01-28 19:24:06.000000000 +0100 @@ -594,6 +594,7 @@ // --- cOsd ------------------------------------------------------------------ int cOsd::isOpen = 0; +bool cOsd::pinValid = false; // PIN PATCH cOsd::cOsd(int Left, int Top) { --- ../vdr-1.4.5//osd.h 2006-02-26 15:45:05.000000000 +0100 +++ osd.h 2007-01-28 19:24:06.000000000 +0100 @@ -324,6 +324,7 @@ ///< 7: vertical, falling, upper virtual void Flush(void); ///< Actually commits all data to the OSD hardware. + static bool pinValid; // PIN PATCH }; class cOsdProvider { --- ../vdr-1.4.5//status.c 2005-12-31 16:10:10.000000000 +0100 +++ status.c 2007-02-03 12:04:26.000000000 +0100 @@ -112,3 +112,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.4.5//status.h 2005-12-31 16:15:25.000000000 +0100 +++ status.h 2007-02-03 12:03:19.000000000 +0100 @@ -14,6 +14,7 @@ #include "device.h" #include "player.h" #include "tools.h" +#include "plugin.h" class cStatus : public cListObject { private: @@ -67,6 +68,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(); @@ -86,6 +105,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.4.5//timers.c 2006-09-15 16:15:53.000000000 +0200 +++ timers.c 2007-01-28 19:24:06.000000000 +0100 @@ -14,6 +14,7 @@ #include "i18n.h" #include "libsi/si.h" #include "remote.h" +#include "status.h" // PIN PATCH // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d' // format characters in order to allow any number of blanks after a numeric @@ -42,6 +43,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; @@ -75,12 +77,14 @@ stop -= 2400; priority = Setup.DefaultPriority; lifetime = Setup.DefaultLifetime; + fskProtection = 0; // PIN PATCH *file = 0; const char *Title = Event->Title(); if (!isempty(Title)) strn0cpy(file, Event->Title(), sizeof(file)); aux = NULL; event = NULL; // let SetEvent() be called to get a log message + cStatus::MsgTimerCreation(this, Event); // PIN PATCH } cTimer::cTimer(const cTimer &Timer) @@ -113,6 +117,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; @@ -288,6 +293,7 @@ result = false; } } + fskProtection = aux && strstr(aux, "yes"); // PIN PATCH free(channelbuffer); free(daybuffer); free(filebuffer); @@ -597,6 +603,33 @@ Matches(); // refresh start and end time } +void cTimer::SetFskProtection(int aFlag) // PIN PATCH +{ + char* p; + char* tmp = 0; + + fskProtection = aFlag; + + if (fskProtection && (!aux || !strstr(aux, "yes"))) + { + // add protection info to aux + + if (aux) { tmp = strdup(aux); free(aux); } + asprintf(&aux,"%syes", tmp ? tmp : ""); + } + else if (!fskProtection && aux && (p = strstr(aux, "yes"))) + { + // remove protection info to aux + + asprintf(&tmp, "%.*s%s", p-aux, aux, p+strlen("yes")); + free(aux); + aux = strdup(tmp); + } + + if (tmp) + free(tmp); +} + // -- cTimers ---------------------------------------------------------------- cTimers Timers; --- ../vdr-1.4.5//timers.h 2006-09-04 19:07:39.000000000 +0200 +++ timers.h 2007-01-28 19:24:06.000000000 +0100 @@ -37,6 +37,7 @@ int start; int stop; int priority; + int fskProtection; // PIN PATCH int lifetime; 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.4.5//vdr.c 2006-12-02 17:22:12.000000000 +0100 +++ vdr.c 2007-01-28 19:32:00.000000000 +0100 @@ -865,6 +865,7 @@ cOsdObject *Interact = Menu ? Menu : cControl::Control(); eKeys key = Interface->GetKey((!Interact || !Interact->NeedsFastResponse()) && time(NULL) - LastCamMenu > LASTCAMMENUTIMEOUT); if (NORMALKEY(key) != kNone) { + cStatus::MsgUserAction(key, Interact); // PIN PATCH EITScanner.Activity(); LastActivity = time(NULL); } @@ -930,10 +931,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); } @@ -1137,9 +1140,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; }