diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2008-04-12 13:39:12 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2008-04-12 13:39:12 +0200 |
commit | e59c6ac433e50f76986331a3ff2e610e60ddf4b5 (patch) | |
tree | 9e8139ac41547046bfdb969243b775da464a5102 /device.c | |
parent | 0b82b38533792023097a47371b594075cdfb44aa (diff) | |
download | vdr-e59c6ac433e50f76986331a3ff2e610e60ddf4b5.tar.gz vdr-e59c6ac433e50f76986331a3ff2e610e60ddf4b5.tar.bz2 |
Re-implemented handling of DVB-S2
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.157 2008/03/09 10:03:34 kls Exp $ + * $Id: device.c 2.1 2008/04/12 11:15:32 kls Exp $ */ #include "device.h" @@ -355,6 +355,21 @@ cDevice *cDevice::GetDevice(int Index) return (0 <= Index && Index < numDevices) ? device[Index] : NULL; } +static int GetClippedNumProvidedSystems(int AvailableBits, cDevice *Device) +{ + int MaxNumProvidedSystems = 1 << AvailableBits; + int NumProvidedSystems = Device->NumProvidedSystems(); + if (NumProvidedSystems > MaxNumProvidedSystems) { + esyslog("ERROR: device %d supports %d modulation systems but cDevice::GetDevice() currently only supports %d delivery systems which should be fixed", Device->CardIndex() + 1, NumProvidedSystems, MaxNumProvidedSystems); + NumProvidedSystems = MaxNumProvidedSystems; + } + else if (NumProvidedSystems <= 0) { + esyslog("ERROR: device %d reported an invalid number (%d) of supported delivery systems - assuming 1", Device->CardIndex() + 1, NumProvidedSystems); + NumProvidedSystems = 1; + } + return NumProvidedSystems; +} + cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView) { cDevice *AvoidDevice = avoidDevice; @@ -408,6 +423,7 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView imp <<= 1; imp |= LiveView ? !device[i]->IsPrimaryDevice() || ndr : 0; // prefer the primary device for live viewing if we don't need to detach existing receivers imp <<= 1; imp |= !device[i]->Receiving() && (device[i] != cTransferControl::ReceiverDevice() || device[i]->IsPrimaryDevice()) || ndr; // use receiving devices if we don't need to detach existing receivers, but avoid primary device in local transfer mode imp <<= 1; imp |= device[i]->Receiving(); // avoid devices that are receiving + imp <<= 2; imp |= GetClippedNumProvidedSystems(2, device[i]) - 1; // avoid cards which support multiple delivery systems imp <<= 1; imp |= device[i] == cTransferControl::ReceiverDevice(); // avoid the Transfer Mode receiver device imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used) imp <<= 8; imp |= min(max((NumUsableSlots ? SlotPriority[j] : 0) + MAXPRIORITY, 0), 0xFF); // use the CAM slot with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used) @@ -712,6 +728,11 @@ bool cDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *Needs return false; } +int cDevice::NumProvidedSystems(void) const +{ + return 0; +} + bool cDevice::IsTunedToTransponder(const cChannel *Channel) { return false; |