The transponder value of channels is now cached

This commit is contained in:
Klaus Schmidinger 2021-05-21 09:38:34 +02:00
parent c02c081d91
commit 505bcee926
4 changed files with 21 additions and 11 deletions

View File

@ -3652,6 +3652,7 @@ Helmut Binder <cco@aon.at>
for reporting a problem with PMT handling in case locking the Channels list times out for reporting a problem with PMT handling in case locking the Channels list times out
for avoiding a lengthy lock on the Channels list when starting a recording for avoiding a lengthy lock on the Channels list when starting a recording
for preventing switching devices for pattern timers for preventing switching devices for pattern timers
for pointing out that cChannel::Transponder(void) is called very often
Ulrich Eckhardt <uli@uli-eckhardt.de> Ulrich Eckhardt <uli@uli-eckhardt.de>
for reporting a problem with shutdown after user inactivity in case a plugin is for reporting a problem with shutdown after user inactivity in case a plugin is

View File

@ -9663,7 +9663,7 @@ Video Disk Recorder Revision History
- EXPIRELATENCY now only applies to VPS timers. - EXPIRELATENCY now only applies to VPS timers.
- Deleting expired timers is now triggered immediately after the timers are modified. - Deleting expired timers is now triggered immediately after the timers are modified.
2021-05-20: 2021-05-21:
- Now using a separate fixed value for internal EPG linger time. This fixes problems with - Now using a separate fixed value for internal EPG linger time. This fixes problems with
spawned timers jumping to the next event in case Setup.EPGLinger is very small. (reported spawned timers jumping to the next event in case Setup.EPGLinger is very small. (reported
@ -9688,3 +9688,5 @@ Video Disk Recorder Revision History
+ It was only actually used in svdrp.c. + It was only actually used in svdrp.c.
+ cFile::Ready() now processes only its own file descriptor by calling FileReady() + cFile::Ready() now processes only its own file descriptor by calling FileReady()
instead of AnyFileReady(). instead of AnyFileReady().
- The transponder value of channels is now cached, because cChannel::Transponder(void)
is called very often (pointed out by Helmut Binder).

View File

@ -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.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" #include "channels.h"
@ -145,15 +145,18 @@ int cChannel::Transponder(int Frequency, char Polarization)
int cChannel::Transponder(void) const int cChannel::Transponder(void) const
{ {
int tf = frequency; if (!transponder) {
while (tf > 20000) int tf = frequency;
tf /= 1000; while (tf > 20000)
if (IsSat()) { tf /= 1000;
const char *p = strpbrk(parameters, "HVLRhvlr"); // lowercase for backwards compatibility if (IsSat()) {
if (p) const char *p = strpbrk(parameters, "HVLRhvlr"); // lowercase for backwards compatibility
tf = Transponder(tf, *p); if (p)
tf = Transponder(tf, *p);
}
transponder = tf;
} }
return tf; return transponder;
} }
int cChannel::Modification(int Mask) const int cChannel::Modification(int Mask) const
@ -167,6 +170,7 @@ void cChannel::CopyTransponderData(const cChannel *Channel)
{ {
if (Channel) { if (Channel) {
frequency = Channel->frequency; frequency = Channel->frequency;
transponder = Channel->transponder;
source = Channel->source; source = Channel->source;
srate = Channel->srate; srate = Channel->srate;
parameters = Channel->parameters; parameters = Channel->parameters;
@ -195,6 +199,7 @@ bool cChannel::SetTransponderData(int Source, int Frequency, int Srate, const ch
cString OldTransponderData = TransponderDataToString(); cString OldTransponderData = TransponderDataToString();
source = Source; source = Source;
frequency = Frequency; frequency = Frequency;
transponder = 0;
srate = Srate; srate = Srate;
parameters = Parameters; parameters = Parameters;
schedule = NULL; schedule = NULL;
@ -655,6 +660,7 @@ bool cChannel::Parse(const char *s)
if (parambuf && sourcebuf && vpidbuf && apidbuf) { if (parambuf && sourcebuf && vpidbuf && apidbuf) {
parameters = parambuf; parameters = parambuf;
ok = (source = cSource::FromString(sourcebuf)) >= 0; ok = (source = cSource::FromString(sourcebuf)) >= 0;
transponder = 0;
char *p; char *p;
if ((p = strchr(vpidbuf, '=')) != NULL) { if ((p = strchr(vpidbuf, '=')) != NULL) {

View File

@ -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 5.1 2021/01/14 10:29:05 kls Exp $ * $Id: channels.h 5.2 2021/05/21 09:38:34 kls Exp $
*/ */
#ifndef __CHANNELS_H #ifndef __CHANNELS_H
@ -96,6 +96,7 @@ private:
char *portalName; char *portalName;
int __BeginData__; int __BeginData__;
int frequency; // MHz int frequency; // MHz
mutable int transponder; // cached value
int source; int source;
int srate; int srate;
int vpid; int vpid;