Hi,

This patch is for vdr users's which have several cards.

He changes the device selection, by adding two factors in the 'impact' choice :
- prefering a already tuned device
- the last usage time of device

So, all devices are used and zapping time is reduce.

Works better when eitscanner is disable.

Regards,

JLac
diff -bBurN vdr-1.7.7-orig/device.c vdr-1.7.7/device.c
--- vdr-1.7.7-orig/device.c	2009-05-02 14:17:39.000000000 +0200
+++ vdr-1.7.7/device.c	2009-05-10 18:52:27.000000000 +0200
@@ -84,6 +84,7 @@
 
   camSlot = NULL;
   startScrambleDetection = 0;
+  startReceiving = 0;
 
   player = NULL;
   isPlayingVideo = false;
@@ -264,6 +265,11 @@
              // to their individual severity, where the one listed first will make the most
              // difference, because it results in the most significant bit of the result.
              uint32_t imp = 0;
+
+             imp <<= 1; imp |= device[i]->IsTunedToTransponder(Channel) ? 0 : 1; // prefer device already tune
+             int t=((time(NULL)-device[i]->startReceiving)/16);
+             imp <<= 4;  imp |= t > 0x0f ? 0 : 0x0f-t;							 // sort devices by last time usage 
+
              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
@@ -290,6 +296,7 @@
          break; // no CAM necessary, so just one loop over the devices
       }
   if (d) {
+     d->startReceiving = time(NULL);
      if (NeedsDetachReceivers)
         d->DetachAllReceivers();
      if (s) {
diff -bBurN vdr-1.7.7-orig/device.h vdr-1.7.7/device.h
--- vdr-1.7.7-orig/device.h	2009-05-02 14:16:20.000000000 +0200
+++ vdr-1.7.7/device.h	2009-05-10 18:49:00.000000000 +0200
@@ -340,6 +340,7 @@
 
 private:
   time_t startScrambleDetection;
+  time_t startReceiving;
   cCamSlot *camSlot;
 public:
   virtual bool HasCi(void);
_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to