From 829c834d3045145f048436ff4f5ad0e6acc083ef Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 26 Jan 2003 16:20:30 +0100 Subject: [PATCH] Fixed skipping unavailable channels in the EPG scanner --- HISTORY | 1 + eitscan.c | 60 +++++++++++++++++++++++++++++-------------------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/HISTORY b/HISTORY index a7f09f4e..90859361 100644 --- a/HISTORY +++ b/HISTORY @@ -1940,3 +1940,4 @@ Video Disk Recorder Revision History - Changed EIT processing to always read a full section. - Fixed handling user defined CFLAGS in libdtv/libvdr/Makefile (thanks to Clemens Kirchgatterer and Robert Schiele). +- Fixed skipping unavailable channels in the EPG scanner. diff --git a/eitscan.c b/eitscan.c index fdcd8c3d..5768a423 100644 --- a/eitscan.c +++ b/eitscan.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: eitscan.c 1.10 2002/11/01 11:04:49 kls Exp $ + * $Id: eitscan.c 1.11 2003/01/26 16:19:24 kls Exp $ */ #include "eitscan.h" @@ -51,38 +51,42 @@ void cEITScanner::Process(void) if (Setup.EPGScanTimeout && Channels.MaxNumber() > 1) { time_t now = time(NULL); if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) { - for (int i = 0; i < cDevice::NumDevices(); i++) { - cDevice *Device = cDevice::GetDevice(i); - if (Device && Device->CardIndex() < MAXDVBDEVICES) { - if (Device != cDevice::PrimaryDevice() || (cDevice::NumDevices() == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) { - if (!(Device->Receiving(true) || Device->Replaying())) { - int oldCh = lastChannel; - int ch = oldCh + 1; - while (ch != oldCh) { - if (ch > Channels.MaxNumber()) { - ch = 1; - numTransponders = 0; - } - cChannel *Channel = Channels.GetByNumber(ch, 1); - if (Channel) { - if (!Device->ProvidesChannel(Channel)) - break; - if (Channel->Sid() && !TransponderScanned(Channel)) { - if (Device == cDevice::PrimaryDevice() && !currentChannel) - currentChannel = Device->CurrentChannel(); - Device->SwitchChannel(Channel, false); - lastChannel = ch; - break; + do { + int oldLastChannel = lastChannel; + for (int i = 0; i < cDevice::NumDevices(); i++) { + cDevice *Device = cDevice::GetDevice(i); + if (Device && Device->CardIndex() < MAXDVBDEVICES) { + if (Device != cDevice::PrimaryDevice() || (cDevice::NumDevices() == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) { + if (!(Device->Receiving(true) || Device->Replaying())) { + int oldCh = lastChannel; + int ch = oldCh + 1; + while (ch != oldCh) { + if (ch > Channels.MaxNumber()) { + ch = 1; + numTransponders = 0; } + cChannel *Channel = Channels.GetByNumber(ch, 1); + if (Channel) { + if (!Device->ProvidesChannel(Channel)) + break; + if (Channel->Sid() && !TransponderScanned(Channel)) { + if (Device == cDevice::PrimaryDevice() && !currentChannel) + currentChannel = Device->CurrentChannel(); + Device->SwitchChannel(Channel, false); + lastChannel = ch; + break; + } + } + ch = Channel->Number() + 1; } - ch = Channel->Number() + 1; - } + } } } } - else - lastChannel++; // avoid hangup in case the last channel in the list is not provided by a DVB card - } + if (lastChannel != oldLastChannel) + break; + lastChannel++; + } while (time(NULL) - now < 2); lastScan = time(NULL); } }