summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2021-05-21 09:38:34 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2021-05-21 09:38:34 +0200
commit505bcee9268750388547be0ab5c0527d1bd851b5 (patch)
tree644263371ef0ca172cb8a66ccddf26da4857188a /channels.c
parentc02c081d917df2ca2b11aa165c8f825bb126a2b9 (diff)
downloadvdr-505bcee9268750388547be0ab5c0527d1bd851b5.tar.gz
vdr-505bcee9268750388547be0ab5c0527d1bd851b5.tar.bz2
The transponder value of channels is now cached
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/channels.c b/channels.c
index 606ed8ff..7fe8275d 100644
--- a/channels.c
+++ b/channels.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: channels.c 4.6 2020/04/11 09:22:05 kls Exp $
+ * $Id: channels.c 5.1 2021/05/21 09:38:34 kls Exp $
*/
#include "channels.h"
@@ -145,15 +145,18 @@ int cChannel::Transponder(int Frequency, char Polarization)
int cChannel::Transponder(void) const
{
- int tf = frequency;
- while (tf > 20000)
- tf /= 1000;
- if (IsSat()) {
- const char *p = strpbrk(parameters, "HVLRhvlr"); // lowercase for backwards compatibility
- if (p)
- tf = Transponder(tf, *p);
+ if (!transponder) {
+ int tf = frequency;
+ while (tf > 20000)
+ tf /= 1000;
+ if (IsSat()) {
+ const char *p = strpbrk(parameters, "HVLRhvlr"); // lowercase for backwards compatibility
+ if (p)
+ tf = Transponder(tf, *p);
+ }
+ transponder = tf;
}
- return tf;
+ return transponder;
}
int cChannel::Modification(int Mask) const
@@ -167,6 +170,7 @@ void cChannel::CopyTransponderData(const cChannel *Channel)
{
if (Channel) {
frequency = Channel->frequency;
+ transponder = Channel->transponder;
source = Channel->source;
srate = Channel->srate;
parameters = Channel->parameters;
@@ -195,6 +199,7 @@ bool cChannel::SetTransponderData(int Source, int Frequency, int Srate, const ch
cString OldTransponderData = TransponderDataToString();
source = Source;
frequency = Frequency;
+ transponder = 0;
srate = Srate;
parameters = Parameters;
schedule = NULL;
@@ -655,6 +660,7 @@ bool cChannel::Parse(const char *s)
if (parambuf && sourcebuf && vpidbuf && apidbuf) {
parameters = parambuf;
ok = (source = cSource::FromString(sourcebuf)) >= 0;
+ transponder = 0;
char *p;
if ((p = strchr(vpidbuf, '=')) != NULL) {