Index: libs/libmythtv/firewirechannel.cpp
===================================================================
--- libs/libmythtv/firewirechannel.cpp	(wersja 18962)
+++ libs/libmythtv/firewirechannel.cpp	(kopia robocza)
@@ -60,6 +60,7 @@
 
     // Fetch tuning data from the database.
     QString tvformat, modulation, freqtable, freqid, dtv_si_std;
+    QString msystem, rolloff;
     int finetune;
     uint64_t frequency;
     int mpeg_prog_num;
@@ -70,6 +71,7 @@
         tvformat, modulation, freqtable, freqid,
         finetune, frequency,
         dtv_si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
+	msyste, rolloff,
         mplexid, commfree))
     {
         VERBOSE(VB_IMPORTANT, loc + " " + QString(
Index: libs/libmythtv/dtvconfparserhelpers.h
===================================================================
--- libs/libmythtv/dtvconfparserhelpers.h	(wersja 18962)
+++ libs/libmythtv/dtvconfparserhelpers.h	(kopia robocza)
@@ -33,6 +33,7 @@
 #define _DTVCONFPARSERHELPERS_H_
 
 #include <qstring.h>
+#include <dvbtypes.h>
 
 // The following are a set of helper classes to allow easy translation
 // between the different string representations of various tuning params.
@@ -191,7 +192,7 @@
     static const DTVParamHelperStruct confTable[];
     static const DTVParamHelperStruct vdrTable[];
     static const DTVParamHelperStruct parseTable[];
-    static const uint kDBStrCnt = 10;
+    static const uint kDBStrCnt = 12;
     static const char *dbStr[kDBStrCnt];
 
   public:
@@ -207,6 +208,8 @@
         kFEC_7_8,
         kFEC_8_9,
         kFECAuto,
+	kFEC_3_5,
+	kFEC_9_10,
     };
 
     DTVCodeRate(int _default = kFECAuto) : DTVParamHelper(_default) { }
@@ -236,23 +239,20 @@
   public:
     enum
     {
-        kModulationQPSK    = 0,
-        kModulationQAM16   = 1,
-        kModulationQAM32   = 2,
-        kModulationQAM64   = 3,
-        kModulationQAM128  = 4,
-        kModulationQAM256  = 5,
-        kModulationQAMAuto = 6,
-        kModulation8VSB    = 7,
-        kModulation16VSB   = 8,
-        kModulation2VSB    = 9,
-        kModulation4VSB    = 10,
-        kModulationBPSK    = 11,
-        kModulation16APSK  = 12,
-        kModulation32APSK  = 13,
-        kModulation8PSK    = 14,
-        kModulation16PSK   = 15,
-        kModulationAnalog  = 16, /* for analog channel scanner */
+        kModulationQPSK,
+        kModulationQAM16,
+        kModulationQAM32,
+        kModulationQAM64,
+        kModulationQAM128,
+        kModulationQAM256,
+        kModulationQAMAuto,
+        kModulation8VSB,
+        kModulation16VSB,
+	kModulation8PSK,
+	kModulation16APSK,
+        kModulation32APSK,
+	kModulationDQPSK,
+        kModulationAnalog  = 99, /* for analog channel scanner */
     };
 
     DTVModulation(int _default = kModulationQAMAuto)
@@ -414,4 +414,99 @@
         { return DTVParamHelper::toString(dbStr, _value, kDBStrCnt); }
 };
 
+class DTVModulationSystem : public DTVParamHelper
+{
+  protected:
+    static const DTVParamHelperStruct confTable[];
+    static const DTVParamHelperStruct vdrTable[];
+    static const DTVParamHelperStruct parseTable[];
+    static const uint kDBStrCnt = 2;
+    static const char *dbStr[kDBStrCnt];
+
+  public:
+    enum
+    {
+        kModulationSystemDVBS,
+	kModulationSystemDVBS2,
+    };
+
+    DTVModulationSystem(int _default = kModulationSystemDVBS)
+        : DTVParamHelper(_default) { }
+
+    bool ParseConf(const QString &_value)
+       { return ParseParam(_value, value, confTable); }
+    bool ParseVDR(const QString &_value)
+       { return ParseParam(_value, value, vdrTable); }
+    bool Parse(const QString &_value)
+       { return ParseParam(_value, value, parseTable); }
+
+    QString toString() const { return toString(value); }
+
+    static QString toString(int _value)
+        { return DTVParamHelper::toString(dbStr, _value, kDBStrCnt); }
+};
+
+class DTVRollOff : public DTVParamHelper
+{
+  protected:
+    static const DTVParamHelperStruct confTable[];
+    static const DTVParamHelperStruct vdrTable[];
+    static const DTVParamHelperStruct parseTable[];
+    static const uint kDBStrCnt = 4;
+    static const char *dbStr[kDBStrCnt];
+
+  public:
+    enum
+    {
+        kRollOff35,
+	kRollOff20,
+	kRollOff25,
+	kRollOffAuto,
+    };
+
+    DTVRollOff(int _default = kRollOff35)
+        : DTVParamHelper(_default) { }
+
+    bool ParseConf(const QString &_value)
+       { return ParseParam(_value, value, confTable); }
+    bool ParseVDR(const QString &_value)
+       { return ParseParam(_value, value, vdrTable); }
+    bool Parse(const QString &_value)
+       { return ParseParam(_value, value, parseTable); }
+
+    QString toString() const { return toString(value); }
+
+    static QString toString(int _value)
+        { return DTVParamHelper::toString(dbStr, _value, kDBStrCnt); }
+};
+
+class DTVPilot : public DTVParamHelper
+{
+  protected:
+    static const DTVParamHelperStruct confTable[];
+    static const DTVParamHelperStruct vdrTable[];
+    static const DTVParamHelperStruct parseTable[];
+    static const uint kDBStrCnt = 3;
+    static const char *dbStr[kDBStrCnt];
+
+  public:
+    enum
+    {
+        kPilotOn,
+	kPilotOff,
+	kPilotAuto,
+    };
+
+    DTVPilot(int _default = kPilotAuto)
+        : DTVParamHelper(_default) { }
+
+    bool ParseConf(const QString &_value)
+       { return ParseParam(_value, value, confTable); }
+
+    QString toString() const { return toString(value); }
+
+    static QString toString(int _value)
+        { return DTVParamHelper::toString(dbStr, _value, kDBStrCnt); }
+};
+
 #endif // _DTVCONFPARSERHELPERS_H_
Index: libs/libmythtv/channelscan/scaninfo.cpp
===================================================================
--- libs/libmythtv/channelscan/scaninfo.cpp	(wersja 18962)
+++ libs/libmythtv/channelscan/scaninfo.cpp	(kopia robocza)
@@ -76,7 +76,8 @@
         "       hp_code_rate,      lp_code_rate,   modulation, "
         "       transmission_mode, guard_interval, hierarchy, "
         "       modulation,        bandwidth,      sistandard, "
-        "       tuner_type,        transportid "
+        "       tuner_type,        transportid, "
+	"       msystem,           rolloff "
         "FROM channelscan_dtv_multiplex "
         "WHERE scanid = :SCANID");
     query.bindValue(":SCANID", scanid);
@@ -97,7 +98,8 @@
             query.value(6).toString(),  query.value(7).toString(),
             query.value(8).toString(),  query.value(9).toString(),
             query.value(10).toString(), query.value(11).toString(),
-            query.value(12).toString());
+            query.value(12).toString(), query.value(16).toString(),
+	    query.value(17).toString());
 
         query2.prepare(
             "SELECT "
Index: libs/libmythtv/channelscan/channelscan_sm.cpp
===================================================================
--- libs/libmythtv/channelscan/channelscan_sm.cpp	(wersja 18962)
+++ libs/libmythtv/channelscan/channelscan_sm.cpp	(kopia robocza)
@@ -1439,7 +1439,8 @@
             startChan["coderate_hp"],    startChan["coderate_lp"],
             startChan["constellation"],  startChan["trans_mode"],
             startChan["guard_interval"], startChan["hierarchy"],
-            startChan["modulation"],     startChan["bandwidth"]);
+            startChan["modulation"],     startChan["bandwidth"],
+	    startChan["msystem"],        startChan["rolloff"]);
     }
 
     if (ok)
Index: libs/libmythtv/channelscan/modulationsetting.h
===================================================================
--- libs/libmythtv/channelscan/modulationsetting.h	(wersja 18962)
+++ libs/libmythtv/channelscan/modulationsetting.h	(kopia robocza)
@@ -58,9 +58,7 @@
     {
         addSelection(QObject::tr("Auto"),"auto",true);
         addSelection("QPSK","qpsk");
-#ifdef FE_GET_EXTENDED_INFO
         addSelection("8PSK","8psk");
-#endif
         addSelection("QAM 16","qam_16");
         addSelection("QAM 32","qam_32");
         addSelection("QAM 64","qam_64");
Index: libs/libmythtv/channelscan/channelscanmiscsettings.h
===================================================================
--- libs/libmythtv/channelscan/channelscanmiscsettings.h	(wersja 18962)
+++ libs/libmythtv/channelscan/channelscanmiscsettings.h	(kopia robocza)
@@ -151,6 +151,9 @@
         addSelection("6/7");
         addSelection("7/8");
         addSelection("8/9");
+	addSelection("3/5");
+	addSelection("4/5");
+	addSelection("9/10");
     }
 };
 
@@ -165,6 +168,38 @@
     }
 };
 
+class ScanModulationSystem: public ComboBoxSetting, public TransientStorage
+{
+  public:
+    ScanModulationSystem() : ScanModulationSystemSetting(this)
+    {
+        setLabel(QObject::tr("Modul. System"));
+        setHelpText(QObject::tr("Modulation System (Default: DVB-S)"));
+	addSelection("DVB-S","dvbs",true);
+        addSelection("DVB-S2","dvbs2");
+    };
+};
+
+
+class ScanRollOff: public ComboBoxSetting
+{
+  public:
+    ScanRollOff(Storage *_storage) : ComboBoxSetting(_storage)
+    {
+	setLabel(QObject::tr("Roll-off"));
+        setHelpText(QObject::tr(
+                        "Roll-off (Default: Auto):\n"
+                        "The  DVB-S2  standard  in  addition \n"
+			" to  the  single  DVB-S    35%  roll-off\n"
+			" factor,  provides  two  additional roll-off\n"
+			" factors to further increase transponder efficiency"));
+        addSelection(QObject::tr("Auto"),"auto");
+        addSelection("0.35","0.35",true);
+        addSelection("0.20");
+        addSelection("0.25");
+    }
+};
+
 class ScanCodeRateLP: public ScanFecSetting, public TransientStorage
 {
   public:
Index: libs/libmythtv/channelscan/channelscanner.cpp
===================================================================
--- libs/libmythtv/channelscan/channelscanner.cpp	(wersja 18962)
+++ libs/libmythtv/channelscan/channelscanner.cpp	(kopia robocza)
@@ -143,6 +143,7 @@
     }
     else if ((ScanTypeSetting::NITAddScan_DVBT == scantype) ||
              (ScanTypeSetting::NITAddScan_DVBS == scantype) ||
+ 	     (ScanTypeSetting::NITAddScan_DVBS2 == scantype) ||	     
              (ScanTypeSetting::NITAddScan_DVBC == scantype))
     {
         VERBOSE(VB_SIPARSER, LOC + "ScanTransports()");
@@ -219,6 +220,7 @@
     DTVConfParser::cardtype_t type = DTVConfParser::UNKNOWN;
     type = (CardUtil::DVBT == cardtype) ? DTVConfParser::OFDM : type;
     type = (CardUtil::QPSK == cardtype) ? DTVConfParser::QPSK : type;
+    type = (CardUtil::DVBS2 == cardtype) ? DTVConfParser::DVBS2 : type;
     type = (CardUtil::DVBC == cardtype) ? DTVConfParser::QAM  : type;
     type = ((CardUtil::ATSC == cardtype) ||
             (CardUtil::HDHOMERUN == cardtype)) ? DTVConfParser::ATSC : type;
@@ -302,6 +304,7 @@
         QString sub_type = CardUtil::ProbeDVBType(device.toUInt()).upper();
         bool need_nit = (("QAM"  == sub_type) ||
                          ("QPSK" == sub_type) ||
+			 ("DVB_S2" == sub_type) ||
                          ("OFDM" == sub_type));
 
         // Ugh, Some DVB drivers don't fully support signal monitoring...
Index: libs/libmythtv/channelscan/panedvbs2.h
===================================================================
--- libs/libmythtv/channelscan/panedvbs2.h	(wersja 18962)
+++ libs/libmythtv/channelscan/panedvbs2.h	(kopia robocza)
@@ -22,9 +22,11 @@
         left->addChild( pfrequency  = new ScanFrequency());
         left->addChild( ppolarity   = new ScanPolarity());
         left->addChild( psymbolrate = new ScanSymbolRate());
-        right->addChild(pfec        = new ScanFec());
+        left->addChild( pfec        = new ScanFec());
+	right->addChild(pmsystem    = new ScanModulationSystem());
         right->addChild(pmodulation = new ScanModulation());
         right->addChild(pinversion  = new ScanInversion());
+	right->addChild(prolloff    = new ScanRollOff());
         addChild(left);
         addChild(right);     
     }
@@ -35,14 +37,18 @@
     QString fec(void)        const { return pfec->getValue();        }
     QString polarity(void)   const { return ppolarity->getValue();   }
     QString modulation(void) const { return pmodulation->getValue(); }
+    QString rolloff(void)    const { return prolloff->getValue();     }
+    QString msystem(void)    const { return pmsystem->getValue();     }
 
   protected:
-    ScanFrequency  *pfrequency;
-    ScanSymbolRate *psymbolrate;
-    ScanInversion  *pinversion;
-    ScanFec        *pfec;
-    ScanPolarity   *ppolarity;
-    ScanModulation *pmodulation;
+    ScanFrequency           *pfrequency;
+    ScanSymbolRate          *psymbolrate;
+    ScanInversion           *pinversion;
+    ScanFec                 *pfec;
+    ScanPolarity            *ppolarity;
+    ScanModulation          *pmodulation;
+    ScanRollOff             *prolloff;
+    ScanModulationSystem    *pmsystem;
 };
 
 #endif // _PANE_DVBS2_H_
Index: libs/libmythtv/channelscan/scanwizardconfig.cpp
===================================================================
--- libs/libmythtv/channelscan/scanwizardconfig.cpp	(wersja 18962)
+++ libs/libmythtv/channelscan/scanwizardconfig.cpp	(kopia robocza)
@@ -133,6 +133,12 @@
         addSelection(tr("Import channels.conf"),
                      QString::number(DVBUtilsImport));
         break;
+    case CardUtil::DVBS2:
+        addSelection(tr("Full Scan (Tuned)"),
+                     QString::number(NITAddScan_DVBS2));
+        addSelection(tr("Import channels.conf"),
+                     QString::number(DVBUtilsImport));
+        break;
     case CardUtil::QAM:
         addSelection(tr("Full Scan (Tuned)"),
                      QString::number(NITAddScan_DVBC));
@@ -329,6 +335,19 @@
         startChan["modulation"] = "qpsk";
         startChan["polarity"]   = pane->polarity();
     }
+    else if (ScanTypeSetting::NITAddScan_DVBS2 == st)
+    {
+        const PaneDVBS2 *pane = paneDVBS2;
+
+        startChan["std"]        = "dvb";
+        startChan["frequency"]  = pane->frequency();
+        startChan["inversion"]  = pane->inversion();
+        startChan["symbolrate"] = pane->symbolrate();
+        startChan["fec"]        = pane->fec();
+        startChan["modulation"] = pane->modulation();;
+        startChan["polarity"]   = pane->polarity();
+	startChan["rolloff"]    = pane->rolloff();
+    }
     else if (ScanTypeSetting::NITAddScan_DVBC == st)
     {
         const PaneDVBC *pane = paneDVBC;
Index: libs/libmythtv/dtvconfparserhelpers.cpp
===================================================================
--- libs/libmythtv/dtvconfparserhelpers.cpp	(wersja 18962)
+++ libs/libmythtv/dtvconfparserhelpers.cpp	(kopia robocza)
@@ -69,10 +69,10 @@
     { "QAM",     kTunerTypeQAM     },
     { "OFDM",    kTunerTypeOFDM    },
     { "ATSC",    kTunerTypeATSC    },
+    { "DVB_S2",  kTunerTypeDVB_S2  },    
     { "DVB_S",   kTunerTypeDVB_S   },
     { "DVB_C",   kTunerTypeDVB_C   },
     { "DVB_T",   kTunerTypeDVB_T   },
-    { "DVB_S2",  kTunerTypeDVB_S2  },
     { "UNKNOWN", kTunerTypeUnknown },
     { NULL,      kTunerTypeUnknown },
 };
@@ -149,11 +149,13 @@
     { "FEC_1_2",  kFEC_1_2  },
     { "FEC_2_3",  kFEC_2_3  },
     { "FEC_3_4",  kFEC_3_4  },
+    { "FEC_3_5",  kFEC_3_5  },
     { "FEC_4_5",  kFEC_4_5  },
     { "FEC_5_6",  kFEC_5_6  },
     { "FEC_6_7",  kFEC_6_7  },
     { "FEC_7_8",  kFEC_7_8  },
     { "FEC_8_9",  kFEC_8_9  },
+    { "FEC_9_10", kFEC_9_10  },
     { "FEC_NONE", kFECNone },
     { NULL,       kFECAuto },
 };
@@ -164,11 +166,13 @@
     { "12",  kFEC_1_2 },
     { "23",  kFEC_2_3 },
     { "34",  kFEC_3_4 },
+    { "35",  kFEC_3_5 },
     { "45",  kFEC_4_5 },
     { "56",  kFEC_5_6 },
     { "67",  kFEC_6_7 },
     { "78",  kFEC_7_8 },
     { "89",  kFEC_8_9 },
+    { "910",  kFEC_9_10 },
     { "0",   kFECNone },
     { NULL,  kFECAuto }
 };
@@ -179,11 +183,13 @@
     { "1/2",  kFEC_1_2 },
     { "2/3",  kFEC_2_3 },
     { "3/4",  kFEC_3_4 },
+    { "3/5",  kFEC_3_5 },
     { "4/5",  kFEC_4_5 },
     { "5/6",  kFEC_5_6 },
     { "6/7",  kFEC_6_7 },
     { "7/8",  kFEC_7_8 },
     { "8/9",  kFEC_8_9 },
+    { "9/10", kFEC_9_10 },
     { "none", kFECNone },
     { NULL,   kFECAuto }
 };
@@ -199,7 +205,9 @@
      "6/7",  ///< kFEC_6_7
      "7/8",  ///< kFEC_7_8
      "8/9",  ///< kFEC_8_9
-     "auto"  ///< kFECAuto
+     "auto", ///< kFECAuto
+     "3/5",  ///< kFEC_3_5
+     "9/10", ///< kFEC_9_10
 };
 
 const DTVParamHelperStruct DTVModulation::confTable[] =
@@ -213,14 +221,11 @@
    { "QPSK",     kModulationQPSK    },
    { "8VSB",     kModulation8VSB    },
    { "16VSB",    kModulation16VSB   },
-   { "2VSB",     kModulation2VSB    },
-   { "4VSB",     kModulation4VSB    },
-   { "BPSK",     kModulationBPSK    },
    { "16APSK",   kModulation16APSK  },
    { "32APSK",   kModulation32APSK  },
    { "8PSK",     kModulation8PSK    },
-   { "16PSK",    kModulation16PSK   },
-   { "analog",   kModulation16PSK   },
+   { "DQPSK",    kModulationDQPSK   },
+   { "analog",   kModulationAnalog  },
    { NULL,       kModulationQAMAuto },
 };
 
@@ -232,6 +237,12 @@
    { "64",  kModulationQAM64   },
    { "128", kModulationQAM128  },
    { "256", kModulationQAM256  },
+   { "2",   kModulationQPSK    },
+   { "10",  kModulation8VSB    },
+   { "11",  kModulation16VSB   },
+   { "6",   kModulation16APSK  },
+   { "7",   kModulation32APSK  },
+   { "5",   kModulation8PSK    },   
    { "0",   kModulationQPSK    },
    { NULL,  kModulationQAMAuto },
 };
@@ -247,13 +258,10 @@
    { "qpsk",     kModulationQPSK    },
    { "8vsb",     kModulation8VSB    },
    { "16vsb",    kModulation16VSB   },
-   { "2vsb",     kModulation2VSB    },
-   { "4vsb",     kModulation4VSB    },
-   { "bpsk",     kModulationBPSK    },
    { "16apsk",   kModulation16APSK  },
    { "32apsk",   kModulation32APSK  },
    { "8psk",     kModulation8PSK    },
-   { "16psk",    kModulation16PSK   },
+   { "dqpsk",    kModulationDQPSK   },
    // alternates
    { "a",        kModulationQAMAuto },
    { "qam_auto", kModulationQAMAuto },
@@ -262,16 +270,14 @@
    { "qam-64",   kModulationQAM64   },
    { "qam-128",  kModulationQAM128  },
    { "qam-256",  kModulationQAM256  },
-   // qpsk, no alternative
    { "8-vsb",    kModulation8VSB    },
    { "16-vsb",   kModulation16VSB   },
-   { "2-vsb",    kModulation2VSB    },
-   { "4-vsb",    kModulation4VSB    },
-   // bpsk, no alternative
    { "16-apsk",  kModulation16APSK  },
    { "32-apsk",  kModulation32APSK  },
    { "8-psk",    kModulation8PSK    },
-   { "16-psk",   kModulation16PSK   },
+   { "16psk",    kModulationDQPSK   },
+   { "16-psk",   kModulationDQPSK   },   
+   { "dq-psk",   kModulationDQPSK   },
    { NULL,       kModulationQAMAuto },
 };
 
@@ -286,13 +292,10 @@
     "auto",    ///< kModulationQAMAuto
     "8vsb",    ///< kModulation8VSB
     "16vsb",   ///< kModulation16VSB
-    "2vsb",    ///< kModulation2VSB
-    "4vsb",    ///< kModulation4VSB
-    "bpsk",    ///< kModulationBPSK
+    "8psk",    ///< kModulation8PSK
     "16apsk",  ///< kModulation16APSK
     "32apsk",  ///< kModulation32APSK
-    "8psk",    ///< kModulation8PSK
-    "16psk",   ///< kModulation16PSK
+    "dqpsk",   ///< kModulationDQPSK
 };
 
 const DTVParamHelperStruct DTVTransmitMode::confTable[] =
@@ -420,3 +423,65 @@
    "r", ///< kPolarityRight
    "l"  ///< kPolarityLeft
 };
+
+const DTVParamHelperStruct DTVModulationSystem::confTable[] =
+{
+   { "SYS_DVBS",  kModulationSystemDVBS  },
+   { "SYS_DVBS2", kModulationSystemDVBS2 },
+   { NULL,        kModulationSystemDVBS  },
+};
+
+const DTVParamHelperStruct DTVModulationSystem::vdrTable[] =
+{
+   { "0",  kModulationSystemDVBS  },
+   { "1",  kModulationSystemDVBS2 },
+   { NULL, kModulationSystemDVBS  },
+};
+
+const DTVParamHelperStruct DTVModulationSystem::parseTable[] =
+{
+   { "dvbs2", kModulationSystemDVBS2 },
+   { "dvbs",  kModulationSystemDVBS  },
+   { NULL,    kModulationSystemDVBS  },
+};
+
+const char *DTVModulationSystem::dbStr[DTVModulationSystem::kDBStrCnt] =
+{
+    "dvbs",  ///< kModulationSystemDVBS
+    "dvbs2", ///< kModulationSystemDVBS2
+};
+
+const DTVParamHelperStruct DTVRollOff::confTable[] =
+{
+   { "ROLLOFF_35",   kRollOff35   },
+   { "ROLLOFF_20",   kRollOff20   },
+   { "ROLLOFF_25",   kRollOff25   },
+   { "ROLLOFF_AUTO", kRollOffAuto },
+   { NULL,           kRollOffAuto },
+};
+
+const DTVParamHelperStruct DTVRollOff::vdrTable[] =
+{
+   { "35",   kRollOff35   },
+   { "20",   kRollOff20   },
+   { "25",   kRollOff25   },
+   { "0",    kRollOffAuto },
+   { NULL,   kRollOff35   },
+};
+
+const DTVParamHelperStruct DTVRollOff::parseTable[] =
+{
+   { "0.35",   kRollOff35   },
+   { "0.20",   kRollOff20   },
+   { "0.25",   kRollOff25   },
+   { "auto",   kRollOffAuto },
+   { NULL,     kRollOff35   },
+};
+
+const char *DTVRollOff::dbStr[DTVRollOff::kDBStrCnt] =
+{
+   "0.35",   ///< kRollOff35
+   "0.20",   ///< kRollOff20
+   "0.25",   ///< kRollOff25
+   "auto",   ///< kRollOffAuto
+};
Index: libs/libmythtv/dtvconfparser.cpp
===================================================================
--- libs/libmythtv/dtvconfparser.cpp	(wersja 18962)
+++ libs/libmythtv/dtvconfparser.cpp	(kopia robocza)
@@ -112,7 +112,7 @@
         {
             if ((type == OFDM) && (str == "T"))
                 ok &= ParseVDR(list, channelNo);
-            else if ((type == QPSK) && (str == "S"))
+            else if (((type == QPSK) || (type == DVBS2)) && (str == "S"))
                 ok &= ParseVDR(list, channelNo);
             else if ((type == QAM) && (str == "C"))
                 ok &= ParseVDR(list, channelNo);
@@ -121,7 +121,7 @@
             ok &= ParseConfOFDM(list);
         else if (type == ATSC)
             ok &= ParseConfATSC(list);
-        else if (type == QPSK)
+        else if ((type == QPSK) || (type == DVBS2))
             ok &= ParseConfQPSK(list);
         else if (type == QAM)
             ok &= ParseConfQAM(list);
@@ -274,6 +274,10 @@
             case 'R':
             case 'L':
                 mux.polarity.ParseVDR(ori);
+	    case 'S':
+		mux.msystem.ParseVDR(params);
+	    case 'O':
+		mux.rolloff.ParseVDR(params);
                 break;
             default:
                 return false;
Index: libs/libmythtv/dtvmultiplex.h
===================================================================
--- libs/libmythtv/dtvmultiplex.h	(wersja 18962)
+++ libs/libmythtv/dtvmultiplex.h	(kopia robocza)
@@ -48,6 +48,12 @@
         const QString &frequency,    const QString &inversion,
         const QString &symbol_rate,  const QString &fec_inner,
         const QString &modulation,   const QString &polarity);
+	
+    bool ParseDVB_S2(
+        const QString &frequency,    const QString &inversion,
+        const QString &symbol_rate,  const QString &fec_inner,
+        const QString &modulation,   const QString &polarity,
+	const QString &msystem,      const QString &rolloff);
 
     bool ParseTuningParams(
         DTVTunerType type,
@@ -55,7 +61,8 @@
         QString fec,          QString polarity,
         QString hp_code_rate, QString lp_code_rate,   QString constellation,
         QString trans_mode,   QString guard_interval, QString hierarchy,
-        QString modulation,   QString bandwidth);
+	QString modulation,   QString bandwidth,
+	QString msystem,      QString rolloff);
 
     QString toString() const;
 
@@ -74,6 +81,8 @@
     DTVHierarchy     hierarchy;
     DTVPolarity      polarity;
     DTVCodeRate      fec; ///< Inner Forward Error Correction rate
+    DTVModulationSystem msystem;
+    DTVRollOff          rolloff;
 
     // Optional additional info
     uint             mplex;
Index: libs/libmythtv/channelutil.h
===================================================================
--- libs/libmythtv/channelutil.h	(wersja 18962)
+++ libs/libmythtv/channelutil.h	(kopia robocza)
@@ -67,7 +67,8 @@
         signed char trans_mode,
         QString     inner_FEC,    QString     constellation,
         signed char hierarchy,    QString     hp_code_rate,
-        QString     lp_code_rate, QString     guard_interval);
+	QString     lp_code_rate, QString     guard_interval,
+	QString     msystem,      QString     rolloff);
 
     static uint    CreateMultiplex(uint sourceid, const DTVMultiplex&,
                                    int transport_id, int network_id);
@@ -90,6 +91,8 @@
                                    uint64_t &frequency,
                                    uint     &dvb_transportid,
                                    uint     &dvb_networkid,
+				   QString  &msystem,
+				   QString  &rolloff,
                                    QString  &si_std);
 
     static bool    GetATSCChannel(uint sourceid, const QString &channum,
@@ -159,6 +162,7 @@
         QString &dtv_si_std,      int     &mpeg_prog_num,
         uint    &atsc_major,      uint          &atsc_minor,
         uint    &dvb_transportid, uint          &dvb_networkid,
+	QString &msystem,         QString       &rolloff,
         uint    &mplexid,         bool          &commfree);
     static bool    GetChannelSettings(int chanid, bool &useonairguide,
                                     bool &hidden);
Index: libs/libmythtv/cardutil.h
===================================================================
--- libs/libmythtv/cardutil.h	(wersja 18962)
+++ libs/libmythtv/cardutil.h	(kopia robocza)
@@ -54,6 +54,7 @@
         HDHOMERUN = 10,
         FREEBOX   = 11,
         HDPVR     = 12,
+	DVBS2     = 13,
     };
 
     static enum CARD_TYPES toCardType(const QString &name)
@@ -84,6 +85,8 @@
             return FREEBOX;
         if ("HDPVR" == name)
             return HDPVR;
+	if ("DVB_S2" == name)
+            return DVBS2;
         return ERROR_UNKNOWN;
     }
 
Index: libs/libmythtv/scanwizardhelpers.h
===================================================================
--- libs/libmythtv/scanwizardhelpers.h	(wersja 18962)
+++ libs/libmythtv/scanwizardhelpers.h	(kopia robocza)
@@ -243,6 +243,7 @@
         // seen in the Network Information Tables to the scan.
         NITAddScan_OFDM,
         NITAddScan_QPSK,
+	NITAddScan_DVBS2,
         NITAddScan_QAM,
         // Scan of all transports already in the database
         FullTransportScan,
@@ -274,6 +275,7 @@
     QString GetATSCFormat(const QString&)    const;
     QString GetFrequencyStandard(void)       const;
     QString GetModulation(void)              const;
+    QString GetRollOff(void)                 const;
     QString GetFrequencyTable(void)          const;
     bool    DoIgnoreSignalTimeout(void)      const;
     QString GetFilename(void)                const;
@@ -510,9 +512,7 @@
     {
         addSelection(QObject::tr("Auto"),"auto",true);
         addSelection("QPSK","qpsk");
-#ifdef FE_GET_EXTENDED_INFO
         addSelection("8PSK","8psk");
-#endif
         addSelection("QAM 16","qam_16");
         addSelection("QAM 32","qam_32");
         addSelection("QAM 64","qam_64");
@@ -531,6 +531,48 @@
     };
 };
 
+class ScanModulationSystemSetting: public ComboBoxSetting
+{
+  public:
+    ScanModulationSystemSetting(Storage *_storage) : ComboBoxSetting(_storage)
+    {
+        addSelection("DVB-S","dvbs",true);
+        addSelection("DVB-S2","dvbs2");
+    };
+};
+
+class ScanModulationSystem: public ScanModulationSystemSetting, public TransientStorage
+{
+  public:
+    ScanModulationSystem() : ScanModulationSystemSetting(this)
+    {
+        setLabel(QObject::tr("Modul. System"));
+        setHelpText(QObject::tr("Modulation System (Default: DVB-S)"));
+    };
+};
+
+class ScanRollOffSetting: public ComboBoxSetting
+{
+  public:
+    ScanRollOffSetting(Storage *_storage) : ComboBoxSetting(_storage)
+    {
+        addSelection(QObject::tr("Auto"),"auto");
+        addSelection("0.35","0.35",true);
+        addSelection("0.20","0.20");
+        addSelection("0.25","0.25");
+    };
+};
+
+class ScanRollOff: public ScanRollOffSetting, public TransientStorage
+{
+  public:
+    ScanRollOff() : ScanRollOffSetting(this)
+    {
+        setLabel(QObject::tr("RollOff"));
+        setHelpText(QObject::tr("RollOff (Default: 0.35)"));
+    };
+};
+
 class ScanConstellation: public ScanModulationSetting,
                          public TransientStorage
 {
@@ -552,11 +594,13 @@
         addSelection("1/2");
         addSelection("2/3");
         addSelection("3/4");
+	addSelection("3/5");
         addSelection("4/5");
         addSelection("5/6");
         addSelection("6/7");
         addSelection("7/8");
         addSelection("8/9");
+	addSelection("9/10");
     }
 };
 
@@ -692,9 +736,11 @@
         left->addChild( pfrequency  = new ScanFrequency());
         left->addChild( ppolarity   = new ScanPolarity());
         left->addChild( psymbolrate = new ScanSymbolRate());
-        right->addChild(pfec        = new ScanFec());
+        left->addChild(pfec         = new ScanFec());
+	right->addChild(pmsystem    = new ScanModulationSystem());
         right->addChild(pmodulation = new ScanModulation());
         right->addChild(pinversion  = new ScanInversion());
+	right->addChild(prolloff    = new ScanRollOff());
         addChild(left);
         addChild(right);
     }
@@ -704,7 +750,9 @@
     QString inversion(void)  const { return pinversion->getValue();  }
     QString fec(void)        const { return pfec->getValue();        }
     QString polarity(void)   const { return ppolarity->getValue();   }
+    QString msystem(void)    const { return pmsystem->getValue();    }
     QString modulation(void) const { return pmodulation->getValue(); }
+    QString rolloff(void)    const { return prolloff->getValue();    }
 
   protected:
     ScanFrequency  *pfrequency;
@@ -713,6 +761,8 @@
     ScanFec        *pfec;
     ScanPolarity   *ppolarity;
     ScanModulation *pmodulation;
+    ScanModulationSystem *pmsystem;
+    ScanRollOff          *prolloff;
 };
 
 class QPSKPane : public HorizontalConfigurationGroup
Index: libs/libmythtv/scanwizardscanner.cpp
===================================================================
--- libs/libmythtv/scanwizardscanner.cpp	(wersja 18962)
+++ libs/libmythtv/scanwizardscanner.cpp	(kopia robocza)
@@ -364,6 +364,7 @@
     }
     else if ((ScanTypeSetting::NITAddScan_OFDM == scantype) ||
              (ScanTypeSetting::NITAddScan_QPSK == scantype) ||
+	     (ScanTypeSetting::NITAddScan_DVBS2 == scantype) ||
              (ScanTypeSetting::NITAddScan_QAM  == scantype))
     {
         VERBOSE(VB_SIPARSER, LOC + "ScanTransports()");
@@ -490,6 +491,7 @@
         QString sub_type = CardUtil::ProbeDVBType(device).toUpper();
         bool need_nit = (("QAM"  == sub_type) ||
                          ("QPSK" == sub_type) ||
+			 ("DVB_S2" == sub_type) ||
                          ("OFDM" == sub_type));
 
         // Ugh, Some DVB drivers don't fully support signal monitoring...
Index: libs/libmythtv/hdhrchannel.cpp
===================================================================
--- libs/libmythtv/hdhrchannel.cpp	(wersja 18962)
+++ libs/libmythtv/hdhrchannel.cpp	(kopia robocza)
@@ -291,6 +291,7 @@
 
     // Fetch tuning data from the database.
     QString tvformat, modulation, freqtable, freqid, si_std;
+    QString msystem, rolloff;
     int finetune;
     uint64_t frequency;
     int mpeg_prog_num;
@@ -301,6 +302,7 @@
         tvformat, modulation, freqtable, freqid,
         finetune, frequency,
         si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
+	msystem, rolloff,
         mplexid, commfree))
     {
         return false;
@@ -369,10 +371,13 @@
     uint64_t frequency;
     uint     transportid;
     uint     dvb_networkid;
+    QString  dvb_msystem;
+    QString  dvb_rolloff;
 
     if (!ChannelUtil::GetTuningParams(
             mplexid, modulation, frequency,
-            transportid, dvb_networkid, si_std))
+            transportid, dvb_networkid,
+	    dvb_msystem, dvb_rolloff, si_std))
     {
         VERBOSE(VB_IMPORTANT, LOC_ERR + "TuneMultiplex(): " +
                 QString("Could not find tuning parameters for multiplex %1.")
Index: libs/libmythtv/siscan.cpp
===================================================================
--- libs/libmythtv/siscan.cpp	(wersja 18962)
+++ libs/libmythtv/siscan.cpp	(kopia robocza)
@@ -903,12 +903,40 @@
     nextIt = transport_scan_items_it_t( scanTransports.end() );
 
     DTVMultiplex tuning;
-
+    DTVModulation modulation;
+    DTVModulationSystem msystem;
     DTVTunerType type;
 
     if (std == "dvb")
     {
-        ok = type.Parse(mod);
+	if (!modulation.Parse(*(startChan.find("modulation"))))
+	{
+	    VERBOSE(VB_IMPORTANT, LOC + "Wrong modulation.");
+	    return false;
+	}
+
+	if (modulation == DTVModulation::kModulationQPSK)
+	{
+	    type = DTVTunerType::kTunerTypeQPSK;
+	    ok = true;
+	    if (startChan.find("msystem") != startChan.end())
+	    {
+		if (!msystem.Parse(*(startChan.find("msystem"))))
+		{
+		    VERBOSE(VB_IMPORTANT, LOC + "Wrong modulation system.");
+		    return false;
+		}
+		if (msystem == DTVModulationSystem::kModulationSystemDVBS2)
+		    type = DTVTunerType::kTunerTypeDVB_S2;
+	    }
+	}	
+	else if (modulation == DTVModulation::kModulation8PSK)
+	{
+	    type = DTVTunerType::kTunerTypeDVB_S2;
+	    ok = true;
+	}
+	else
+	    ok = type.Parse(mod);
     }
     else if (std == "atsc")
     {
@@ -926,7 +954,8 @@
             startChan["coderate_hp"],    startChan["coderate_lp"],
             startChan["constellation"],  startChan["trans_mode"],
             startChan["guard_interval"], startChan["hierarchy"],
-            startChan["modulation"],     startChan["bandwidth"]);
+	    startChan["modulation"],     startChan["bandwidth"],
+	    startChan["msystem"],        startChan["rolloff"]);
     }
 
     if (ok)
@@ -1566,7 +1595,7 @@
     const uint transportid, const uint networkid)
 {
     uint64_t    db_freq;
-    QString     tmp_modulation;
+    QString     tmp_modulation, tmp_msystem, tmp_rolloff;
     QString     tmp_si_std;
     uint        tmp_transportid, tmp_networkid;
     int         mplexid;
@@ -1580,7 +1609,8 @@
 
     if (!ChannelUtil::GetTuningParams(
             (uint)mplexid, tmp_modulation,
-            db_freq, tmp_transportid, tmp_networkid, tmp_si_std))
+	    db_freq, tmp_transportid, tmp_networkid,
+	    tmp_msystem, tmp_rolloff, tmp_si_std))
     {
         return tuning_freq;
     }
Index: libs/libmythtv/dtvconfparser.h
===================================================================
--- libs/libmythtv/dtvconfparser.h	(wersja 18962)
+++ libs/libmythtv/dtvconfparser.h	(kopia robocza)
@@ -80,7 +80,7 @@
 {
   public:
     enum return_t   { ERROR_CARDTYPE, ERROR_OPEN, ERROR_PARSE, OK };
-    enum cardtype_t { ATSC, OFDM, QPSK, QAM, UNKNOWN };
+    enum cardtype_t { ATSC, OFDM, QPSK, DVBS2, QAM, UNKNOWN };
 
     DTVConfParser(enum cardtype_t _type, uint sourceid, const QString &_file);
     virtual ~DTVConfParser() { }
Index: libs/libmythtv/channelbase.cpp
===================================================================
--- libs/libmythtv/channelbase.cpp	(wersja 18962)
+++ libs/libmythtv/channelbase.cpp	(kopia robocza)
@@ -190,6 +190,7 @@
 
     // Fetch tuning data from the database.
     QString tvformat, modulation, freqtable, freqid, dtv_si_std;
+    QString msystem, rolloff;
     int finetune;
     uint64_t frequency;
     int mpeg_prog_num;
@@ -201,6 +202,7 @@
         tvformat, modulation, freqtable, freqid,
         finetune, frequency,
         dtv_si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
+	msystem, rolloff,
         mplexid, commfree))
     {
         VERBOSE(VB_IMPORTANT, loc + " " + QString(
Index: libs/libmythtv/dvbchannel.h
===================================================================
--- libs/libmythtv/dvbchannel.h	(wersja 18962)
+++ libs/libmythtv/dvbchannel.h	(kopia robocza)
@@ -18,6 +18,10 @@
 #include "streamlisteners.h"
 #include "diseqc.h"
 
+#ifdef USING_DVB
+#include "dvbtypes.h"
+#endif
+
 class TVRec;
 class DVBCam;
 class DVBRecorder;
@@ -117,7 +121,6 @@
     QString           frontend_name;
     DTVTunerType      card_type;
     uint64_t          capabilities;
-    uint64_t          ext_modulations;
     uint64_t          frequency_minimum;
     uint64_t          frequency_maximum;
     uint              symbol_rate_minimum;
Index: libs/libmythtv/channelutil.cpp
===================================================================
--- libs/libmythtv/channelutil.cpp	(wersja 18962)
+++ libs/libmythtv/channelutil.cpp	(kopia robocza)
@@ -121,7 +121,8 @@
     signed char trans_mode,
     QString     inner_FEC,     QString      constellation,
     signed char hierarchy,     QString      hp_code_rate,
-    QString     lp_code_rate,  QString      guard_interval)
+    QString     lp_code_rate,  QString     guard_interval,
+    QString     msystem,       QString     rolloff)
 {
     MSqlQuery query(MSqlQuery::InitCon());
 
@@ -165,6 +166,10 @@
         "lp_code_rate     = :LP_CODE_RATE, " : "";
     updateStr += (!guard_interval.isNull()) ?
         "guard_interval   = :GUARD_INTERVAL, " : "";
+    updateStr += (!msystem.isNull()) ?
+        "msystem          = :MSYSTEM, " : "";
+    updateStr += (!rolloff.isNull()) ?
+        "rolloff          = :ROLLOFF, " : "";
 
     updateStr = updateStr.left(updateStr.length()-2) + " ";
 
@@ -194,6 +199,8 @@
     insertStr += (!hp_code_rate.isNull())   ? "hp_code_rate, "      : "";
     insertStr += (!lp_code_rate.isNull())   ? "lp_code_rate, "      : "";
     insertStr += (!guard_interval.isNull()) ? "guard_interval, "    : "";
+    insertStr += (!msystem.isNull())        ? "msystem, "           : "";
+    insertStr += (!rolloff.isNull())        ? "rolloff, "           : "";
     insertStr = insertStr.left(insertStr.length()-2) + ") ";
 
     insertStr +=
@@ -213,6 +220,8 @@
     insertStr += (!hp_code_rate.isNull())   ? ":HP_CODE_RATE, "     : "";
     insertStr += (!lp_code_rate.isNull())   ? ":LP_CODE_RATE, "     : "";
     insertStr += (!guard_interval.isNull()) ? ":GUARD_INTERVAL, "   : "";
+    insertStr += (!msystem.isNull())        ? ":MSYSTEM, "          : "";
+    insertStr += (!rolloff.isNull())        ? ":ROLLOFF, "          : "";
     insertStr = insertStr.left(insertStr.length()-2) + ");";
 
     query.prepare((mplex) ? updateStr : insertStr);
@@ -254,6 +263,10 @@
         query.bindValue(":LP_CODE_RATE",  lp_code_rate);
     if (!guard_interval.isNull())
         query.bindValue(":GUARD_INTERVAL",guard_interval);
+    if (!msystem.isNull())
+        query.bindValue(":MSYSTEM",       msystem);
+    if (!rolloff.isNull())
+        query.bindValue(":ROLLOFF",       rolloff);
 
     if (!query.exec() || !query.isActive())
     {
@@ -292,9 +305,13 @@
         {
             QString dummy_mod;
             QString dummy_sistd;
+	    QString dummy_msystem;
+	    QString dummy_rolloff;
             uint dummy_tsid, dummy_netid;
             ChannelUtil::GetTuningParams(mux, dummy_mod, freq,
-                                         dummy_tsid, dummy_netid, dummy_sistd);
+                                         dummy_tsid, dummy_netid, 
+					 dummy_msystem, dummy_rolloff,
+					 dummy_sistd);
         }
 
         mux = ChannelUtil::CreateMultiplex(
@@ -307,7 +324,8 @@
             cd.TransmissionModeString()[0].toAscii(),
             QString(),                         cd.ConstellationString(),
             cd.HierarchyString()[0].toAscii(), cd.CodeRateHPString(),
-            cd.CodeRateLPString(),             cd.GuardIntervalString());
+            cd.CodeRateLPString(),             cd.GuardIntervalString(),
+	    QString(),                         QString());
 
         if (mux)
             muxes.push_back(mux);
@@ -334,7 +352,8 @@
             -1,
             cd.FECInnerString(),  QString(),
             -1,                   QString(),
-            QString(),            QString());
+	    QString(),                   QString(),
+	    cd.ModulationSystemString(), cd.RollOffString());
 
         if (mux)
             muxes.push_back(mux);
@@ -357,7 +376,8 @@
             -1,
             cd.FECInnerString(),  QString::null,
             -1,                   QString::null,
-            QString::null,        QString::null);
+            QString::null,        QString::null,
+	    QString::null,        QString::null);
 
         if (mux)
             muxes.push_back(mux);
@@ -377,7 +397,8 @@
         -1,
         QString::null,      QString::null,
         -1,                 QString::null,
-        QString::null,      QString::null);
+        QString::null,      QString::null,
+	QString::null,      QString::null);
 }
 
 uint ChannelUtil::CreateMultiplex(
@@ -390,7 +411,8 @@
     signed char trans_mode,
     QString     inner_FEC,    QString     constellation,
     signed char hierarchy,    QString     hp_code_rate,
-    QString     lp_code_rate, QString     guard_interval)
+    QString     lp_code_rate, QString     guard_interval,
+    QString     msystem,      QString     rolloff)
 {
     return insert_dtv_multiplex(
         sourceid,           sistandard,
@@ -402,7 +424,8 @@
         trans_mode,
         inner_FEC,          constellation,
         hierarchy,          hp_code_rate,
-        lp_code_rate,       guard_interval);
+        lp_code_rate,       guard_interval,
+	msystem,            rolloff);
 }
 
 uint ChannelUtil::CreateMultiplex(uint sourceid, const DTVMultiplex &mux,
@@ -418,7 +441,8 @@
         mux.trans_mode.toChar().toAscii(),
         mux.fec.toString(),               mux.modulation.toString(),
         mux.hierarchy.toChar().toAscii(), mux.hp_code_rate.toString(),
-        mux.lp_code_rate.toString(),      mux.guard_interval.toString());
+        mux.lp_code_rate.toString(),      mux.guard_interval.toString(),
+	mux.msystem.toString(),           mux.rolloff.toString());
 }
 
 
@@ -706,6 +730,8 @@
                                   uint64_t &frequency,
                                   uint     &dvb_transportid,
                                   uint     &dvb_networkid,
+				  QString  &dvb_msystem,
+				  QString  &dvb_rolloff,
                                   QString  &si_std)
 {
     if (!mplexid || (mplexid == 32767)) /* 32767 deals with old lineups */
@@ -713,7 +739,8 @@
 
     MSqlQuery query(MSqlQuery::InitCon());
     query.prepare(
-        "SELECT transportid, networkid, frequency, modulation, sistandard "
+        "SELECT transportid, networkid, frequency, modulation, sistandard, "
+	"msystem, rolloff "
         "FROM dtv_multiplex "
         "WHERE mplexid = :MPLEXID");
     query.bindValue(":MPLEXID", mplexid);
@@ -732,6 +759,8 @@
     frequency       = (uint64_t) query.value(2).toDouble(); // Qt 3.1 compat
     modulation      = query.value(3).toString();
     si_std          = query.value(4).toString();
+    dvb_msystem     = query.value(5).toString();
+    dvb_rolloff     = query.value(6).toString();
 
     return true;
 }
@@ -1483,6 +1512,7 @@
     QString &dtv_si_std,      int           &mpeg_prog_num,
     uint    &atsc_major,      uint          &atsc_minor,
     uint    &dvb_transportid, uint          &dvb_networkid,
+    QString &dvb_msystem,     QString       &dvb_rolloff,
     uint    &mplexid,
     bool    &commfree)
 {
@@ -1535,7 +1565,8 @@
         return true;
 
     return GetTuningParams(mplexid, modulation, frequency,
-                           dvb_transportid, dvb_networkid, dtv_si_std);
+                           dvb_transportid, dvb_networkid, 
+			   dvb_msystem, dvb_rolloff, dtv_si_std);
 }
 
 bool ChannelUtil::GetChannelSettings(int chanid, bool &useonairguide,
Index: libs/libmythtv/mpeg/dvbdescriptors.h
===================================================================
--- libs/libmythtv/mpeg/dvbdescriptors.h	(wersja 18962)
+++ libs/libmythtv/mpeg/dvbdescriptors.h	(kopia robocza)
@@ -745,15 +745,35 @@
     bool IsLinearPolarization()   const { return !((_data[8]>>6)&0x1); }
     bool IsHorizontalLeftPolarization() const { return (_data[8]>>5)&0x1; }
     bool IsVerticalRightPolarization() const { return !((_data[8]>>5)&0x1); }
-    // modulation               5   8.3
+    // rolloff                  2   8.3
+    uint RollOff() const { return (_data[8]>>3)&0x3; }
+    QString RollOffString()  const
+    {
+        static QString ps[] = { "0.35", "0.20", "0.25", "AUTO" };
+        return ps[Polarization()];
+    }
+    // modulation system        3   8.5
     enum
+    {    
+        kModulationSystemDVBS  = 0x0,
+        kModulationSystemDVBS2 = 0x1,
+    };
+    uint ModulationSystem() const { return _data[8]>>2&0x1; }
+    QString ModulationSystemString() const
     {
+        static QString mss[] = { "dvbs", "dvbs2" };
+        return (mss[ModulationSystem()]);
+    }
+    // modulation               4   8.6
+    
+    enum
+    {
         kModulationQPSK_NS = 0x0, // Non standard QPSK for Bell ExpressVu
         kModulationQPSK   = 0x1,
         kModulation8PSK   = 0x2,
         kModulationQAM16  = 0x3,
     };
-    uint Modulation() const { return _data[8]&0x1f; }
+    uint Modulation() const { return _data[8]&0x7; }
     QString ModulationString() const
     {
         static QString ms[] = { "qpsk", "qpsk", "8psk", "qam_16" };
@@ -779,6 +799,10 @@
         kInnerFEC_5_6_ConvolutionCodeRate = 0x4,
         kInnerFEC_7_8_ConvolutionCodeRate = 0x5,
         kInnerFEC_8_9_ConvolutionCodeRate = 0x6,
+	kInnerFEC_3_5_ConvolutionCodeRate  = 0x7,
+	kInnerFEC_4_5_ConvolutionCodeRate  = 0x8,
+	kInnerFEC_9_10_ConvolutionCodeRate = 0x9,
+	kInnerFEC_Auto                     = 0xA,
         kInnerFEC_None                    = 0xF,
     };
     uint FECInner() const { return _data[12] & 0xf; }
@@ -1756,13 +1780,16 @@
 {
     switch (cr)
     {
-        case 0x0:  return "auto"; // not actually defined in spec
+        case 0x0:  return "none"; // not actually defined in spec
         case 0x1:  return "1/2";
         case 0x2:  return "2/3";
         case 0x3:  return "3/4";
         case 0x4:  return "5/6";
         case 0x5:  return "7/8";
-        case 0x8:  return "8/9";
+        case 0x6:  return "8/9";
+	case 0x7:  return "3/5";
+	case 0x8:  return "4/5";
+	case 0x9:  return "9/10";
         case 0xf:  return "none";
         default:   return "auto"; // not actually defined in spec
     }
Index: libs/libmythtv/mpeg/dvbdescriptors.cpp
===================================================================
--- libs/libmythtv/mpeg/dvbdescriptors.cpp	(wersja 18962)
+++ libs/libmythtv/mpeg/dvbdescriptors.cpp	(kopia robocza)
@@ -369,8 +369,10 @@
     QString str = QString("SatelliteDeliverySystemDescriptor: ");
 
     str.append(QString("Frequency: %1\n").arg(FrequencyHz()));
-    str.append(QString("      Mod=%1, SymbR=%2, FECInner=%3, Orbit=%4, Pol=%5")
+    str.append(QString("      ModSys=%1, Mod=%2, RollOff=%3. SymbR=%4, FECInner=%5, Orbit=%6, Pol=%7")
+	.arg(ModulationSystemString())
         .arg(ModulationString())
+	.arg(RollOffString())
         .arg(SymbolRateHz())
         .arg(FECInnerString())
         .arg(OrbitalPositionString())
Index: libs/libmythtv/v4lchannel.cpp
===================================================================
--- libs/libmythtv/v4lchannel.cpp	(wersja 18962)
+++ libs/libmythtv/v4lchannel.cpp	(kopia robocza)
@@ -453,6 +453,7 @@
 
     // Fetch tuning data from the database.
     QString tvformat, modulation, freqtable, freqid, dtv_si_std;
+    QString msystem, rolloff;
     int finetune;
     uint64_t frequency;
     int mpeg_prog_num;
@@ -463,6 +464,7 @@
         tvformat, modulation, freqtable, freqid,
         finetune, frequency,
         dtv_si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
+	msystem, rolloff,
         mplexid, commfree))
     {
         return false;
@@ -738,10 +740,13 @@
     uint64_t frequency;
     uint     transportid;
     uint     dvb_networkid;
+    QString  dvb_msystem;
+    QString  dvb_rolloff;
 
     if (!ChannelUtil::GetTuningParams(
             mplexid, modulation, frequency,
-            transportid, dvb_networkid, si_std))
+            transportid, dvb_networkid,
+	    dvb_msystem, dvb_rolloff, si_std))
     {
         VERBOSE(VB_IMPORTANT, LOC_ERR + "TuneMultiplex(): " +
                 QString("Could not find tuning parameters for multiplex %1.")
Index: libs/libmythtv/dvbtypes.h
===================================================================
--- libs/libmythtv/dvbtypes.h	(wersja 18962)
+++ libs/libmythtv/dvbtypes.h	(kopia robocza)
@@ -19,15 +19,15 @@
 #include <linux/dvb/frontend.h>
 #include <linux/dvb/dmx.h>
 
-#if (DVB_API_VERSION != 3)
-#    error "DVB driver includes with API version 3 not found!"
+#if (DVB_API_VERSION != 3 && DVB_API_VERSION != 5)
+#    error "DVB driver includes with correct API version not found!"
 #endif
 
 #ifndef DVB_API_VERSION_MINOR
 #    define DVB_API_VERSION_MINOR 0
 #endif
 
-#if (DVB_API_VERSION >= 3 && DVB_API_VERSION_MINOR >= 1)
+#if ((DVB_API_VERSION >= 3 && DVB_API_VERSION_MINOR >= 1) || (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 0))
 #    define USE_ATSC
 #else
 #warning DVB API version < 3.1
Index: libs/libmythtv/dvbchannel.cpp
===================================================================
--- libs/libmythtv/dvbchannel.cpp	(wersja 18962)
+++ libs/libmythtv/dvbchannel.cpp	(kopia robocza)
@@ -49,11 +49,23 @@
 
 static void drain_dvb_events(int fd);
 static bool wait_for_backend(int fd, int timeout_ms);
+/*
 static struct dvb_fe_params dtvmultiplex_to_dvbparams(
     DTVTunerType, const DTVMultiplex&);
 static DTVMultiplex dvbparams_to_dtvmultiplex(
     DTVTunerType, const dvb_fe_params&);
+*/    
 
+static bool dtvmultiplex_to_dtvproperties(
+    DTVTunerType, const DTVMultiplex&, struct dtv_properties*, bool do_tune);
+
+static bool dtvmultiplex_to_dtvproperties(
+    DTVTunerType, const DTVMultiplex&, struct dtv_properties*);
+
+static DTVMultiplex dtvproperties_to_dtvmultiplex(
+    DTVTunerType, const dtv_properties&);
+
+
 #define LOC QString("DVBChan(%1:%2): ").arg(GetCardID()).arg(device)
 #define LOC_WARN QString("DVBChan(%1:%2) Warning: ") \
                  .arg(GetCardID()).arg(device)
@@ -149,6 +161,7 @@
 bool DVBChannel::Open(DVBChannel *who)
 {
     VERBOSE(VB_CHANNEL, LOC + "Opening DVB channel");
+    VERBOSE(VB_IMPORTANT, LOC + "Opening DVB channel");
 
     QMutexLocker locker(&hw_lock);
 
@@ -167,7 +180,6 @@
         frontend_name       = master->frontend_name;
         card_type           = master->card_type;
         capabilities        = master->capabilities;
-        ext_modulations     = master->ext_modulations;
         frequency_minimum   = master->frequency_minimum;
         frequency_maximum   = master->frequency_maximum;
         symbol_rate_minimum = master->symbol_rate_minimum;
@@ -210,57 +222,15 @@
         return false;
     }
 
-#ifdef FE_GET_EXTENDED_INFO
-    if (info.caps & FE_HAS_EXTENDED_INFO)
-    {
-        bool ok = true;
-        dvb_fe_caps_extended extinfo;
-        bzero(&extinfo, sizeof(extinfo));
-        if (ioctl(fd_frontend, FE_GET_EXTENDED_INFO, &extinfo) < 0)
-        {
-            VERBOSE(VB_IMPORTANT, LOC_ERR +
-                    "Failed to get frontend extended information." + ENO);
-
-            ok = false;
-        }
-
-        if (ok && (extinfo.modulations & MOD_8PSK))
-        {
-            if (ioctl(fd_frontend, FE_SET_STANDARD, FE_DVB_S2) < 0)
-            {
-                VERBOSE(VB_IMPORTANT, LOC_ERR +
-                        "Failed to set frontend standard to DVB-S2." + ENO);
-
-                ok = false;
-            }
-            else if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0)
-            {
-                VERBOSE(VB_IMPORTANT, LOC_ERR +
-                        "Failed to get frontend information." + ENO);
-
-                ok = false;
-            }
-        }
-
-        if (!ok)
-        {
-            close(fd_frontend);
-            fd_frontend = -1;
-            return false;
-        }
-
-        ext_modulations   = extinfo.modulations;
-    }
-#endif
-
     frontend_name       = info.name;
-    card_type           = info.type;
+    //card_type           = info.type;
+    card_type.Parse(CardUtil::ProbeDVBType(device));
     capabilities        = info.caps;
     frequency_minimum   = info.frequency_min;
     frequency_maximum   = info.frequency_max;
     symbol_rate_minimum = info.symbol_rate_min;
     symbol_rate_maximum = info.symbol_rate_max;
-
+    
     VERBOSE(VB_RECORD, LOC + QString("Using DVB card %1, with frontend '%2'.")
             .arg(device).arg(frontend_name));
 
@@ -309,10 +279,13 @@
 bool DVBChannel::TuneMultiplex(uint mplexid, QString inputname)
 {
     DTVMultiplex tuning;
-    if (!tuning.FillFromDB(card_type, mplexid))
+    bool ok = true;
+    //card_type.Parse(CardUtil::ProbeDVBType(inputname));
+    ok = tuning.FillFromDB(card_type, mplexid);
+    if (!ok)
         return false;
 
-    CheckOptions(tuning);
+    //CheckOptions(tuning);
 
     return Tune(tuning, inputname);
 }
@@ -365,6 +338,7 @@
 
     // Get the input data for the channel
     QString tvformat, modulation, freqtable, freqid, si_std;
+    QString msystem, rolloff;
     int finetune;
     uint64_t frequency;
     int mpeg_prog_num;
@@ -375,6 +349,7 @@
         tvformat, modulation, freqtable, freqid,
         finetune, frequency,
         si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
+	msystem, rolloff,
         mplexid, commfree))
     {
         VERBOSE(VB_IMPORTANT, loc_err +
@@ -596,15 +571,6 @@
     const DTVModulation m = modulation;
     const uint64_t      c = capabilities;
 
-#ifdef FE_GET_EXTENDED_INFO
-    if ((c & FE_HAS_EXTENDED_INFO)            &&
-        (DTVModulation::kModulation8PSK == m) &&
-        (ext_modulations & DTVModulation::kModulation8PSK))
-    {
-        return true;
-    }
-#endif // FE_GET_EXTENDED_INFO
-
     return
         ((DTVModulation::kModulationQPSK    == m) && (c & FE_CAN_QPSK))     ||
         ((DTVModulation::kModulationQAM16   == m) && (c & FE_CAN_QAM_16))   ||
@@ -671,7 +637,6 @@
                       bool same_input)
 {
     QMutexLocker lock(&tune_lock);
-
     if (master)
     {
         VERBOSE(VB_CHANNEL, LOC + "tuning on slave channel");
@@ -680,8 +645,25 @@
     }
 
     bool reset = (force_reset || first_tune);
-    struct dvb_fe_params params = dtvmultiplex_to_dvbparams(card_type, tuning);
-
+    //struct dvb_fe_params params = dtvmultiplex_to_dvbparams(card_type, tuning);
+    
+    struct dtv_properties cmds;
+    
+    //clear card cache
+    dtv_property props[11];
+    memset(&props, 0, sizeof(props));
+    props[0].cmd = DTV_CLEAR;
+    cmds.num = 1;
+    cmds.props = props;
+    if (ioctl(fd_frontend, FE_SET_PROPERTY, &cmds) < 0)
+    {
+        VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
+                "Clearing tuner cache failed." + ENO);
+        return false;
+    }
+    
+    dtvmultiplex_to_dtvproperties(card_type, tuning, &cmds);
+    
     bool is_dvbs = (DTVTunerType::kTunerTypeQPSK   == card_type ||
                     DTVTunerType::kTunerTypeDVB_S2 == card_type);
 
@@ -738,12 +720,21 @@
             reset = first_tune = true;
         }
         
-        params.frequency = lnb->GetIntermediateFrequency(
-            diseqc_settings, tuning);
+	for (uint i = 0; i < cmds.num; i++)
+	{
+	    if (cmds.props[i].cmd == DTV_FREQUENCY)
+	    {
+		cmds.props[i].u.data = lnb->GetIntermediateFrequency(
+		    diseqc_settings, tuning);
+		break;
+	    }
+	}
+        //params.frequency = lnb->GetIntermediateFrequency(
+        //    diseqc_settings, tuning);
 
         // if card can auto-FEC, use it -- sometimes NITs are inaccurate
-        if (capabilities & FE_CAN_FEC_AUTO)
-            params.u.qpsk.fec_inner = FEC_AUTO;
+        //if (capabilities & FE_CAN_FEC_AUTO)
+        //    params.u.qpsk.fec_inner = FEC_AUTO;
     }
 
     VERBOSE(VB_CHANNEL, LOC + "Old Params: " +
@@ -753,33 +744,21 @@
 
     // DVB-S is in kHz, other DVB is in Hz
     int     freq_mult = (is_dvbs) ? 1 : 1000;
-    QString suffix    = (is_dvbs) ? "kHz" : "Hz";
+    //QString suffix    = (is_dvbs) ? "kHz" : "Hz";
 
     if (reset || !prev_tuning.IsEqual(card_type, tuning, 500 * freq_mult))
     {
-        VERBOSE(VB_CHANNEL, LOC + QString("Tune(): Tuning to %1%2")
-                .arg(params.frequency).arg(suffix));
-
-#ifdef FE_GET_EXTENDED_INFO
-        if (card_type == DTVTunerType::kTunerTypeDVB_S2)
+        //VERBOSE(VB_CHANNEL, LOC + QString("Tune(): Tuning to %1%2")
+        //        .arg(params.frequency).arg(suffix));
+	VERBOSE(VB_CHANNEL, LOC + "Tune(): Tuning ...");
+        //if (ioctl(fd_frontend, FE_SET_FRONTEND, &params) < 0)
+	VERBOSE(VB_IMPORTANT, "ioctl");
+	if (ioctl(fd_frontend, FE_SET_PROPERTY, &cmds) < 0)
         {
-            if (ioctl(fd_frontend, FE_SET_FRONTEND2, &params) < 0)
-            {
-                VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
-                        "Setting Frontend(2) tuning parameters failed." + ENO);
-                return false;
-            }
+            VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
+                    "Setting Frontend tuning parameters failed." + ENO);
+            return false;
         }
-        else
-#endif // FE_GET_EXTENDED_INFO
-        {
-            if (ioctl(fd_frontend, FE_SET_FRONTEND, &params) < 0)
-            {
-                VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
-                        "Setting Frontend tuning parameters failed." + ENO);
-                return false;
-            }
-        }
 
         // Extra delay to add for broken DVB drivers
         if (tuning_delay)
@@ -835,8 +814,11 @@
         return false;
     }
 
-    dvb_fe_params params;
-    return ioctl(fd_frontend, FE_GET_FRONTEND, &params) >= 0;
+    //dvb_fe_params params;
+    //return ioctl(fd_frontend, FE_GET_FRONTEND, &params) >= 0;
+    struct dtv_properties cmds;
+    cmds.num = 0;
+    return ioctl(fd_frontend, FE_GET_PROPERTY, &cmds) >= 0;
 }
 
 /** \fn DVBChannel::ProbeTuningParams(DTVMultiplex&) const
@@ -868,8 +850,12 @@
         return false;
     }
 
-    dvb_fe_params params;
-    if (ioctl(fd_frontend, FE_GET_FRONTEND, &params) < 0)
+    struct dtv_properties cmds;
+    dtv_property props[11];
+    memset(&props, 0, sizeof(props));
+    cmds.props = props;
+    dtvmultiplex_to_dtvproperties(card_type, tuning, &cmds, false);
+    if (ioctl(fd_frontend, FE_GET_PROPERTY, &cmds) < 0)
     {
         VERBOSE(VB_IMPORTANT, LOC_ERR +
                 "Getting Frontend tuning parameters failed." + ENO);
@@ -880,7 +866,7 @@
     uint    mplex      = tuning.mplex;
     QString sistandard = tuning.sistandard; sistandard.detach();
 
-    tuning = dvbparams_to_dtvmultiplex(card_type, params);
+    tuning = dtvproperties_to_dtvmultiplex(card_type, cmds);
 
     tuning.mplex       = mplex;
     tuning.sistandard  = sistandard;
@@ -1017,7 +1003,6 @@
 
     uint32_t ublocks = 0;
     int ret = ioctl(fd_frontend, FE_READ_UNCORRECTED_BLOCKS, &ublocks);
-
     if (ok)
         *ok = (0 == ret);
 
@@ -1094,108 +1079,253 @@
     return true;
 }
 
-static struct dvb_fe_params dtvmultiplex_to_dvbparams(
-    DTVTunerType tuner_type, const DTVMultiplex &tuning)
+
+static DTVMultiplex dtvproperties_to_dtvmultiplex(
+    DTVTunerType tuner_type, const dtv_properties &cmds)
 {
-    dvb_fe_params params;
-    bzero(&params, sizeof(params));
-
-    params.frequency = tuning.frequency;
-    params.inversion = (fe_spectral_inversion_t) (int) tuning.inversion;
-
-    if (DTVTunerType::kTunerTypeQPSK == tuner_type)
+    DTVMultiplex tuning;
+        
+    for (uint i = 0; i < cmds.num; i++)
     {
-        params.u.qpsk.symbol_rate = tuning.symbolrate;
-        params.u.qpsk.fec_inner   = (fe_code_rate_t) (int) tuning.fec;
-    }
-
-    if (DTVTunerType::kTunerTypeDVB_S2 == tuner_type)
-    {
-#ifdef FE_GET_EXTENDED_INFO
-        params.u.qpsk2.symbol_rate = tuning.symbolrate;
-        params.u.qpsk2.fec_inner   = (fe_code_rate_t) (int) tuning.fec;
-        params.u.qpsk2.modulation  = (fe_modulation_t) (int) tuning.modulation;
-#else // if !FE_GET_EXTENDED_INFO
-        VERBOSE(VB_IMPORTANT, "DVBChan Error, MythTV was compiled without "
-                "DVB-S2 headers being present so DVB-S2 tuning will fail.");
-#endif // !FE_GET_EXTENDED_INFO
-    }
-
-    if (DTVTunerType::kTunerTypeQAM  == tuner_type)
-    {
-        params.u.qam.symbol_rate  = tuning.symbolrate;
-        params.u.qam.fec_inner    = (fe_code_rate_t) (int) tuning.fec;
-        params.u.qam.modulation   = (fe_modulation_t) (int) tuning.modulation;
-    }
-
-    if (DTVTunerType::kTunerTypeOFDM == tuner_type)
-    {
-        params.u.ofdm.bandwidth             =
-            (fe_bandwidth_t) (int) tuning.bandwidth;
-        params.u.ofdm.code_rate_HP          =
-            (fe_code_rate_t) (int) tuning.hp_code_rate;
-        params.u.ofdm.code_rate_LP          =
-            (fe_code_rate_t) (int) tuning.lp_code_rate;
-        params.u.ofdm.constellation         =
-            (fe_modulation_t) (int) tuning.modulation;
-        params.u.ofdm.transmission_mode     =
-            (fe_transmit_mode_t) (int) tuning.trans_mode;
-        params.u.ofdm.guard_interval        =
-            (fe_guard_interval_t) (int) tuning.guard_interval;
-        params.u.ofdm.hierarchy_information =
-            (fe_hierarchy_t) (int) tuning.hierarchy;
-    }
-
-    if (DTVTunerType::kTunerTypeATSC == tuner_type)
-    {
+	switch (cmds.props[i].cmd)
+	{
+	    case DTV_MODULATION:
+		tuning.modulation = cmds.props[i].u.data;
+		break;
+	    case DTV_DELIVERY_SYSTEM:
+		switch (cmds.props[i].u.data)
+		{
+		    case SYS_DVBS:
+			tuning.msystem = DTVModulationSystem::kModulationSystemDVBS;
+			break;
+		    case SYS_DVBS2:
+			tuning.msystem = DTVModulationSystem::kModulationSystemDVBS2;
+			break;
+		    case SYS_DVBT:
+		    case SYS_DVBC_ANNEX_AC:
+		    case SYS_DVBC_ANNEX_B:
 #ifdef USE_ATSC
-        params.u.vsb.modulation   =
-            (fe_modulation_t) (int) tuning.modulation;
-#endif // USE_ATSC
+		    case SYS_ATSC:
+#endif
+			break;
+		    default:
+			VERBOSE(VB_IMPORTANT, "Unknown DVB delivery system." + ENO);
+		};
+		break;
+	    case DTV_FREQUENCY:
+		if (tuning.modulation == DTVModulation::kModulationQPSK ||
+    			tuning.modulation == DTVModulation::kModulation8PSK)
+    		    tuning.frequency = cmds.props[i].u.data / 1000UL;
+		else
+		    tuning.frequency = cmds.props[i].u.data;
+		break;
+	    case DTV_SYMBOL_RATE:
+		if (tuner_type == DTVTunerType::kTunerTypeQPSK   ||
+		    tuner_type == DTVTunerType::kTunerTypeDVB_S2 ||
+		    tuner_type == DTVTunerType::kTunerTypeQAM)
+		{		    
+		    if (tuning.modulation == DTVModulation::kModulationQPSK ||
+    		    	    tuning.modulation == DTVModulation::kModulation8PSK)
+			tuning.symbolrate = cmds.props[i].u.data / 1000UL;
+		    else
+			tuning.symbolrate = cmds.props[i].u.data;
+		};
+		break;
+	    case DTV_INNER_FEC:
+		if (tuner_type == DTVTunerType::kTunerTypeQPSK   ||
+		    tuner_type == DTVTunerType::kTunerTypeDVB_S2 ||
+		    tuner_type == DTVTunerType::kTunerTypeQAM)
+		{
+		    tuning.symbolrate = cmds.props[i].u.data;
+		}
+		break;
+	    case DTV_PILOT:
+		break;
+	    case DTV_ROLLOFF:
+		if (tuner_type == DTVTunerType::kTunerTypeDVB_S2)
+		    tuning.rolloff = cmds.props[i].u.data;
+		break;
+	    case DTV_INVERSION:
+		tuning.inversion = cmds.props[i].u.data;
+		break;
+	    case DTV_BANDWIDTH_HZ:
+		if (tuner_type == DTVTunerType::kTunerTypeOFDM)
+		    tuning.bandwidth = cmds.props[i].u.data;
+		break;
+	    case DTV_CODE_RATE_HP:
+		if (tuner_type == DTVTunerType::kTunerTypeOFDM)
+		    tuning.hp_code_rate = cmds.props[i].u.data;
+		break;
+	    case DTV_CODE_RATE_LP:
+		if (tuner_type == DTVTunerType::kTunerTypeOFDM)
+		    tuning.lp_code_rate = cmds.props[i].u.data;
+		break;
+	    case DTV_TRANSMISSION_MODE:
+		if (tuner_type == DTVTunerType::kTunerTypeOFDM)
+		    tuning.trans_mode = cmds.props[i].u.data;
+		break;
+	    case DTV_GUARD_INTERVAL:
+		if (tuner_type == DTVTunerType::kTunerTypeOFDM)
+		    tuning.guard_interval = cmds.props[i].u.data;
+		break;
+	    case DTV_HIERARCHY:
+		if (tuner_type == DTVTunerType::kTunerTypeOFDM)
+		    tuning.hierarchy = cmds.props[i].u.data;
+		break;
+	    case DTV_TUNE:
+		break;
+	    default:
+		VERBOSE(VB_IMPORTANT, "Unknown DTV command." + ENO);
+	}
     }
+    return tuning;
+}
 
-    return params;
+static bool dtvmultiplex_to_dtvproperties(
+    DTVTunerType tuner_type, 
+    const DTVMultiplex &tuning,
+    struct dtv_properties *cmdseq)
+{
+    return dtvmultiplex_to_dtvproperties(tuner_type, tuning, cmdseq, true);
 }
 
-static DTVMultiplex dvbparams_to_dtvmultiplex(
-    DTVTunerType tuner_type, const dvb_fe_params &params)
+static bool dtvmultiplex_to_dtvproperties(
+    DTVTunerType tuner_type, 
+    const DTVMultiplex &tuning,
+    struct dtv_properties *cmdseq,
+    bool do_tune)
 {
-    DTVMultiplex tuning;
-
-    tuning.frequency = params.frequency;
-    tuning.inversion = params.inversion;
-
-    if ((DTVTunerType::kTunerTypeQPSK   == tuner_type) ||
-        (DTVTunerType::kTunerTypeDVB_S2 == tuner_type))
+    VERBOSE(VB_IMPORTANT, tuner_type.toString());
+    if (tuner_type == DTVTunerType::kTunerTypeQPSK ||
+	(tuner_type == DTVTunerType::kTunerTypeDVB_S2 &&
+	tuning.msystem == DTVModulationSystem::kModulationSystemDVBS))
     {
-        tuning.symbolrate     = params.u.qpsk.symbol_rate;
-        tuning.fec            = params.u.qpsk.fec_inner;
+	cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
+	cmdseq->props[0].u.data = SYS_DVBS;
+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
+        cmdseq->props[1].u.data = tuning.frequency;
+        cmdseq->props[2].cmd    = DTV_MODULATION;
+        cmdseq->props[2].u.data = QPSK;
+        cmdseq->props[3].cmd    = DTV_SYMBOL_RATE;
+        cmdseq->props[3].u.data = tuning.symbolrate;
+        cmdseq->props[4].cmd    = DTV_INNER_FEC;
+        cmdseq->props[4].u.data = (fe_code_rate_t) (int) tuning.fec;
+	cmdseq->props[5].cmd    = DTV_INVERSION;
+        cmdseq->props[5].u.data = (fe_spectral_inversion_t) (int) tuning.inversion;
+	if (do_tune)
+	{
+    	    cmdseq->props[6].cmd    = DTV_TUNE;
+    	    cmdseq->num = 7;
+	}
+	else
+	{
+    	    cmdseq->num = 6;
+	}
     }
-
-    if (DTVTunerType::kTunerTypeQAM  == tuner_type)
+    else if (tuner_type == DTVTunerType::kTunerTypeDVB_S2 &&
+	tuning.msystem == DTVModulationSystem::kModulationSystemDVBS2)
     {
-        tuning.symbolrate     = params.u.qam.symbol_rate;
-        tuning.fec            = params.u.qam.fec_inner;
-        tuning.modulation     = params.u.qam.modulation;
+	cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
+	cmdseq->props[0].u.data = SYS_DVBS2;
+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
+        cmdseq->props[1].u.data = tuning.frequency;
+        cmdseq->props[2].cmd    = DTV_MODULATION;
+        cmdseq->props[2].u.data = (fe_modulation_t) (int) tuning.modulation;
+        cmdseq->props[3].cmd    = DTV_SYMBOL_RATE;
+        cmdseq->props[3].u.data = tuning.symbolrate;
+        cmdseq->props[4].cmd    = DTV_INNER_FEC;
+        cmdseq->props[4].u.data = (fe_code_rate_t) (int) tuning.fec;
+	cmdseq->props[5].cmd    = DTV_INVERSION;
+        cmdseq->props[5].u.data = (fe_spectral_inversion_t) (int) tuning.inversion;
+	cmdseq->props[6].cmd    = DTV_PILOT;
+        cmdseq->props[6].u.data = PILOT_AUTO;
+        cmdseq->props[7].cmd    = DTV_ROLLOFF;
+        cmdseq->props[7].u.data = (fe_rolloff_t) (int) tuning.rolloff;
+        
+	if (do_tune)
+	{
+    	    cmdseq->props[8].cmd = DTV_TUNE;
+    	    cmdseq->num = 9;
+	}
+	else
+    	    cmdseq->num = 8;
     }
-
-    if (DTVTunerType::kTunerTypeOFDM == tuner_type)
+    else if (tuner_type == DTVTunerType::kTunerTypeQAM)
     {
-        tuning.bandwidth      = params.u.ofdm.bandwidth;
-        tuning.hp_code_rate   = params.u.ofdm.code_rate_HP;
-        tuning.lp_code_rate   = params.u.ofdm.code_rate_LP;
-        tuning.modulation     = params.u.ofdm.constellation;
-        tuning.trans_mode     = params.u.ofdm.transmission_mode;
-        tuning.guard_interval = params.u.ofdm.guard_interval;
-        tuning.hierarchy      = params.u.ofdm.hierarchy_information;
+        cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
+        cmdseq->props[0].u.data = (fe_delivery_system_t) (int) tuning.msystem;
+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
+        cmdseq->props[1].u.data = tuning.frequency;
+        cmdseq->props[2].cmd    = DTV_MODULATION;
+        cmdseq->props[2].u.data = (fe_modulation_t) (int) tuning.modulation;
+        cmdseq->props[3].cmd    = DTV_SYMBOL_RATE;
+        cmdseq->props[3].u.data = tuning.symbolrate;
+        cmdseq->props[4].cmd    = DTV_INNER_FEC;
+        cmdseq->props[4].u.data = (fe_code_rate_t) (int) tuning.fec;
+        cmdseq->props[5].cmd    = DTV_INVERSION;
+        cmdseq->props[5].u.data = (fe_spectral_inversion_t) (int) tuning.inversion;
+	if (do_tune)
+	{
+    	    cmdseq->props[6].cmd    = DTV_TUNE;
+    	    cmdseq->num = 7;
+	}
+	else
+    	    cmdseq->num = 6;
     }
-
-    if (DTVTunerType::kTunerTypeATSC == tuner_type)
+    else if (tuner_type == DTVTunerType::kTunerTypeOFDM)
     {
+        cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
+        cmdseq->props[0].u.data = SYS_DVBC_ANNEX_AC;
+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
+        cmdseq->props[1].u.data = tuning.frequency;
+        cmdseq->props[2].cmd    = DTV_MODULATION;
+        cmdseq->props[2].u.data = (fe_modulation_t) (int) tuning.modulation;
+	cmdseq->props[3].cmd    = DTV_INVERSION;
+        cmdseq->props[3].u.data = (fe_spectral_inversion_t) (int) tuning.inversion;
+	cmdseq->props[4].cmd    = DTV_BANDWIDTH_HZ;
+        cmdseq->props[4].u.data = (fe_bandwidth_t) (int) tuning.bandwidth;
+	cmdseq->props[5].cmd    = DTV_CODE_RATE_HP;
+        cmdseq->props[5].u.data = (fe_code_rate_t) (int) tuning.hp_code_rate;
+	cmdseq->props[6].cmd    = DTV_CODE_RATE_LP;
+        cmdseq->props[6].u.data = (fe_code_rate_t) (int) tuning.lp_code_rate;
+	cmdseq->props[7].cmd    = DTV_TRANSMISSION_MODE;
+        cmdseq->props[7].u.data = (fe_transmit_mode_t) (int) tuning.trans_mode;
+	cmdseq->props[8].cmd    = DTV_GUARD_INTERVAL;
+        cmdseq->props[8].u.data = (fe_guard_interval_t) (int) tuning.guard_interval;
+	cmdseq->props[9].cmd    = DTV_HIERARCHY;
+        cmdseq->props[9].u.data = (fe_hierarchy_t) (int) tuning.hierarchy;
+	if (do_tune)
+	{
+    	    cmdseq->props[10].cmd    = DTV_TUNE;
+    	    cmdseq->num = 11;
+	}
+	else
+    	    cmdseq->num = 10;
+    }
 #ifdef USE_ATSC
-        tuning.modulation     = params.u.vsb.modulation;
-#endif // USE_ATSC
+    else if (tuner_type == DTVTunerType::kTunerTypeATSC)
+    {
+	cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
+        cmdseq->props[0].u.data = SYS_ATSC;
+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
+        cmdseq->props[1].u.data = tuning.frequency * 1000UL;
+        cmdseq->props[2].cmd    = DTV_MODULATION;
+        cmdseq->props[2].u.data = (fe_modulation_t) (int) tuning.modulation;;
+        cmdseq->props[3].cmd    = DTV_INVERSION;
+        cmdseq->props[3].u.data = (fe_spectral_inversion_t) (int) tuning.inversion;
+	if (do_tune)
+	{
+    	    cmdseq->props[4].cmd    = DTV_TUNE;
+    	    cmdseq->num = 5;
+	}
+	else
+    	    cmdseq->num = 4;
     }
+#endif
+    else
+    {
+	VERBOSE(VB_IMPORTANT, "Unknown tuner type." + ENO);
+    }    
+    return true;
+}
 
-    return tuning;
-}
Index: libs/libmythtv/cardutil.cpp
===================================================================
--- libs/libmythtv/cardutil.cpp	(wersja 18962)
+++ libs/libmythtv/cardutil.cpp	(kopia robocza)
@@ -241,10 +241,14 @@
         close(fd_frontend);
         VERBOSE(VB_IMPORTANT, "FE_GET_INFO ioctl failed (" + dvbdev + ").");
         return ret;
+    }     
+    DTVTunerType type(info.type);
+    //to do: support for DTV_FE_CAPABILITY
+    if (type == DTVTunerType::kTunerTypeQPSK){
+	type = DTVTunerType::kTunerTypeDVB_S2;
     }
     close(fd_frontend);
 
-    DTVTunerType type(info.type);
     ret = (type.toString() != "UNKNOWN") ? type.toString().toUpper() : ret;
 #endif // USING_DVB
 
@@ -337,7 +341,7 @@
 {
     QString ct = card_type.toUpper();
     return (ct == "DVB") || (ct == "QAM") || (ct == "QPSK") ||
-        (ct == "OFDM") || (ct == "ATSC");
+        (ct == "OFDM") || (ct == "ATSC") || (ct == "DVB_S2");
 }
 
 QString get_on_cardid(const QString &to_get, uint cardid)
Index: libs/libmythtv/videosource.cpp
===================================================================
--- libs/libmythtv/videosource.cpp	(wersja 18962)
+++ libs/libmythtv/videosource.cpp	(kopia robocza)
@@ -2929,6 +2929,12 @@
             signal_timeout->setValue(60000);
             channel_timeout->setValue(62500);
             break;
+	case CardUtil::DVBS2:
+            cardtype->setValue("DVB-S2");
+            cardname->setValue(frontend_name);
+            signal_timeout->setValue(60000);
+            channel_timeout->setValue(62500);
+            break;
         case CardUtil::QAM:
             cardtype->setValue("DVB-C");
             cardname->setValue(frontend_name);
Index: libs/libmythtv/frequencytables.cpp
===================================================================
--- libs/libmythtv/frequencytables.cpp	(wersja 18962)
+++ libs/libmythtv/frequencytables.cpp	(kopia robocza)
@@ -68,7 +68,8 @@
         _tuning.lp_code_rate.toString(),     _tuning.modulation.toString(),
         _tuning.trans_mode.toString(),       _tuning.guard_interval.toString(),
         _tuning.hierarchy.toString(),        _tuning.modulation.toString(),
-        _tuning.bandwidth.toString());
+        _tuning.bandwidth.toString(),        _tuning.msystem.toString(),
+	_tuning.rolloff.toString());
 }
 
 TransportScanItem::TransportScanItem(uint sourceid,
Index: libs/libmythtv/scanwizard.cpp
===================================================================
--- libs/libmythtv/scanwizard.cpp	(wersja 18962)
+++ libs/libmythtv/scanwizard.cpp	(kopia robocza)
@@ -98,6 +98,11 @@
         start_chan = configPane->GetStartChan();
         parse_type = DTVTunerType::kTunerTypeQPSK;
     }
+    else if (scantype == ScanTypeSetting::NITAddScan_DVBS2)
+    {
+        start_chan = configPane->GetStartChan();
+        parse_type = DTVTunerType::kTunerTypeDVB_S2;
+    }
     else if (scantype == ScanTypeSetting::NITAddScan_QAM)
     {
         start_chan = configPane->GetStartChan();
@@ -139,7 +144,8 @@
             start_chan["coderate_hp"],    start_chan["coderate_lp"],
             start_chan["constellation"],  start_chan["trans_mode"],
             start_chan["guard_interval"], start_chan["hierarchy"],
-            start_chan["modulation"],     start_chan["bandwidth"]))
+            start_chan["modulation"],     start_chan["bandwidth"],
+	    start_chan["msystem"],        start_chan["rolloff"]))
     {
         MythPopupBox::showOkPopup(
             gContext->GetMainWindow(), tr("ScanWizard"),
@@ -150,6 +156,7 @@
 
     if (do_scan)
     {
+	VERBOSE(VB_IMPORTANT, LOC + "do_scan");
         scannerPane->Scan(
             configPane->GetScanType(),       configPane->GetCardID(),
             configPane->GetInputName(),      configPane->GetSourceID(),
Index: libs/libmythtv/scanwizardscanner.h
===================================================================
--- libs/libmythtv/scanwizardscanner.h	(wersja 18962)
+++ libs/libmythtv/scanwizardscanner.h	(kopia robocza)
@@ -82,7 +82,8 @@
               const QString &freq_std,
               const QString &mod,
               const QString &tbl,
-              const QString &atsc_format);
+              const QString &atsc_format
+	      );
 
     void ImportDVBUtils(uint sourceid, int cardtype, const QString &file);
     void ImportM3U(     uint cardid, const QString &inputname, uint sourceid);
Index: libs/libmythtv/transporteditor.cpp
===================================================================
--- libs/libmythtv/transporteditor.cpp	(wersja 18962)
+++ libs/libmythtv/transporteditor.cpp	(kopia robocza)
@@ -98,7 +98,7 @@
     MSqlQuery query(MSqlQuery::InitCon());
     query.prepare(
         "SELECT mplexid, modulation, frequency, "
-        "       symbolrate, networkid, transportid, constellation "
+        "       symbolrate, networkid, transportid, constellation, msystem "
         "FROM dtv_multiplex, videosource "
         "WHERE dtv_multiplex.sourceid = :SOURCEID AND "
         "      dtv_multiplex.sourceid = videosource.sourceid "
@@ -129,13 +129,17 @@
         QString tid = query.value(5).toUInt() ?
             QString("tid %1").arg(query.value(5).toUInt(), 5) : "";
 
-        QString hz = (CardUtil::QPSK == cardtype) ? "kHz" : "Hz";
+        QString hz = (CardUtil::QPSK == cardtype ||
+	    CardUtil::DVBS2 == cardtype) ? "kHz" : "Hz";
 
         QString type = "";
         if (CardUtil::OFDM == cardtype)
             type = "(DVB-T)";
         if (CardUtil::QPSK == cardtype)
             type = "(DVB-S)";
+	if (CardUtil::DVBS2 == cardtype)
+	    type = (query.value(7).toString() == "dvbs2")?"(DVB-S2)":"DVB-S";
+	
         if (CardUtil::QAM == cardtype)
             type = "(DVB-C)";
 
@@ -487,6 +491,20 @@
     };
 };
 
+class DVBS2ModulationSystem: public ComboBoxSetting, public MuxDBStorage
+{
+  public:
+    DVBS2ModulationSystem(const MultiplexID *id) :
+        ComboBoxSetting(this), MuxDBStorage(this, id, "msystem")
+    {
+        setLabel(QObject::tr("Modulation system"));
+        setHelpText(QObject::tr("Modulation system (Default: DVB-S)\n"
+		"Standard selection: DVB-S/DVB-S2"));
+        addSelection(QObject::tr("DVB-S"), "dvbs");
+        addSelection(QObject::tr("DVB-S2"), "dvbs2");
+    };
+};
+
 class Modulation : public ComboBoxSetting, public MuxDBStorage
 {
   public:
@@ -506,6 +524,15 @@
         // no modulation options
         setVisible(false);
     }
+    if (CardUtil::QPSK == nType)
+    {
+	addSelection("QPSK", "qpsk");
+    }
+    if (CardUtil::DVBS2 == nType)
+    {
+	addSelection("QPSK", "qpsk");
+	addSelection("8PSK", "8psk");
+    }
     else if ((CardUtil::QAM == nType) || (CardUtil::OFDM == nType))
     {
         addSelection(QObject::tr("QAM Auto"), "auto");
@@ -576,11 +603,13 @@
         addSelection("1/2");
         addSelection("2/3");
         addSelection("3/4");
+	addSelection("3/5");
         addSelection("4/5");
         addSelection("5/6");
         addSelection("6/7");
         addSelection("7/8");
         addSelection("8/9");
+	addSelection("9/10");
     };
 };
 
@@ -597,6 +626,21 @@
     };
 };
 
+class DVBS2RollOff: public ComboBoxSetting, public MuxDBStorage
+{
+  public:
+    DVBS2RollOff(const MultiplexID *id) :
+        ComboBoxSetting(this), MuxDBStorage(this, id, "rolloff")
+    {
+        setLabel(QObject::tr("Roll-off"));
+        setHelpText(QObject::tr("Roll-off (Default: 0.35)"));
+        addSelection(QObject::tr("0.35"), "0.35");
+        addSelection(QObject::tr("0.20"), "0.20");
+	addSelection(QObject::tr("0.25"), "0.25");
+	addSelection(QObject::tr("Auto"), "auto");
+    };
+};
+
 class DVBTCoderateLP :
     public DVBForwardErrorCorrectionSelector, public MuxDBStorage
 {
@@ -715,6 +759,20 @@
         right->addChild(new DVBForwardErrorCorrection(id));
         right->addChild(new SignalPolarity(id));
     }
+    else if (CardUtil::DVBS2 == nType)
+    {
+        left->addChild(new DTVStandard(id, true, false));
+        left->addChild(new Frequency(id, true));
+        left->addChild(new DVBSymbolRate(id));
+	left->addChild(new DVBInversion(id));
+	left->addChild(new SignalPolarity(id));
+
+        right = new VerticalConfigurationGroup(false, true, false, false);
+	right->addChild(new DVBS2ModulationSystem(id));
+	right->addChild(new Modulation(id, nType));
+        right->addChild(new DVBForwardErrorCorrection(id));
+	right->addChild(new DVBS2RollOff(id));
+    }
     else if (CardUtil::QAM == nType)
     {
         left->addChild(new DTVStandard(id, true, false));
Index: libs/libmythtv/scanwizardhelpers.cpp
===================================================================
--- libs/libmythtv/scanwizardhelpers.cpp	(wersja 18962)
+++ libs/libmythtv/scanwizardhelpers.cpp	(kopia robocza)
@@ -455,6 +455,12 @@
         addSelection(tr("Import channels.conf"),
                      QString::number(DVBUtilsImport));
         break;
+    case CardUtil::DVBS2:
+        addSelection(tr("Full Scan (Tuned)"),
+                     QString::number(NITAddScan_DVBS2));
+        addSelection(tr("Import channels.conf"),
+                     QString::number(DVBUtilsImport));
+        break;
     case CardUtil::QAM:
         addSelection(tr("Full Scan (Tuned)"),
                      QString::number(NITAddScan_QAM));
@@ -574,6 +580,8 @@
               paneQAM);
     addTarget(QString::number(ScanTypeSetting::NITAddScan_QPSK),
               paneQPSK);
+    addTarget(QString::number(ScanTypeSetting::NITAddScan_DVBS2),
+              paneDVBS2);
     addTarget(QString::number(ScanTypeSetting::NITAddScan_OFDM),
               paneOFDM);
     addTarget(QString::number(ScanTypeSetting::FullScan_ATSC),
@@ -766,6 +774,20 @@
         startChan["modulation"] = "qpsk";
         startChan["polarity"]   = pane->polarity();
     }
+    else if (ScanTypeSetting::NITAddScan_DVBS2 == st)
+    {
+        const DVBS2Pane *pane = paneDVBS2;
+
+        startChan["std"]        = "dvb";
+        startChan["frequency"]  = pane->frequency();
+        startChan["inversion"]  = pane->inversion();
+        startChan["symbolrate"] = pane->symbolrate();
+        startChan["fec"]        = pane->fec();
+	startChan["msystem"]    = pane->msystem();
+        startChan["modulation"] = pane->modulation();
+        startChan["polarity"]   = pane->polarity();
+	startChan["rolloff"]    = pane->rolloff();
+    }
     else if (ScanTypeSetting::NITAddScan_QAM == st)
     {
         const QAMPane *pane = paneQAM;
Index: libs/libmythtv/dtvmultiplex.cpp
===================================================================
--- libs/libmythtv/dtvmultiplex.cpp	(wersja 18962)
+++ libs/libmythtv/dtvmultiplex.cpp	(kopia robocza)
@@ -24,6 +24,8 @@
     fec            = other.fec;
     mplex          = other.mplex;
     sistandard     = other.sistandard;
+    msystem        = other.msystem;
+    rolloff        = other.rolloff;
     sistandard.detach();
     return *this;
 }
@@ -40,7 +42,9 @@
             (guard_interval == m.guard_interval) &&
             (fec == m.fec) &&
             (polarity == m.polarity) &&
-            (hierarchy == m.hierarchy));
+            (hierarchy == m.hierarchy) &&
+	    (msystem == m.msystem) &&
+	    (rolloff == m.rolloff));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -48,14 +52,15 @@
 
 QString DTVMultiplex::toString() const
 {
-    QString ret = QString("%1 %2 %3 ")
-        .arg(frequency).arg(modulation.toString()).arg(inversion.toString());
+    QString ret = QString("f: %1 mod: %2 inv: %3 fec: %4")
+        .arg(frequency).arg(modulation.toString()).arg(inversion.toString()).arg(fec.toString());
 
-    ret += QString("%1 %2 %3 %4 %5 %6 %7")
+    ret += QString("hp: %1 lp: %2 bandw: %3 transmode: %4 guardi: %5 hier: %6 polar: %7 msys: %8 rolloff: %9")
         .arg(hp_code_rate.toString()).arg(lp_code_rate.toString())
         .arg(bandwidth.toString()).arg(trans_mode.toString())
         .arg(guard_interval.toString()).arg(hierarchy.toString())
-        .arg(polarity.toString());
+        .arg(polarity.toString())
+	.arg(msystem.toString()).arg(rolloff.toString());
 
     return ret;
 }
@@ -103,6 +108,8 @@
             (inversion  == other.inversion)  &&
             (symbolrate == other.symbolrate) &&
             (fec        == other.fec);
+	    (msystem    == other.msystem);
+	    (rolloff    == other.rolloff);
     }
 
     return false;
@@ -178,7 +185,55 @@
 
     if (ok)
         frequency = _frequency.toInt(&ok);
+	
+    return ok;
+}
 
+bool DTVMultiplex::ParseDVB_S2(
+    const QString &_frequency,   const QString &_inversion,
+    const QString &_symbol_rate, const QString &_fec_inner,
+    const QString &_modulation,  const QString &_polarity,
+    const QString &_msystem,     const QString &_rolloff)
+{
+    bool ok = inversion.Parse(_inversion);
+    if (!ok)
+    {
+        VERBOSE(VB_GENERAL, LOC_WARN +
+                "Invalid inversion, falling back to 'auto'");
+
+        ok = true;
+    }
+
+    symbolrate = _symbol_rate.toInt();
+    if (!symbolrate)
+    {
+        VERBOSE(VB_IMPORTANT, LOC_ERR + "Invalid symbol rate " +
+                QString("parameter '%1', aborting.").arg(_symbol_rate));
+
+        return false;
+    }
+
+    ok &= fec.Parse(_fec_inner);
+    ok &= modulation.Parse(_modulation);
+    
+    if (!_polarity.isEmpty())
+        ok &= polarity.Parse(_polarity.toLower());
+
+    ok &= msystem.Parse(_msystem);
+
+    if (!ok)
+    {
+        VERBOSE(VB_IMPORTANT, LOC_ERR + "Invalid S2 modulation system " +
+                QString("parameter '%1', aborting.").arg(_symbol_rate));
+        return false;
+    }
+
+    if (!_rolloff.isEmpty())
+	ok &= rolloff.Parse(_rolloff);
+
+    if (ok)
+        frequency = _frequency.toInt(&ok);
+    
     return ok;
 }
 
@@ -188,7 +243,8 @@
     QString _fec,          QString _polarity,
     QString _hp_code_rate, QString _lp_code_rate,   QString _ofdm_modulation,
     QString _trans_mode,   QString _guard_interval, QString _hierarchy,
-    QString _modulation,   QString _bandwidth)
+    QString _modulation,   QString _bandwidth,
+    QString _msystem,      QString _rolloff)
 {
     if (DTVTunerType::kTunerTypeOFDM == type)
     {
@@ -199,13 +255,20 @@
     }
 
     if ((DTVTunerType::kTunerTypeQPSK   == type) ||
-        (DTVTunerType::kTunerTypeDVB_S2 == type) ||
         (DTVTunerType::kTunerTypeQAM    == type))
     {
         return ParseDVB_S_and_C(
             _frequency,       _inversion,     _symbolrate,
             _fec,             _modulation,    _polarity);
     }
+    
+    if (DTVTunerType::kTunerTypeDVB_S2 == type)
+    {
+        return ParseDVB_S2(
+            _frequency,       _inversion,     _symbolrate,
+            _fec,             _modulation,    _polarity,
+	    _msystem,         _rolloff);
+    }
 
     if (DTVTunerType::kTunerTypeATSC == type)
         return ParseATSC(_frequency, _modulation);
@@ -223,7 +286,8 @@
         "       fec,               polarity, "
         "       hp_code_rate,      lp_code_rate,   constellation, "
         "       transmission_mode, guard_interval, hierarchy, "
-        "       modulation,        bandwidth,      sistandard "
+        "       modulation,        bandwidth,      sistandard, "
+	"       msystem,           rolloff "
         "FROM dtv_multiplex "
         "WHERE dtv_multiplex.mplexid = :MPLEXID");
     query.bindValue(":MPLEXID", mplexid);
@@ -256,7 +320,8 @@
         query.value(6).toString(),  query.value(7).toString(),
         query.value(8).toString(),  query.value(9).toString(),
         query.value(10).toString(), query.value(11).toString(),
-        query.value(12).toString());
+        query.value(12).toString(), query.value(14).toString(),
+	query.value(15).toString());
 }
 
 ////////////////////////////////////////////////////////////////////////////
@@ -317,15 +382,17 @@
         " (  scanid, "
         "    mplexid,            frequency,       inversion,  "
         "    symbolrate,         fec,             polarity,   "
-        "    hp_code_rate,       lp_code_rate,    modulation, "
-        "    transmission_mode,  guard_interval,  hierarchy,  "
+        "    hp_code_rate,       lp_code_rate, "
+	"    msystem,            modulation,      rolloff,    "
+	"    transmission_mode,  guard_interval,  hierarchy,  "
         "    bandwidth,          sistandard,      tuner_type  "
         " ) "
         "VALUES "
         " ( :SCANID, "
         "   :MPLEXID,           :FREQUENCY,      :INVERSION,  "
         "   :SYMBOLRATE,        :FEC,            :POLARITY,   "
-        "   :HP_CODE_RATE,      :LP_CODE_RATE,   :MODULATION, "
+        "   :HP_CODE_RATE,      :LP_CODE_RATE,   "
+	"   :MSYSTEM,           :MODULATION,     :ROLLOFF,    "
         "   :TRANSMISSION_MODE, :GUARD_INTERVAL, :HIERARCHY,  "
         "   :BANDWIDTH,         :SISTANDARD,     :TUNER_TYPE  "
         " );");
@@ -339,7 +406,9 @@
     query.bindValue(":POLARITY", polarity.toString());
     query.bindValue(":HP_CODE_RATE", hp_code_rate.toString());
     query.bindValue(":LP_CODE_RATE", lp_code_rate.toString());
+    query.bindValue(":MSYSTEM", msystem.toString());
     query.bindValue(":MODULATION", modulation.toString());
+    query.bindValue(":ROLLOFF", rolloff.toString());
     query.bindValue(":TRANSMISSION_MODE", trans_mode.toString());
     query.bindValue(":GUARD_INTERVAL", guard_interval.toString());
     query.bindValue(":HIERARCHY", hierarchy.toString());

