[vdr] VDR Maintenance Patch 1.4.0-2 and Livebuffer

Chad Flynt hoochster at sofnet.com
Fri Jun 2 16:31:13 CEST 2006


Hello,

I am not a programmer, but I am trying to fix the LiveBuffer patch for 
the Maintenance Patch 1.4.0-2.  There is a section that was changed and 
I am not quite sure how to address it.

The Maintenance patch changes the following in the device.c file.  It 
might have more reference somewhere else that leads up to this, but this 
is the part I see that is different.

@@ -281,32 +281,20 @@
 cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool 
*NeedsDetachReceivers)
 {
   cDevice *d = NULL;
-  int select = INT_MAX;
-
+  uint Impact = 0xFFFFFFFF;
   for (int i = 0; i < numDevices; i++) {
       bool ndr;
       if (device[i]->ProvidesChannel(Channel, Priority, &ndr)) { // 
this device is basicly able to do the job
-         int pri;
-         if (device[i]->Receiving() && !ndr)
-            pri = 0; // receiving and allows additional receivers
-         else if (!device[i]->Receiving(true) && d && 
device[i]->ProvidesCa(Channel) < d->ProvidesCa(Channel))
-            pri = 1; // free and fewer Ca's
-         else if (!device[i]->Receiving() && !device[i]->HasDecoder())
-            pri = 2; // free and not a full featured card
-         else if (!device[i]->Receiving() && device[i] != ActualDevice())
-            pri = 3; // free and not the actual device
-         else if (!device[i]->Receiving() && !device[i]->IsPrimaryDevice())
-            pri = 4; // free and not the primary device
-         else if (!device[i]->Receiving())
-            pri = 5; // free
-         else if (d && device[i]->Priority() < d->Priority())
-            pri = 6; // receiving but priority is lower
-         else if (d && device[i]->Priority() == d->Priority() && 
device[i]->ProvidesCa(Channel) < d->ProvidesCa(Channe$
-            pri = 7; // receiving with same priority but fewer Ca's
-         else
-            pri = 8; // all others
-         if (pri <= select) {
-            select = pri;
+         uint imp = 0;
+         imp <<= 1; imp |= !device[i]->Receiving() || ndr;
+         imp <<= 1; imp |= device[i]->Receiving();
+         imp <<= 1; imp |= device[i] == ActualDevice();
+         imp <<= 1; imp |= device[i]->IsPrimaryDevice();
+         imp <<= 1; imp |= device[i]->HasDecoder();
+         imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 
0), 0xFF);
+         imp <<= 8; imp |= min(max(device[i]->ProvidesCa(Channel), 0), 
0xFF);
+         if (imp < Impact) {
+            Impact = imp;
             d = device[i];
             if (NeedsDetachReceivers)
                *NeedsDetachReceivers = ndr;

I know that some lines didn't paste fully but you should see what the 
difference is.  And the Livebuffer patch is wanting to do the following:


*** 291,301 ****
           else if (d && !device[i]->Receiving() && 
device[i]->ProvidesCa(Channel) < d->ProvidesCa(Channel))
              pri = 1; // free and fewer Ca's
           else if (!device[i]->Receiving() && !device[i]->HasDecoder())
-             pri = 2; // free and not a full featured card
           else if (!device[i]->Receiving() && 
!device[i]->IsPrimaryDevice())
-             pri = 3; // free and not the primary device
           else if (!device[i]->Receiving())
-             pri = 4; // free
           else if (d && device[i]->Priority() < d->Priority())
              pri = 5; // receiving but priority is lower
           else if (d && device[i]->Priority() == d->Priority() && 
device[i]->ProvidesCa(Channel) < d->ProvidesCa(Chann$
--- 294,304 ----
           else if (d && !device[i]->Receiving() && 
device[i]->ProvidesCa(Channel) < d->ProvidesCa(Channel))
              pri = 1; // free and fewer Ca's
           else if (!device[i]->Receiving() && !device[i]->HasDecoder())
+             pri = LiveView ? 3 : 2; // free and not a full featured card
           else if (!device[i]->Receiving() && 
!device[i]->IsPrimaryDevice())
+             pri = LiveView ? 4 : 3; // free and not the primary device
           else if (!device[i]->Receiving())
+             pri = LiveView ? 2 : 4; // free
           else if (d && device[i]->Priority() < d->Priority())
              pri = 5; // receiving but priority is lower
           else if (d && device[i]->Priority() == d->Priority() && 
device[i]->ProvidesCa(Channel) < d->ProvidesCa(Chann$
***************

Any ideas on how that translates on the way the new Maint patch is 
handling it would be much appreciated.  I was hoping the author would 
put out a new patch for 1.4.0 but I haven't seen it yet, and probably a 
good thing being as the Maint patch changed things up a big heh! 



More information about the vdr mailing list