correct calculation of differences for cable params
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sat, 25 Feb 2006 04:54:02 +0000 (04:54 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sat, 25 Feb 2006 04:54:02 +0000 (04:54 +0000)
lib/dvb/frontend.cpp

index c8434c0..a7f0c70 100644 (file)
@@ -199,8 +199,15 @@ RESULT eDVBFrontendParameters::calculateDifference(const iDVBFrontendParameters
                if (parm->getDVBC(ocable))
                        return -2;
                
                if (parm->getDVBC(ocable))
                        return -2;
                
-               diff = abs(cable.frequency - ocable.frequency);
-               diff += abs(cable.symbol_rate - ocable.symbol_rate);
+               if (cable.modulation != ocable.modulation && cable.modulation != eDVBFrontendParametersCable::Modulation::Auto && ocable.modulation != eDVBFrontendParametersCable::Modulation::Auto)
+                       diff = 1 << 29;
+               else if (cable.inversion != ocable.inversion && cable.inversion != eDVBFrontendParametersCable::Inversion::Unknown && ocable.inversion != eDVBFrontendParametersCable::Inversion::Unknown)
+                       diff = 1 << 28;
+               else
+               {
+                       diff = abs(cable.frequency - ocable.frequency);
+                       diff += abs(cable.symbol_rate - ocable.symbol_rate);
+               }
                
                return 0;
        case iDVBFrontend::feTerrestrial:
                
                return 0;
        case iDVBFrontend::feTerrestrial: