mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Made the "What's on now/next?" menus a lot faster by storing a pointer to each channel's schedule in the cChannel data
This commit is contained in:
parent
0ef577f43a
commit
cd43adac92
2
HISTORY
2
HISTORY
@ -4170,3 +4170,5 @@ Video Disk Recorder Revision History
|
|||||||
names (thanks to Stefan Huelswitt).
|
names (thanks to Stefan Huelswitt).
|
||||||
- Added a missing '-' to the example for viewing a grabbed image on a remote host
|
- Added a missing '-' to the example for viewing a grabbed image on a remote host
|
||||||
(reported by Philippe Gramoullé).
|
(reported by Philippe Gramoullé).
|
||||||
|
- Made the "What's on now/next?" menus a lot faster by storing a pointer to each
|
||||||
|
channel's schedule in the cChannel data.
|
||||||
|
@ -4,13 +4,14 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: channels.c 1.47 2005/12/30 15:41:24 kls Exp $
|
* $Id: channels.c 1.48 2006/01/14 15:51:02 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
#include <linux/dvb/frontend.h>
|
#include <linux/dvb/frontend.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
#include "epg.h"
|
||||||
|
|
||||||
// IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
|
// 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
|
// format characters in order to allow any number of blanks after a numeric
|
||||||
@ -174,6 +175,7 @@ cChannel::cChannel(void)
|
|||||||
guard = GUARD_INTERVAL_AUTO;
|
guard = GUARD_INTERVAL_AUTO;
|
||||||
hierarchy = HIERARCHY_AUTO;
|
hierarchy = HIERARCHY_AUTO;
|
||||||
modification = CHANNELMOD_NONE;
|
modification = CHANNELMOD_NONE;
|
||||||
|
schedule = NULL;
|
||||||
linkChannels = NULL;
|
linkChannels = NULL;
|
||||||
refChannel = NULL;
|
refChannel = NULL;
|
||||||
}
|
}
|
||||||
@ -184,6 +186,7 @@ cChannel::cChannel(const cChannel &Channel)
|
|||||||
shortName = NULL;
|
shortName = NULL;
|
||||||
provider = NULL;
|
provider = NULL;
|
||||||
portalName = NULL;
|
portalName = NULL;
|
||||||
|
schedule = NULL;
|
||||||
linkChannels = NULL;
|
linkChannels = NULL;
|
||||||
refChannel = NULL;
|
refChannel = NULL;
|
||||||
*this = Channel;
|
*this = Channel;
|
||||||
@ -293,6 +296,7 @@ bool cChannel::SetSatTransponderData(int Source, int Frequency, char Polarizatio
|
|||||||
srate = Srate;
|
srate = Srate;
|
||||||
coderateH = CoderateH;
|
coderateH = CoderateH;
|
||||||
modulation = QPSK;
|
modulation = QPSK;
|
||||||
|
schedule = NULL;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -310,6 +314,7 @@ bool cChannel::SetCableTransponderData(int Source, int Frequency, int Modulation
|
|||||||
modulation = Modulation;
|
modulation = Modulation;
|
||||||
srate = Srate;
|
srate = Srate;
|
||||||
coderateH = CoderateH;
|
coderateH = CoderateH;
|
||||||
|
schedule = NULL;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -331,6 +336,7 @@ bool cChannel::SetTerrTransponderData(int Source, int Frequency, int Bandwidth,
|
|||||||
coderateL = CoderateL;
|
coderateL = CoderateL;
|
||||||
guard = Guard;
|
guard = Guard;
|
||||||
transmission = Transmission;
|
transmission = Transmission;
|
||||||
|
schedule = NULL;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -350,6 +356,7 @@ void cChannel::SetId(int Nid, int Tid, int Sid, int Rid)
|
|||||||
rid = Rid;
|
rid = Rid;
|
||||||
if (Number())
|
if (Number())
|
||||||
Channels.HashChannel(this);
|
Channels.HashChannel(this);
|
||||||
|
schedule = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: channels.h 1.37 2006/01/07 13:00:43 kls Exp $
|
* $Id: channels.h 1.38 2006/01/14 15:51:26 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CHANNELS_H
|
#ifndef __CHANNELS_H
|
||||||
@ -103,7 +103,10 @@ public:
|
|||||||
class cLinkChannels : public cList<cLinkChannel> {
|
class cLinkChannels : public cList<cLinkChannel> {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class cSchedule;
|
||||||
|
|
||||||
class cChannel : public cListObject {
|
class cChannel : public cListObject {
|
||||||
|
friend class cSchedules;
|
||||||
friend class cMenuEditChannel;
|
friend class cMenuEditChannel;
|
||||||
private:
|
private:
|
||||||
static cString ToText(const cChannel *Channel);
|
static cString ToText(const cChannel *Channel);
|
||||||
@ -142,6 +145,7 @@ private:
|
|||||||
int hierarchy;
|
int hierarchy;
|
||||||
int __EndData__;
|
int __EndData__;
|
||||||
int modification;
|
int modification;
|
||||||
|
mutable const cSchedule *schedule;
|
||||||
cLinkChannels *linkChannels;
|
cLinkChannels *linkChannels;
|
||||||
cChannel *refChannel;
|
cChannel *refChannel;
|
||||||
cString ParametersToString(void) const;
|
cString ParametersToString(void) const;
|
||||||
|
8
eit.c
8
eit.c
@ -8,7 +8,7 @@
|
|||||||
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
||||||
* Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
|
* Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
|
||||||
*
|
*
|
||||||
* $Id: eit.c 1.113 2005/12/26 11:50:09 kls Exp $
|
* $Id: eit.c 1.114 2006/01/14 15:41:21 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "eit.h"
|
#include "eit.h"
|
||||||
@ -35,11 +35,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
|
|||||||
if (!channel)
|
if (!channel)
|
||||||
return; // only collect data for known channels
|
return; // only collect data for known channels
|
||||||
|
|
||||||
cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channelID);
|
cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channel, true);
|
||||||
if (!pSchedule) {
|
|
||||||
pSchedule = new cSchedule(channelID);
|
|
||||||
Schedules->Add(pSchedule);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Empty = true;
|
bool Empty = true;
|
||||||
bool Modified = false;
|
bool Modified = false;
|
||||||
|
18
epg.c
18
epg.c
@ -7,7 +7,7 @@
|
|||||||
* Original version (as used in VDR before 1.3.0) written by
|
* Original version (as used in VDR before 1.3.0) written by
|
||||||
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
* 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"
|
#include "epg.h"
|
||||||
@ -997,3 +997,19 @@ const cSchedule *cSchedules::GetSchedule(tChannelID ChannelID) const
|
|||||||
return NULL;
|
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;
|
||||||
|
}
|
||||||
|
3
epg.h
3
epg.h
@ -7,7 +7,7 @@
|
|||||||
* Original version (as used in VDR before 1.3.0) written by
|
* Original version (as used in VDR before 1.3.0) written by
|
||||||
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
||||||
*
|
*
|
||||||
* $Id: epg.h 1.28 2005/12/27 14:31:24 kls Exp $
|
* $Id: epg.h 1.29 2006/01/14 15:45:24 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __EPG_H
|
#ifndef __EPG_H
|
||||||
@ -179,6 +179,7 @@ public:
|
|||||||
static bool Read(FILE *f = NULL);
|
static bool Read(FILE *f = NULL);
|
||||||
cSchedule *AddSchedule(tChannelID ChannelID);
|
cSchedule *AddSchedule(tChannelID ChannelID);
|
||||||
const cSchedule *GetSchedule(tChannelID ChannelID) const;
|
const cSchedule *GetSchedule(tChannelID ChannelID) const;
|
||||||
|
const cSchedule *GetSchedule(const cChannel *Channel, bool AddIfMissing = false) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ReportEpgBugFixStats(bool Reset = false);
|
void ReportEpgBugFixStats(bool Reset = false);
|
||||||
|
12
menu.c
12
menu.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: menu.c 1.392 2006/01/13 15:17:53 kls Exp $
|
* $Id: menu.c 1.393 2006/01/14 14:53:43 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@ -1029,7 +1029,7 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha
|
|||||||
helpKeys = -1;
|
helpKeys = -1;
|
||||||
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
|
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
|
||||||
if (!Channel->GroupSep()) {
|
if (!Channel->GroupSep()) {
|
||||||
const cSchedule *Schedule = Schedules->GetSchedule(Channel->GetChannelID());
|
const cSchedule *Schedule = Schedules->GetSchedule(Channel);
|
||||||
if (Schedule) {
|
if (Schedule) {
|
||||||
const cEvent *Event = Now ? Schedule->GetPresentEvent() : Schedule->GetFollowingEvent();
|
const cEvent *Event = Now ? Schedule->GetPresentEvent() : Schedule->GetFollowingEvent();
|
||||||
if (Event)
|
if (Event)
|
||||||
@ -1202,7 +1202,7 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
|
|||||||
SetTitle(buffer);
|
SetTitle(buffer);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
if (schedules) {
|
if (schedules) {
|
||||||
const cSchedule *Schedule = schedules->GetSchedule(Channel->GetChannelID());
|
const cSchedule *Schedule = schedules->GetSchedule(Channel);
|
||||||
if (Schedule) {
|
if (Schedule) {
|
||||||
const cEvent *PresentEvent = Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel());
|
const cEvent *PresentEvent = Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel());
|
||||||
time_t now = time(NULL) - Setup.EPGLinger * 60;
|
time_t now = time(NULL) - Setup.EPGLinger * 60;
|
||||||
@ -2833,7 +2833,7 @@ static void SetTrackDescriptions(bool Live)
|
|||||||
if (Channel) {
|
if (Channel) {
|
||||||
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
|
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
|
||||||
if (Schedules) {
|
if (Schedules) {
|
||||||
const cSchedule *Schedule = Schedules->GetSchedule(Channel->GetChannelID());
|
const cSchedule *Schedule = Schedules->GetSchedule(Channel);
|
||||||
if (Schedule) {
|
if (Schedule) {
|
||||||
const cEvent *Present = Schedule->GetPresentEvent(true);
|
const cEvent *Present = Schedule->GetPresentEvent(true);
|
||||||
if (Present)
|
if (Present)
|
||||||
@ -2916,7 +2916,7 @@ void cDisplayChannel::DisplayInfo(void)
|
|||||||
cSchedulesLock SchedulesLock;
|
cSchedulesLock SchedulesLock;
|
||||||
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
|
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
|
||||||
if (Schedules) {
|
if (Schedules) {
|
||||||
const cSchedule *Schedule = Schedules->GetSchedule(channel->GetChannelID());
|
const cSchedule *Schedule = Schedules->GetSchedule(channel);
|
||||||
if (Schedule) {
|
if (Schedule) {
|
||||||
const cEvent *Present = Schedule->GetPresentEvent(true);
|
const cEvent *Present = Schedule->GetPresentEvent(true);
|
||||||
const cEvent *Following = Schedule->GetFollowingEvent(true);
|
const cEvent *Following = Schedule->GetFollowingEvent(true);
|
||||||
@ -3346,7 +3346,7 @@ bool cRecordControl::GetEvent(void)
|
|||||||
cSchedulesLock SchedulesLock;
|
cSchedulesLock SchedulesLock;
|
||||||
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
|
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
|
||||||
if (Schedules) {
|
if (Schedules) {
|
||||||
const cSchedule *Schedule = Schedules->GetSchedule(channel->GetChannelID());
|
const cSchedule *Schedule = Schedules->GetSchedule(channel);
|
||||||
if (Schedule) {
|
if (Schedule) {
|
||||||
event = Schedule->GetEventAround(Time);
|
event = Schedule->GetEventAround(Time);
|
||||||
if (event) {
|
if (event) {
|
||||||
|
4
svdrp.c
4
svdrp.c
@ -10,7 +10,7 @@
|
|||||||
* and interact with the Video Disk Recorder - or write a full featured
|
* and interact with the Video Disk Recorder - or write a full featured
|
||||||
* graphical interface that sits on top of an SVDRP connection.
|
* graphical interface that sits on top of an SVDRP connection.
|
||||||
*
|
*
|
||||||
* $Id: svdrp.c 1.91 2006/01/14 11:42:52 kls Exp $
|
* $Id: svdrp.c 1.92 2006/01/14 14:55:52 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "svdrp.h"
|
#include "svdrp.h"
|
||||||
@ -936,7 +936,7 @@ void cSVDRP::CmdLSTE(const char *Option)
|
|||||||
else
|
else
|
||||||
Channel = Channels.GetByChannelID(tChannelID::FromString(Option));
|
Channel = Channels.GetByChannelID(tChannelID::FromString(Option));
|
||||||
if (Channel) {
|
if (Channel) {
|
||||||
Schedule = Schedules->GetSchedule(Channel->GetChannelID());
|
Schedule = Schedules->GetSchedule(Channel);
|
||||||
if (!Schedule) {
|
if (!Schedule) {
|
||||||
Reply(550, "No schedule found");
|
Reply(550, "No schedule found");
|
||||||
return;
|
return;
|
||||||
|
4
timers.c
4
timers.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: timers.c 1.41 2006/01/08 11:40:29 kls Exp $
|
* $Id: timers.c 1.42 2006/01/14 14:56:11 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
@ -596,7 +596,7 @@ void cTimers::SetEvents(void)
|
|||||||
if (Schedules) {
|
if (Schedules) {
|
||||||
if (!lastSetEvents || Schedules->Modified() >= lastSetEvents) {
|
if (!lastSetEvents || Schedules->Modified() >= lastSetEvents) {
|
||||||
for (cTimer *ti = First(); ti; ti = Next(ti)) {
|
for (cTimer *ti = First(); ti; ti = Next(ti)) {
|
||||||
const cSchedule *Schedule = Schedules->GetSchedule(ti->Channel()->GetChannelID());
|
const cSchedule *Schedule = Schedules->GetSchedule(ti->Channel());
|
||||||
if (Schedule) {
|
if (Schedule) {
|
||||||
if (!lastSetEvents || Schedule->Modified() >= lastSetEvents) {
|
if (!lastSetEvents || Schedule->Modified() >= lastSetEvents) {
|
||||||
const cEvent *Event = NULL;
|
const cEvent *Event = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user