summaryrefslogtreecommitdiff
path: root/epg.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2006-01-14 15:52:40 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2006-01-14 15:52:40 +0100
commitcd43adac926d60203754515b0eaf0bb3ac2d1399 (patch)
tree2c3e405e5e501ff1f62b1ddbbfa9dcfe52ca99c7 /epg.c
parent0ef577f43a7671484aa1f40fcfb1386e4d0feef6 (diff)
downloadvdr-cd43adac926d60203754515b0eaf0bb3ac2d1399.tar.gz
vdr-cd43adac926d60203754515b0eaf0bb3ac2d1399.tar.bz2
Made the "What's on now/next?" menus a lot faster by storing a pointer to each channel's schedule in the cChannel data
Diffstat (limited to 'epg.c')
-rw-r--r--epg.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/epg.c b/epg.c
index 7b2cb0ea..615941f2 100644
--- a/epg.c
+++ b/epg.c
@@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
- * $Id: epg.c 1.47 2005/12/30 15:41:59 kls Exp $
+ * $Id: epg.c 1.48 2006/01/14 15:46:50 kls Exp $
*/
#include "epg.h"
@@ -997,3 +997,19 @@ const cSchedule *cSchedules::GetSchedule(tChannelID ChannelID) const
return NULL;
}
+const cSchedule *cSchedules::GetSchedule(const cChannel *Channel, bool AddIfMissing) const
+{
+ // This is not very beautiful, but it dramatically speeds up the
+ // "What's on now/next?" menus.
+ static cSchedule DummySchedule(tChannelID::InvalidID);
+ if (!Channel->schedule)
+ Channel->schedule = GetSchedule(Channel->GetChannelID());
+ if (!Channel->schedule)
+ Channel->schedule = &DummySchedule;
+ if (Channel->schedule == &DummySchedule && AddIfMissing) {
+ cSchedule *Schedule = new cSchedule(Channel->GetChannelID());
+ ((cSchedules *)this)->Add(Schedule);
+ Channel->schedule = Schedule;
+ }
+ return Channel->schedule != &DummySchedule? Channel->schedule : NULL;
+}