From f41e3f327b5c7bf080be803af05358e061a37995 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 12 Jun 2005 14:09:45 +0200 Subject: Modified cEITScanner::Process() so that it works on systems with only budget cards or a mix of DVB-S, DVB-C or DVB-T cards --- HISTORY | 2 ++ device.c | 11 ++++++++++- device.h | 5 ++++- eitscan.c | 51 ++++++++++++++++++++++++--------------------------- 4 files changed, 40 insertions(+), 29 deletions(-) diff --git a/HISTORY b/HISTORY index 3b5ab300..67422392 100644 --- a/HISTORY +++ b/HISTORY @@ -3604,3 +3604,5 @@ Video Disk Recorder Revision History - Fixed handling page up/down in menu lists in case there are several non selectable items in a row (thanks to Udo Richter for reporting this one). - Added cOsdMenu::SetCols() to allow adjusting the menu columns. +- Modified cEITScanner::Process() so that it works on systems with only budget cards + or a mix of DVB-S, DVB-C or DVB-T cards. diff --git a/device.c b/device.c index 9b5f701d..c79f7db3 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.102 2005/06/05 13:28:03 kls Exp $ + * $Id: device.c 1.103 2005/06/12 13:39:11 kls Exp $ */ #include "device.h" @@ -505,6 +505,15 @@ bool cDevice::ProvidesTransponder(const cChannel *Channel) const return false; } +bool cDevice::ProvidesTransponderExclusively(const cChannel *Channel) const +{ + for (int i = 0; i < numDevices; i++) { + if (device[i] && device[i] != this && device[i]->ProvidesTransponder(Channel)) + return false; + } + return true; +} + bool cDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) const { return false; diff --git a/device.h b/device.h index ceda3d2a..06380fe9 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.58 2005/06/05 12:56:08 kls Exp $ + * $Id: device.h 1.59 2005/06/12 13:35:47 kls Exp $ */ #ifndef __DEVICE_H @@ -186,6 +186,9 @@ public: ///< Returns true if this device can provide the given source. virtual bool ProvidesTransponder(const cChannel *Channel) const; ///< XXX -> PLUGINS.html! + virtual bool ProvidesTransponderExclusively(const cChannel *Channel) const; + ///< Returns true if this is the only device that is able to provide + ///< the given channel's transponder. virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL) const; ///< Returns true if this device can provide the given channel. ///< In case the device has cReceivers attached to it or it is the primary diff --git a/eitscan.c b/eitscan.c index 9c98fff0..6b5f0224 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.25 2005/06/05 14:43:29 kls Exp $ + * $Id: eitscan.c 1.26 2005/06/12 14:09:45 kls Exp $ */ #include "eitscan.h" @@ -12,6 +12,7 @@ #include "channels.h" #include "dvbdevice.h" #include "skins.h" +#include "transfer.h" // --- cScanData ------------------------------------------------------------- @@ -139,48 +140,44 @@ void cEITScanner::Process(void) transponderList = NULL; } } - for (bool AnyDeviceSwitched = false; !AnyDeviceSwitched; ) { - cScanData *ScanData = NULL; - for (int i = 0; i < cDevice::NumDevices(); i++) { - if (ScanData || (ScanData = scanList->First()) != NULL) { - cDevice *Device = cDevice::GetDevice(i); - if (Device) { - if (Device != cDevice::PrimaryDevice() || (cDevice::NumDevices() == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) { - if (!(Device->Receiving(true) || Device->Replaying())) { - const cChannel *Channel = ScanData->GetChannel(); - if (Channel) { - if ((!Channel->Ca() || Channel->Ca() == Device->DeviceNumber() + 1 || Channel->Ca() >= 0x0100) && Device->ProvidesTransponder(Channel)) { - if (Device == cDevice::PrimaryDevice() && !currentChannel) { + bool AnyDeviceSwitched = false; + for (int i = 0; i < cDevice::NumDevices(); i++) { + cDevice *Device = cDevice::GetDevice(i); + if (Device) { + for (cScanData *ScanData = scanList->First(); ScanData; ScanData = scanList->Next(ScanData)) { + const cChannel *Channel = ScanData->GetChannel(); + if (Channel) { + if (!Channel->Ca() || Channel->Ca() == Device->DeviceNumber() + 1 || Channel->Ca() >= 0x0100) { + if (Device->ProvidesTransponder(Channel)) { + if (!Device->Receiving()) { + if (Device != cDevice::ActualDevice() || (Device->ProvidesTransponderExclusively(Channel) && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) { + if (Device == cDevice::ActualDevice() && !currentChannel) { + if (cTransferControl::ReceiverDevice()) + cDevice::PrimaryDevice()->StopReplay(); // stop transfer mode currentChannel = Device->CurrentChannel(); Skins.Message(mtInfo, tr("Starting EPG scan")); } currentDevice = Device;//XXX see also dvbdevice.c!!! + //dsyslog("EIT scan: device %d source %-8s tp %5d", Device->DeviceNumber() + 1, *cSource::ToString(Channel->Source()), Channel->Transponder()); Device->SwitchChannel(Channel, false); currentDevice = NULL; scanList->Del(ScanData); - ScanData = NULL; AnyDeviceSwitched = true; + break; } } } } } } - else - break; - } - if (ScanData && !AnyDeviceSwitched) { - scanList->Del(ScanData); - ScanData = NULL; - } - if (!scanList->Count()) { - delete scanList; - scanList = NULL; - if (lastActivity == 0) // this was a triggered scan - Activity(); - break; } } + if (!scanList->Count() || !AnyDeviceSwitched) { + delete scanList; + scanList = NULL; + if (lastActivity == 0) // this was a triggered scan + Activity(); + } Channels.Unlock(); } lastScan = time(NULL); -- cgit v1.2.3