summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'device.c')
-rw-r--r--device.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/device.c b/device.c
index 663f91ad..0452edc1 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 2.55 2012/03/03 11:43:05 kls Exp $
+ * $Id: device.c 2.56 2012/03/06 12:32:38 kls Exp $
*/
#include "device.h"
@@ -68,7 +68,6 @@ int cDevice::nextCardIndex = 0;
int cDevice::currentChannel = 1;
cDevice *cDevice::device[MAXDEVICES] = { NULL };
cDevice *cDevice::primaryDevice = NULL;
-cDevice *cDevice::avoidDevice = NULL;
cList<cDeviceHook> cDevice::deviceHooks;
cDevice::cDevice(void)
@@ -228,8 +227,6 @@ static int GetClippedNumProvidedSystems(int AvailableBits, cDevice *Device)
cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView, bool Query)
{
- cDevice *AvoidDevice = avoidDevice;
- avoidDevice = NULL;
// Collect the current priorities of all CAM slots that can decrypt the channel:
int NumCamSlots = CamSlots.Count();
int SlotPriority[NumCamSlots];
@@ -259,8 +256,6 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView
if (NumUsableSlots && SlotPriority[j] > MAXPRIORITY)
continue; // there is no CAM available in this slot
for (int i = 0; i < numDevices; i++) {
- if (device[i] == AvoidDevice)
- continue; // this device shall be temporarily avoided
if (Channel->Ca() && Channel->Ca() <= CA_DVB_MAX && Channel->Ca() != device[i]->CardIndex() + 1)
continue; // a specific card was requested, but not this one
if (NumUsableSlots && !CamSlots.Get(j)->Assign(device[i], true))
@@ -319,6 +314,26 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView
return d;
}
+cDevice *cDevice::GetDeviceForTransponder(const cChannel *Channel, int Priority)
+{
+ cDevice *Device = NULL;
+ for (int i = 0; i < cDevice::NumDevices(); i++) {
+ if (cDevice *d = cDevice::GetDevice(i)) {
+ if (d->IsTunedToTransponder(Channel))
+ return d; // if any device is tuned to the transponder, we're done
+ if (d->ProvidesTransponder(Channel)) {
+ if (d->MaySwitchTransponder(Channel))
+ Device = d; // this device may switch to the transponder without disturbing any receiver or live view
+ else if (!d->Occupied()) {
+ if (d->Priority() < Priority && (!Device || d->Priority() < Device->Priority()))
+ Device = d; // use this one only if no other with less impact can be found
+ }
+ }
+ }
+ }
+ return Device;
+}
+
bool cDevice::HasCi(void)
{
return false;