diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2004-01-04 18:00:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2004-01-04 18:00:00 +0100 |
commit | 93a94b18b540fbcb9bcdaaea9abd26cdf23d6ee6 (patch) | |
tree | bede17e6cd329d36ec02bc53dfe567b95ec835a5 /menu.c | |
parent | c432905dd60630f906ac89f58592ad835a9063ef (diff) | |
download | vdr-patch-lnbsharing-93a94b18b540fbcb9bcdaaea9abd26cdf23d6ee6.tar.gz vdr-patch-lnbsharing-93a94b18b540fbcb9bcdaaea9abd26cdf23d6ee6.tar.bz2 |
Version 1.3.0vdr-1.3.0
- Changed thread handling to make it work with NPTL ("Native Posix Thread Library").
Thanks to Jon Burgess, Andreas Schultz, Werner Fink and Stefan Huelswitt.
- The cThread class now accepts a 'Description' parameter, which is used to log
the beginning and end of the thread, together with its process and thread id.
For descriptions that need additional parameters you can use the function
cThread::SetDescription(), which accepts 'printf()' like arguments.
Existing plugins that use threads should be changed to use this functionality
instead of explicit 'dsyslog()' calls inside their Action() function in order
to support logging the thread ids.
- Added "Slovak Link" and "Czech Link" to 'ca.conf' (thanks to Emil Petersky).
However, 'ca.conf' is now pretty much obsolete due to the automatic CA handling.
- Mutexes are now created with PTHREAD_MUTEX_ERRORCHECK_NP, which makes the
'lockingTid' stuff obsolete (thanks to Stefan Huelswitt).
- Changed font handling to allow language specific character sets.
- Adopted the small font character set from the "Elchi" patch (originally
provided by Alessio Sangalli).
- Greek language texts now use iso8859-7 character set (thanks to Dimitrios
Dimitrakos).
- Rearranged section data handling, so that the actual data handling can be done
separately, even from within plugins.
- The EPG data structures have been moved from eit.[hc] to epg.[hc] and have been
adapted to the general VDR coding style. Plugins that use these data structures
may need to change some function names (which should be obvious).
The name 'subtitle' has been changed to 'shortText' to avoid clashes with actual
subtitles that are part of a movie. The name 'extendedDescription' has been
shortened to 'description'.
- Replaced 'libdtv' with 'libsi' (thanks to Marcel Wiesweg), which is thread
safe and can be used by multiple section filters simultaneously.
- Added 'cRwLock' to 'thread.[hc]'. Note that all plugin Makefiles need to
define _GNU_SOURCE for this to work (see the example plugin Makefiles and
'newplugin').
- Fixed a problem with crc32 in SI handling on 64bit systems (thanks to Pedro
Miguel Sequeira de Justo Teixeira for reporting this one).
- Fixed an alignment problem in CAM access on 64bit systems (thanks to Pedro
Miguel Sequeira de Justo Teixeira for reporting this one).
- Added 'StreamType' setting to CAM communication, which is important for
Aston/SECA CAMs (thanks to Antonino Sergi).
- Now the CA descriptors are sent to the CAM in the 'program' or 'ES level'
sections, depending on where they are found in the PMT (thanks to Hans-Peter
Raschke for reporting this one). This should make SkyCrypt CAMs work.
- Now using the 'version number' of EPG events to avoid unnecessary work.
- Channel data is now automatically derived from the DVB data stream (inspired
by the 'autopid' patch from Andreas Schultz).
- The current channel is now automatically re-tuned if the PIDs or other settings
change. If a recording is going on on a channel that has a change in its
settings, the recording will be stopped and immediately restarted to use the
new channel settings.
- EPG events now use the complete channel ID with NID, TID and SID.
- Channel names in 'channels.conf' can now have a short form, as provided
by some tv stations (see man vdr(5)). Currently channels that provide short
names in addition to long ones are listed in the OSD as "short,long name",
as in "RTL,RTL Television". The short names will be used explicitly later.
- The Ca parameter in 'channels.conf' has been extended and now contains all the
CA system ids for the given channel. When switching to a channel VDR now tests
for a device that provides one of these CA system ids. The devices automatically
get their supported ids from the CI handler.
- The values in 'ca.conf' are currently without any real meaning. Whether or not
a channel with conditional access can be received is now determined automatically
by evaluating its CA descriptors and comparing them to the CA system ids
provided by the installed CAM. Only the special values 1-16 are used to assign
a channel to a particular device.
- Increased the maximum number of possible OSD colors to 256.
- Limited the line length in the EPG bugfix report, which appears to fix a buffer
overflow that caused a crash when cleaning up the EPG data (at 05:00 in the
morning).
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 245 |
1 files changed, 135 insertions, 110 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.273 2003/10/03 14:36:20 kls Exp $ + * $Id: menu.c 1.276 2004/01/04 11:12:43 kls Exp $ */ #include "menu.h" @@ -16,7 +16,6 @@ #include "channels.h" #include "config.h" #include "cutter.h" -#include "eit.h" #include "i18n.h" #include "menuitems.h" #include "plugin.h" @@ -69,7 +68,7 @@ eOSState cMenuEditChanItem::ProcessKey(eKeys Key) case kLeft|k_Repeat: case kLeft: delta = -1; case kRight|k_Repeat: - case kRight: + case kRight: { cChannel *channel = Channels.GetByNumber(*value + delta, delta); if (channel) { @@ -458,7 +457,7 @@ eOSState cMenuEditSrcItem::ProcessKey(eKeys Key) } } else if (NORMALKEY(Key) == kRight) { - if (source) { + if (source) { if (source->Next()) source = (cSource *)source->Next(); } @@ -582,7 +581,7 @@ void cMenuEditChannel::Setup(void) Add(new cMenuEditIntItem( tr("Dpid1"), &data.dpid1, 0, 0x1FFF)); Add(new cMenuEditIntItem( tr("Dpid2"), &data.dpid2, 0, 0x1FFF)); Add(new cMenuEditIntItem( tr("Tpid"), &data.tpid, 0, 0x1FFF)); - Add(new cMenuEditCaItem( tr("CA"), &data.ca, true)); + Add(new cMenuEditCaItem( tr("CA"), &data.caids[0], true));//XXX Add(new cMenuEditIntItem( tr("Sid"), &data.sid, 0)); /* XXX not yet used Add(new cMenuEditIntItem( tr("Nid"), &data.nid, 0)); @@ -616,7 +615,6 @@ eOSState cMenuEditChannel::ProcessKey(eKeys Key) if (channel) { *channel = data; isyslog("edited channel %d %s", channel->Number(), data.ToText()); - Timers.Save(); state = osBack; } else { @@ -627,7 +625,7 @@ eOSState cMenuEditChannel::ProcessKey(eKeys Key) isyslog("added channel %d %s", channel->Number(), data.ToText()); state = osUser1; } - Channels.Save(); + Channels.SetModified(); } else { Interface->Error(tr("Channel settings are not unique!")); @@ -683,6 +681,7 @@ protected: virtual void Move(int From, int To); public: cMenuChannels(void); + ~cMenuChannels(); virtual eOSState ProcessKey(eKeys Key); }; @@ -694,6 +693,12 @@ cMenuChannels::cMenuChannels(void) Add(new cMenuChannelItem(channel), channel->Number() == cDevice::CurrentChannel()); } SetHelp(tr("Edit"), tr("New"), tr("Delete"), tr("Mark")); + Channels.IncBeingEdited(); +} + +cMenuChannels::~cMenuChannels() +{ + Channels.DecBeingEdited(); } cChannel *cMenuChannels::GetChannel(int Index) @@ -705,11 +710,10 @@ cChannel *cMenuChannels::GetChannel(int Index) void cMenuChannels::Propagate(void) { Channels.ReNumber(); - Channels.Save(); for (cMenuChannelItem *ci = (cMenuChannelItem *)First(); ci; ci = (cMenuChannelItem *)ci->Next()) ci->Set(); - Timers.Save(); // channel numbering has changed! Display(); + Channels.SetModified(); } eOSState cMenuChannels::Switch(void) @@ -904,7 +908,7 @@ eOSState cMenuEditTimer::ProcessKey(eKeys Key) if (state == osUnknown) { switch (Key) { - case kOk: { + case kOk: { cChannel *ch = Channels.GetByNumber(channel); if (ch) data.channel = ch; @@ -1128,29 +1132,29 @@ eOSState cMenuTimers::ProcessKey(eKeys Key) class cMenuEvent : public cOsdMenu { private: - const cEventInfo *eventInfo; + const cEvent *event; public: - cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch = false); + cMenuEvent(const cEvent *Event, bool CanSwitch = false); cMenuEvent(bool Now); virtual eOSState ProcessKey(eKeys Key); }; -cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch) +cMenuEvent::cMenuEvent(const cEvent *Event, bool CanSwitch) :cOsdMenu(tr("Event")) { - eventInfo = EventInfo; - if (eventInfo) { - cChannel *channel = Channels.GetByChannelID(eventInfo->GetChannelID(), true); + event = Event; + if (event) { + cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true); if (channel) { char *buffer; - asprintf(&buffer, "%-17.*s\t%.*s %s - %s", 17, channel->Name(), 5, eventInfo->GetDate(), eventInfo->GetTimeString(), eventInfo->GetEndTimeString()); + asprintf(&buffer, "%-17.*s\t%.*s %s - %s", 17, channel->Name(), 5, event->GetDateString(), event->GetTimeString(), event->GetEndTimeString()); SetTitle(buffer, false); free(buffer); int Line = 2; cMenuTextItem *item; - const char *Title = eventInfo->GetTitle(); - const char *Subtitle = eventInfo->GetSubtitle(); - const char *ExtendedDescription = eventInfo->GetExtendedDescription(); + const char *Title = event->Title(); + const char *Subtitle = event->ShortText(); + const char *ExtendedDescription = event->Description(); if (!isempty(Title)) { Add(item = new cMenuTextItem(Title, 1, Line, Setup.OSDwidth - 2, -1, clrCyan)); Line += item->Height() + 1; @@ -1185,16 +1189,16 @@ eOSState cMenuEvent::ProcessKey(eKeys Key) class cMenuWhatsOnItem : public cOsdItem { public: - const cEventInfo *eventInfo; - cMenuWhatsOnItem(const cEventInfo *EventInfo); + const cEvent *event; + cMenuWhatsOnItem(const cEvent *Event); }; -cMenuWhatsOnItem::cMenuWhatsOnItem(const cEventInfo *EventInfo) +cMenuWhatsOnItem::cMenuWhatsOnItem(const cEvent *Event) { - eventInfo = EventInfo; + event = Event; char *buffer = NULL; - cChannel *channel = Channels.GetByNumber(eventInfo->GetChannelNumber()); - asprintf(&buffer, "%d\t%.*s\t%.*s\t%s", eventInfo->GetChannelNumber(), 6, channel ? channel->Name() : "???", 5, eventInfo->GetTimeString(), eventInfo->GetTitle()); + cChannel *channel = Channels.GetByNumber(event->ChannelNumber()); + asprintf(&buffer, "%d\t%.*s\t%.*s\t%s", event->ChannelNumber(), 6, channel ? channel->Name() : "???", 5, event->GetTimeString(), event->Title()); SetText(buffer, false); } @@ -1205,36 +1209,36 @@ private: eOSState Record(void); eOSState Switch(void); static int currentChannel; - static const cEventInfo *scheduleEventInfo; + static const cEvent *scheduleEvent; public: cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr); static int CurrentChannel(void) { return currentChannel; } static void SetCurrentChannel(int ChannelNr) { currentChannel = ChannelNr; } - static const cEventInfo *ScheduleEventInfo(void); + static const cEvent *ScheduleEvent(void); virtual eOSState ProcessKey(eKeys Key); }; int cMenuWhatsOn::currentChannel = 0; -const cEventInfo *cMenuWhatsOn::scheduleEventInfo = NULL; +const cEvent *cMenuWhatsOn::scheduleEvent = NULL; static int CompareEventChannel(const void *p1, const void *p2) { - return (int)( (*(const cEventInfo **)p1)->GetChannelNumber() - (*(const cEventInfo **)p2)->GetChannelNumber()); + return (int)( (*(const cEvent **)p1)->ChannelNumber() - (*(const cEvent **)p2)->ChannelNumber()); } cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr) :cOsdMenu(Now ? tr("What's on now?") : tr("What's on next?"), CHNUMWIDTH, 7, 6) { const cSchedule *Schedule = Schedules->First(); - const cEventInfo **pArray = NULL; + const cEvent **pArray = NULL; int num = 0; while (Schedule) { - pArray = (const cEventInfo **)realloc(pArray, (num + 1) * sizeof(cEventInfo *)); + pArray = (const cEvent **)realloc(pArray, (num + 1) * sizeof(cEvent *)); pArray[num] = Now ? Schedule->GetPresentEvent() : Schedule->GetFollowingEvent(); if (pArray[num]) { - cChannel *channel = Channels.GetByChannelID(pArray[num]->GetChannelID(), true); + cChannel *channel = Channels.GetByChannelID(pArray[num]->ChannelID(), true); if (channel) { pArray[num]->SetChannelNumber(channel->Number()); num++; @@ -1243,20 +1247,20 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha Schedule = (const cSchedule *)Schedules->Next(Schedule); } - qsort(pArray, num, sizeof(cEventInfo *), CompareEventChannel); + qsort(pArray, num, sizeof(cEvent *), CompareEventChannel); for (int a = 0; a < num; a++) - Add(new cMenuWhatsOnItem(pArray[a]), pArray[a]->GetChannelNumber() == CurrentChannelNr); + Add(new cMenuWhatsOnItem(pArray[a]), pArray[a]->ChannelNumber() == CurrentChannelNr); currentChannel = CurrentChannelNr; free(pArray); SetHelp(Count() ? tr("Record") : NULL, Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch")); } -const cEventInfo *cMenuWhatsOn::ScheduleEventInfo(void) +const cEvent *cMenuWhatsOn::ScheduleEvent(void) { - const cEventInfo *ei = scheduleEventInfo; - scheduleEventInfo = NULL; + const cEvent *ei = scheduleEvent; + scheduleEvent = NULL; return ei; } @@ -1264,7 +1268,7 @@ eOSState cMenuWhatsOn::Switch(void) { cMenuWhatsOnItem *item = (cMenuWhatsOnItem *)Get(Current()); if (item) { - cChannel *channel = Channels.GetByChannelID(item->eventInfo->GetChannelID(), true); + cChannel *channel = Channels.GetByChannelID(item->event->ChannelID(), true); if (channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true)) return osEnd; } @@ -1276,7 +1280,7 @@ eOSState cMenuWhatsOn::Record(void) { cMenuWhatsOnItem *item = (cMenuWhatsOnItem *)Get(Current()); if (item) { - cTimer *timer = new cTimer(item->eventInfo); + cTimer *timer = new cTimer(item->event); cTimer *t = Timers.GetTimer(timer); if (t) { delete timer; @@ -1300,14 +1304,14 @@ eOSState cMenuWhatsOn::ProcessKey(eKeys Key) case kGreen: { cMenuWhatsOnItem *mi = (cMenuWhatsOnItem *)Get(Current()); if (mi) { - scheduleEventInfo = mi->eventInfo; - currentChannel = mi->eventInfo->GetChannelNumber(); + scheduleEvent = mi->event; + currentChannel = mi->event->ChannelNumber(); } } break; case kBlue: return Switch(); case kOk: if (Count()) - return AddSubMenu(new cMenuEvent(((cMenuWhatsOnItem *)Get(Current()))->eventInfo, true)); + return AddSubMenu(new cMenuEvent(((cMenuWhatsOnItem *)Get(Current()))->event, true)); break; default: break; } @@ -1319,15 +1323,15 @@ eOSState cMenuWhatsOn::ProcessKey(eKeys Key) class cMenuScheduleItem : public cOsdItem { public: - const cEventInfo *eventInfo; - cMenuScheduleItem(const cEventInfo *EventInfo); + const cEvent *event; + cMenuScheduleItem(const cEvent *Event); }; -cMenuScheduleItem::cMenuScheduleItem(const cEventInfo *EventInfo) +cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event) { - eventInfo = EventInfo; + event = Event; char *buffer = NULL; - asprintf(&buffer, "%.*s\t%.*s\t%s", 5, eventInfo->GetDate(), 5, eventInfo->GetTimeString(), eventInfo->GetTitle()); + asprintf(&buffer, "%.*s\t%.*s\t%s", 5, event->GetDateString(), 5, event->GetTimeString(), event->Title()); SetText(buffer, false); } @@ -1335,7 +1339,7 @@ cMenuScheduleItem::cMenuScheduleItem(const cEventInfo *EventInfo) class cMenuSchedule : public cOsdMenu { private: - cMutexLock mutexLock; + cSchedulesLock schedulesLock; const cSchedules *schedules; bool now, next; int otherChannel; @@ -1356,7 +1360,7 @@ cMenuSchedule::cMenuSchedule(void) cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); if (channel) { cMenuWhatsOn::SetCurrentChannel(channel->Number()); - schedules = cSIProcessor::Schedules(mutexLock); + schedules = cSchedules::Schedules(schedulesLock); PrepareSchedule(channel); SetHelp(Count() ? tr("Record") : NULL, tr("Now"), tr("Next")); } @@ -1364,12 +1368,12 @@ cMenuSchedule::cMenuSchedule(void) cMenuSchedule::~cMenuSchedule() { - cMenuWhatsOn::ScheduleEventInfo(); // makes sure any posted data is cleared + cMenuWhatsOn::ScheduleEvent(); // makes sure any posted data is cleared } static int CompareEventTime(const void *p1, const void *p2) { - return (int)((*(cEventInfo **)p1)->GetTime() - (*(cEventInfo **)p2)->GetTime()); + return (int)((*(cEvent **)p1)->StartTime() - (*(cEvent **)p2)->StartTime()); } void cMenuSchedule::PrepareSchedule(cChannel *Channel) @@ -1381,22 +1385,24 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel) free(buffer); if (schedules) { const cSchedule *Schedule = schedules->GetSchedule(Channel->GetChannelID()); - int num = Schedule->NumEvents(); - const cEventInfo **pArray = MALLOC(const cEventInfo *, num); - if (pArray) { - time_t now = time(NULL); - int numreal = 0; - for (int a = 0; a < num; a++) { - const cEventInfo *EventInfo = Schedule->GetEventNumber(a); - if (EventInfo->GetTime() + EventInfo->GetDuration() > now) - pArray[numreal++] = EventInfo; - } - - qsort(pArray, numreal, sizeof(cEventInfo *), CompareEventTime); - - for (int a = 0; a < numreal; a++) - Add(new cMenuScheduleItem(pArray[a])); - free(pArray); + if (Schedule) { + int num = Schedule->NumEvents(); + const cEvent **pArray = MALLOC(const cEvent *, num); + if (pArray) { + time_t now = time(NULL); + int numreal = 0; + for (int a = 0; a < num; a++) { + const cEvent *Event = Schedule->GetEventNumber(a); + if (Event->StartTime() + Event->Duration() > now) + pArray[numreal++] = Event; + } + + qsort(pArray, numreal, sizeof(cEvent *), CompareEventTime); + + for (int a = 0; a < numreal; a++) + Add(new cMenuScheduleItem(pArray[a])); + free(pArray); + } } } } @@ -1405,7 +1411,7 @@ eOSState cMenuSchedule::Record(void) { cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current()); if (item) { - cTimer *timer = new cTimer(item->eventInfo); + cTimer *timer = new cTimer(item->event); cTimer *t = Timers.GetTimer(timer); if (t) { delete timer; @@ -1438,7 +1444,7 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key) if (!now && !next) { int ChannelNr = 0; if (Count()) { - cChannel *channel = Channels.GetByChannelID(((cMenuScheduleItem *)Get(Current()))->eventInfo->GetChannelID(), true); + cChannel *channel = Channels.GetByChannelID(((cMenuScheduleItem *)Get(Current()))->event->ChannelID(), true); if (channel) ChannelNr = channel->Number(); } @@ -1456,16 +1462,16 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key) return Switch(); break; case kOk: if (Count()) - return AddSubMenu(new cMenuEvent(((cMenuScheduleItem *)Get(Current()))->eventInfo, otherChannel)); + return AddSubMenu(new cMenuEvent(((cMenuScheduleItem *)Get(Current()))->event, otherChannel)); break; default: break; } } else if (!HasSubMenu()) { now = next = false; - const cEventInfo *ei = cMenuWhatsOn::ScheduleEventInfo(); + const cEvent *ei = cMenuWhatsOn::ScheduleEvent(); if (ei) { - cChannel *channel = Channels.GetByChannelID(ei->GetChannelID(), true); + cChannel *channel = Channels.GetByChannelID(ei->ChannelID(), true); if (channel) { PrepareSchedule(channel); if (channel->Number() != cDevice::CurrentChannel()) { @@ -1985,6 +1991,7 @@ private: virtual void Set(void); public: cMenuSetupOSD(void) { Set(); } + virtual ~cMenuSetupOSD() { cFont::SetCode(I18nCharSets()[Setup.OSDLanguage]); } virtual eOSState ProcessKey(eKeys Key); }; @@ -2011,6 +2018,7 @@ eOSState cMenuSetupOSD::ProcessKey(eKeys Key) if (data.OSDLanguage != osdLanguage) { int OriginalOSDLanguage = Setup.OSDLanguage; Setup.OSDLanguage = data.OSDLanguage; + cFont::SetCode(I18nCharSets()[Setup.OSDLanguage]); Set(); Display(); Setup.OSDLanguage = OriginalOSDLanguage; @@ -2631,10 +2639,10 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched) int EpgLines = withInfo ? 5 : 1; lines = 0; number = 0; - cChannel *channel = Channels.GetByNumber(Number); + channel = Channels.GetByNumber(Number); Interface->Open(Setup.OSDwidth, Setup.ChannelInfoPos ? EpgLines : -EpgLines); if (channel) { - DisplayChannel(channel); + DisplayChannel(); DisplayInfo(); } lastTime = time_ms(); @@ -2658,16 +2666,16 @@ cDisplayChannel::~cDisplayChannel() Interface->Close(); } -void cDisplayChannel::DisplayChannel(const cChannel *Channel) +void cDisplayChannel::DisplayChannel(void) { int BufSize = Width() + 1; char buffer[BufSize]; *buffer = 0; - if (Channel) { - if (Channel->GroupSep()) - snprintf(buffer, BufSize, "%s", Channel->Name()); + if (channel) { + if (channel->GroupSep()) + snprintf(buffer, BufSize, "%s", channel->Name()); else - snprintf(buffer, BufSize, "%d%s %s", Channel->Number(), number ? "-" : "", Channel->Name()); + snprintf(buffer, BufSize, "%d%s %s", channel->Number(), number ? "-" : "", channel->Name()); } else if (number) snprintf(buffer, BufSize, "%d-", number); @@ -2682,28 +2690,28 @@ void cDisplayChannel::DisplayChannel(const cChannel *Channel) void cDisplayChannel::DisplayInfo(void) { - if (withInfo) { - const cEventInfo *Present = NULL, *Following = NULL; - cMutexLock MutexLock; - const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock); + if (withInfo && channel) { + const cEvent *Present = NULL, *Following = NULL; + cSchedulesLock SchedulesLock; + const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); if (Schedules) { - const cSchedule *Schedule = Schedules->GetSchedule(); + const cSchedule *Schedule = Schedules->GetSchedule(channel->GetChannelID()); if (Schedule) { const char *PresentTitle = NULL, *PresentSubtitle = NULL, *FollowingTitle = NULL, *FollowingSubtitle = NULL; int Lines = 0; if ((Present = Schedule->GetPresentEvent()) != NULL) { - PresentTitle = Present->GetTitle(); + PresentTitle = Present->Title(); if (!isempty(PresentTitle)) Lines++; - PresentSubtitle = Present->GetSubtitle(); + PresentSubtitle = Present->ShortText(); if (!isempty(PresentSubtitle)) Lines++; } if ((Following = Schedule->GetFollowingEvent()) != NULL) { - FollowingTitle = Following->GetTitle(); + FollowingTitle = Following->Title(); if (!isempty(FollowingTitle)) Lines++; - FollowingSubtitle = Following->GetSubtitle(); + FollowingSubtitle = Following->ShortText(); if (!isempty(FollowingSubtitle)) Lines++; } @@ -2731,7 +2739,7 @@ void cDisplayChannel::DisplayInfo(void) Interface->Flush(); lines = Lines; lastTime = time_ms(); - cStatus::MsgOsdProgramme(Present ? Present->GetTime() : 0, PresentTitle, PresentSubtitle, Following ? Following->GetTime() : 0, FollowingTitle, FollowingSubtitle); + cStatus::MsgOsdProgramme(Present ? Present->StartTime() : 0, PresentTitle, PresentSubtitle, Following ? Following->StartTime() : 0, FollowingTitle, FollowingSubtitle); } } } @@ -2741,7 +2749,8 @@ void cDisplayChannel::DisplayInfo(void) void cDisplayChannel::Refresh(void) { Interface->Clear(); - DisplayChannel(Channels.GetByNumber(cDevice::CurrentChannel())); + channel = Channels.GetByNumber(cDevice::CurrentChannel()); + DisplayChannel(); lastTime = time_ms(); lines = 0; } @@ -2759,20 +2768,21 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) if (number >= 0) { number = number * 10 + Key - k0; if (number > 0) { - cChannel *channel = Channels.GetByNumber(number); + channel = Channels.GetByNumber(number); Interface->Clear(); withInfo = false; - DisplayChannel(channel); + DisplayChannel(); lastTime = time_ms(); // Lets see if there can be any useful further input: int n = channel ? number * 10 : 0; - while (channel && (channel = Channels.Next(channel)) != NULL) { - if (!channel->GroupSep()) { - if (n <= channel->Number() && channel->Number() <= n + 9) { + cChannel *ch = channel; + while (ch && (ch = Channels.Next(ch)) != NULL) { + if (!ch->GroupSep()) { + if (n <= ch->Number() && ch->Number() <= n + 9) { n = 0; break; } - if (channel->Number() > n) + if (ch->Number() > n) n *= 10; } } @@ -2803,10 +2813,10 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) group = Channels.GetPrevGroup(group < 1 ? 1 : group); if (group < 0) group = SaveGroup; - cChannel *channel = Channels.Get(group); + channel = Channels.Get(group); if (channel) { Interface->Clear(); - DisplayChannel(channel); + DisplayChannel(); if (!channel->GroupSep()) group = -1; } @@ -2833,7 +2843,8 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) Channels.SwitchTo(number); else { number = 0; - DisplayChannel(NULL); + channel = NULL; + DisplayChannel(); lastTime = time_ms(); return osContinue; } @@ -2965,7 +2976,7 @@ eOSState cDisplayVolume::ProcessKey(eKeys Key) cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause) { - eventInfo = NULL; + event = NULL; instantId = NULL; fileName = NULL; recorder = NULL; @@ -2984,10 +2995,10 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause) const char *Title = NULL; const char *Subtitle = NULL; const char *Summary = NULL; - if (GetEventInfo()) { - Title = eventInfo->GetTitle(); - Subtitle = eventInfo->GetSubtitle(); - Summary = eventInfo->GetExtendedDescription(); + if (GetEvent()) { + Title = event->Title(); + Subtitle = event->ShortText(); + Summary = event->Description(); dsyslog("Title: '%s' Subtitle: '%s'", Title, Subtitle); } cRecording Recording(timer, Title, Subtitle, Summary); @@ -3036,19 +3047,19 @@ cRecordControl::~cRecordControl() #define INSTANT_REC_EPG_LOOKAHEAD 300 // seconds to look into the EPG data for an instant recording -bool cRecordControl::GetEventInfo(void) +bool cRecordControl::GetEvent(void) { const cChannel *channel = timer->Channel(); time_t Time = timer->Active() == taActInst ? timer->StartTime() + INSTANT_REC_EPG_LOOKAHEAD : timer->StartTime() + (timer->StopTime() - timer->StartTime()) / 2; for (int seconds = 0; seconds <= MAXWAIT4EPGINFO; seconds++) { { - cMutexLock MutexLock; - const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock); + cSchedulesLock SchedulesLock; + const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); if (Schedules) { const cSchedule *Schedule = Schedules->GetSchedule(channel->GetChannelID()); if (Schedule) { - eventInfo = Schedule->GetEventAround(Time); - if (eventInfo) { + event = Schedule->GetEventAround(Time); + if (event) { if (seconds > 0) dsyslog("got EPG info after %d seconds", seconds); return true; @@ -3215,6 +3226,20 @@ void cRecordControls::Process(time_t t) } } +void cRecordControls::ChannelDataModified(cChannel *Channel) +{ + for (int i = 0; i < MAXRECORDCONTROLS; i++) { + if (RecordControls[i]) { + if (RecordControls[i]->Timer() && RecordControls[i]->Timer()->Channel() == Channel) { + isyslog("stopping recording due to modification of channel %d", Channel->Number()); + RecordControls[i]->Stop(true); + // This will restart the recording, maybe even from a different + // device in case conditional access has changed. + } + } + } +} + bool cRecordControls::Active(void) { for (int i = 0; i < MAXRECORDCONTROLS; i++) { |