Ticket #6537: svn20533s2api-part2

File svn20533s2api-part2, 126.8 KB (added by happybaby, 15 years ago)
Line 
1Index: libs/libmythtv/dtvconfparser.h
2===================================================================
3--- libs/libmythtv/dtvconfparser.h      (révision 20533)
4+++ libs/libmythtv/dtvconfparser.h      (copie de travail)
5@@ -80,7 +80,7 @@
6 {
7   public:
8     enum return_t   { ERROR_CARDTYPE, ERROR_OPEN, ERROR_PARSE, OK };
9-    enum cardtype_t { ATSC, OFDM, QPSK, QAM, UNKNOWN };
10+    enum cardtype_t { ATSC, OFDM, QPSK, DVBS2, QAM, UNKNOWN };
11 
12     DTVConfParser(enum cardtype_t _type, uint sourceid, const QString &_file);
13     virtual ~DTVConfParser() { }
14Index: libs/libmythtv/channelbase.cpp
15===================================================================
16--- libs/libmythtv/channelbase.cpp      (révision 20533)
17+++ libs/libmythtv/channelbase.cpp      (copie de travail)
18@@ -190,6 +190,7 @@
19 
20     // Fetch tuning data from the database.
21     QString tvformat, modulation, freqtable, freqid, dtv_si_std;
22+    QString msystem, rolloff;
23     int finetune;
24     uint64_t frequency;
25     int mpeg_prog_num;
26@@ -201,6 +202,7 @@
27         tvformat, modulation, freqtable, freqid,
28         finetune, frequency,
29         dtv_si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
30+        msystem, rolloff,
31         mplexid, commfree))
32     {
33         VERBOSE(VB_IMPORTANT, loc + " " + QString(
34Index: libs/libmythtv/scanwizard.h
35===================================================================
36--- libs/libmythtv/scanwizard.h (révision 20533)
37+++ libs/libmythtv/scanwizard.h (copie de travail)
38@@ -38,7 +38,7 @@
39 #include "settings.h"
40 
41 class ScanWizardConfig;
42-class ChannelScannerGUI;
43+class ScanWizardScanner;
44 
45 class MPUBLIC ScanWizard : public QObject, public ConfigurationWizard
46 {
47@@ -62,7 +62,7 @@
48     uint               lastHWCardID;
49     uint               lastHWCardType;
50     ScanWizardConfig  *configPane;
51-    ChannelScannerGUI *scannerPane;
52+    ScanWizardScanner *scannerPane;
53 };
54 
55 #endif // SCANWIZARD_H
56Index: libs/libmythtv/dvbchannel.h
57===================================================================
58--- libs/libmythtv/dvbchannel.h (révision 20533)
59+++ libs/libmythtv/dvbchannel.h (copie de travail)
60@@ -117,7 +117,6 @@
61     QString           frontend_name;
62     DTVTunerType      card_type;
63     uint64_t          capabilities;
64-    uint64_t          ext_modulations;
65     uint64_t          frequency_minimum;
66     uint64_t          frequency_maximum;
67     uint              symbol_rate_minimum;
68Index: libs/libmythtv/frequencytables.h
69===================================================================
70--- libs/libmythtv/frequencytables.h    (révision 20533)
71+++ libs/libmythtv/frequencytables.h    (copie de travail)
72@@ -76,22 +76,6 @@
73           constellation(_constellation),   trans_mode(_trans_mode),
74           guard_interval(_guard_interval), hierarchy(_hierarchy) { ; }
75 
76-    FrequencyTable(uint64_t                _frequencyStart,
77-                   uint64_t                _frequencyEnd,
78-                   uint                    _frequencyStep,
79-                   QString                 _name_format,
80-                   int                     _name_offset,
81-                   DTVCodeRate             _fec_inner,
82-                   DTVModulation           _modulation,
83-                   uint                    _symbol_rate,
84-                   int                     _offset1,
85-                   int                     _offset2)
86-        : name_format(_name_format),       name_offset(_name_offset),
87-          frequencyStart(_frequencyStart), frequencyEnd(_frequencyEnd),
88-          frequencyStep(_frequencyStep),   modulation(_modulation),
89-          offset1(_offset1),               offset2(_offset2),
90-          symbol_rate(_symbol_rate),       fec_inner(_fec_inner) { ; }
91-
92     virtual ~FrequencyTable() { ; }
93 
94     // Common Stuff
95@@ -109,14 +93,10 @@
96     DTVBandwidth      bandwidth;
97     DTVCodeRate       coderate_hp;
98     DTVCodeRate       coderate_lp;
99-    DTVModulation     constellation;
100+    DTVModulation     constellation;
101     DTVTransmitMode   trans_mode;
102     DTVGuardInterval  guard_interval;
103     DTVHierarchy      hierarchy;
104-
105-    // DVB-C/DVB-S stuff
106-    uint              symbol_rate;
107-    DTVCodeRate       fec_inner;
108 };
109 
110 /**
111Index: libs/libmythtv/channelutil.cpp
112===================================================================
113--- libs/libmythtv/channelutil.cpp      (révision 20533)
114+++ libs/libmythtv/channelutil.cpp      (copie de travail)
115@@ -77,7 +77,7 @@
116         "WHERE sourceid     = :SOURCEID   "
117         "  AND sistandard   = :SISTANDARD ";
118 
119-    if (sistandard.toLower() != "dvb")
120+    if (sistandard.toLower().left(3) != "dvb")
121         qstr += "AND frequency    = :FREQUENCY   ";
122     else
123     {
124@@ -91,7 +91,7 @@
125     query.bindValue(":SOURCEID",          db_source_id);
126     query.bindValue(":SISTANDARD",        sistandard);
127 
128-    if (sistandard.toLower() != "dvb")
129+    if (sistandard.toLower().left(3) != "dvb")
130         query.bindValue(":FREQUENCY",     frequency);
131     else
132     {
133@@ -121,7 +121,8 @@
134     signed char trans_mode,
135     QString     inner_FEC,     QString      constellation,
136     signed char hierarchy,     QString      hp_code_rate,
137-    QString     lp_code_rate,  QString      guard_interval)
138+    QString     lp_code_rate,  QString      guard_interval,
139+    QString     msystem,       QString      rolloff)
140 {
141     MSqlQuery query(MSqlQuery::InitCon());
142 
143@@ -135,7 +136,7 @@
144         // DVB specific
145         transport_id,  network_id);
146 
147-    bool isDVB = (sistandard.toLower() == "dvb");
148+    bool isDVB = (sistandard.toLower().left(3) == "dvb");
149 
150     QString updateStr =
151         "UPDATE dtv_multiplex "
152@@ -165,6 +166,10 @@
153         "lp_code_rate     = :LP_CODE_RATE, " : "";
154     updateStr += (!guard_interval.isNull()) ?
155         "guard_interval   = :GUARD_INTERVAL, " : "";
156+    updateStr += (!msystem.isNull()) ?
157+        "msystem          = :MSYSTEM, " : "";
158+    updateStr += (!rolloff.isNull()) ?
159+        "rolloff          = :ROLLOFF, " : "";
160 
161     updateStr = updateStr.left(updateStr.length()-2) + " ";
162 
163@@ -194,6 +199,8 @@
164     insertStr += (!hp_code_rate.isNull())   ? "hp_code_rate, "      : "";
165     insertStr += (!lp_code_rate.isNull())   ? "lp_code_rate, "      : "";
166     insertStr += (!guard_interval.isNull()) ? "guard_interval, "    : "";
167+    insertStr += (!msystem.isNull())        ? "msystem, "           : "";
168+    insertStr += (!rolloff.isNull())        ? "rolloff, "           : "";
169     insertStr = insertStr.left(insertStr.length()-2) + ") ";
170 
171     insertStr +=
172@@ -213,6 +220,8 @@
173     insertStr += (!hp_code_rate.isNull())   ? ":HP_CODE_RATE, "     : "";
174     insertStr += (!lp_code_rate.isNull())   ? ":LP_CODE_RATE, "     : "";
175     insertStr += (!guard_interval.isNull()) ? ":GUARD_INTERVAL, "   : "";
176+    insertStr += (!msystem.isNull())        ? ":MSYSTEM, "          : "";
177+    insertStr += (!rolloff.isNull())        ? ":ROLLOFF, "          : "";
178     insertStr = insertStr.left(insertStr.length()-2) + ");";
179 
180     query.prepare((mplex) ? updateStr : insertStr);
181@@ -254,6 +263,10 @@
182         query.bindValue(":LP_CODE_RATE",  lp_code_rate);
183     if (!guard_interval.isNull())
184         query.bindValue(":GUARD_INTERVAL",guard_interval);
185+    if (!msystem.isNull())
186+        query.bindValue(":MSYSTEM",       msystem);
187+    if (!rolloff.isNull())
188+        query.bindValue(":ROLLOFF",       rolloff);
189 
190     if (!query.exec() || !query.isActive())
191     {
192@@ -292,9 +305,13 @@
193         {
194             QString dummy_mod;
195             QString dummy_sistd;
196+            QString dummy_msystem;
197+            QString dummy_rolloff;
198             uint dummy_tsid, dummy_netid;
199             ChannelUtil::GetTuningParams(mux, dummy_mod, freq,
200-                                         dummy_tsid, dummy_netid, dummy_sistd);
201+                                         dummy_tsid, dummy_netid,
202+                                         dummy_msystem, dummy_rolloff,
203+                                         dummy_sistd);
204         }
205 
206         mux = ChannelUtil::CreateMultiplex(
207@@ -307,7 +324,8 @@
208             cd.TransmissionModeString()[0].toAscii(),
209             QString(),                         cd.ConstellationString(),
210             cd.HierarchyString()[0].toAscii(), cd.CodeRateHPString(),
211-            cd.CodeRateLPString(),             cd.GuardIntervalString());
212+            cd.CodeRateLPString(),             cd.GuardIntervalString(),
213+            QString(),                         QString());
214 
215         if (mux)
216             muxes.push_back(mux);
217@@ -334,7 +352,8 @@
218             -1,
219             cd.FECInnerString(),  QString(),
220             -1,                   QString(),
221-            QString(),            QString());
222+            QString(),                   QString(),
223+            cd.ModulationSystemString(), cd.RollOffString());
224 
225         if (mux)
226             muxes.push_back(mux);
227@@ -357,6 +376,7 @@
228             -1,
229             cd.FECInnerString(),  QString::null,
230             -1,                   QString::null,
231+            QString::null,        QString::null,
232             QString::null,        QString::null);
233 
234         if (mux)
235@@ -377,6 +397,7 @@
236         -1,
237         QString::null,      QString::null,
238         -1,                 QString::null,
239+        QString::null,      QString::null,
240         QString::null,      QString::null);
241 }
242 
243@@ -390,7 +411,8 @@
244     signed char trans_mode,
245     QString     inner_FEC,    QString     constellation,
246     signed char hierarchy,    QString     hp_code_rate,
247-    QString     lp_code_rate, QString     guard_interval)
248+    QString     lp_code_rate, QString     guard_interval,
249+    QString     msystem,      QString     rolloff)
250 {
251     return insert_dtv_multiplex(
252         sourceid,           sistandard,
253@@ -402,7 +424,8 @@
254         trans_mode,
255         inner_FEC,          constellation,
256         hierarchy,          hp_code_rate,
257-        lp_code_rate,       guard_interval);
258+        lp_code_rate,       guard_interval,
259+        msystem,            rolloff);
260 }
261 
262 uint ChannelUtil::CreateMultiplex(uint sourceid, const DTVMultiplex &mux,
263@@ -418,7 +441,8 @@
264         mux.trans_mode.toChar().toAscii(),
265         mux.fec.toString(),               mux.modulation.toString(),
266         mux.hierarchy.toChar().toAscii(), mux.hp_code_rate.toString(),
267-        mux.lp_code_rate.toString(),      mux.guard_interval.toString());
268+        mux.lp_code_rate.toString(),      mux.guard_interval.toString(),
269+        mux.msystem.toString(),           mux.rolloff.toString());
270 }
271 
272 
273@@ -706,6 +730,8 @@
274                                   uint64_t &frequency,
275                                   uint     &dvb_transportid,
276                                   uint     &dvb_networkid,
277+                                  QString  &dvb_msystem,
278+                                  QString  &dvb_rolloff,
279                                   QString  &si_std)
280 {
281     if (!mplexid || (mplexid == 32767)) /* 32767 deals with old lineups */
282@@ -713,7 +739,7 @@
283 
284     MSqlQuery query(MSqlQuery::InitCon());
285     query.prepare(
286-        "SELECT transportid, networkid, frequency, modulation, sistandard "
287+        "SELECT transportid, networkid, frequency, modulation, sistandard, msystem, rolloff "
288         "FROM dtv_multiplex "
289         "WHERE mplexid = :MPLEXID");
290     query.bindValue(":MPLEXID", mplexid);
291@@ -732,7 +758,9 @@
292     frequency       = query.value(2).toULongLong();
293     modulation      = query.value(3).toString();
294     si_std          = query.value(4).toString();
295-
296+    dvb_msystem     = query.value(5).toString();
297+       dvb_rolloff     = query.value(6).toString();
298+       
299     return true;
300 }
301 
302@@ -1483,6 +1511,7 @@
303     QString &dtv_si_std,      int           &mpeg_prog_num,
304     uint    &atsc_major,      uint          &atsc_minor,
305     uint    &dvb_transportid, uint          &dvb_networkid,
306+    QString &dvb_msystem,     QString       &dvb_rolloff,
307     uint    &mplexid,
308     bool    &commfree)
309 {
310@@ -1493,6 +1522,7 @@
311     mpeg_prog_num = -1;
312     atsc_major    = atsc_minor = mplexid = 0;
313     dvb_networkid = dvb_transportid = 0;
314+    dvb_msystem   = dvb_rolloff = QString::null;
315     commfree      = false;
316 
317     MSqlQuery query(MSqlQuery::InitCon());
318@@ -1533,9 +1563,10 @@
319 
320     if (!mplexid || (mplexid == 32767)) /* 32767 deals with old lineups */
321         return true;
322-
323
324     return GetTuningParams(mplexid, modulation, frequency,
325-                           dvb_transportid, dvb_networkid, dtv_si_std);
326+                           dvb_transportid, dvb_networkid,
327+                           dvb_msystem, dvb_rolloff, dtv_si_std);
328 }
329 
330 bool ChannelUtil::GetChannelSettings(int chanid, bool &useonairguide,
331Index: libs/libmythtv/mpeg/dvbdescriptors.h
332===================================================================
333--- libs/libmythtv/mpeg/dvbdescriptors.h        (révision 20533)
334+++ libs/libmythtv/mpeg/dvbdescriptors.h        (copie de travail)
335@@ -709,13 +709,16 @@
336     // FEC_inner                4  12.4
337     enum
338     {
339-        kInnerFEC_1_2_ConvolutionCodeRate = 0x1,
340-        kInnerFEC_2_3_ConvolutionCodeRate = 0x2,
341-        kInnerFEC_3_4_ConvolutionCodeRate = 0x3,
342-        kInnerFEC_5_6_ConvolutionCodeRate = 0x4,
343-        kInnerFEC_7_8_ConvolutionCodeRate = 0x5,
344-        kInnerFEC_8_9_ConvolutionCodeRate = 0x6,
345-        kInnerFEC_None                    = 0xF,
346+        kInnerFEC_1_2_ConvolutionCodeRate  = 0x1,
347+        kInnerFEC_2_3_ConvolutionCodeRate  = 0x2,
348+        kInnerFEC_3_4_ConvolutionCodeRate  = 0x3,
349+        kInnerFEC_5_6_ConvolutionCodeRate  = 0x4,
350+        kInnerFEC_7_8_ConvolutionCodeRate  = 0x5,
351+        kInnerFEC_8_9_ConvolutionCodeRate  = 0x6,
352+        kInnerFEC_3_5_ConvolutionCodeRate  = 0x7,
353+        kInnerFEC_4_5_ConvolutionCodeRate  = 0x8,
354+        kInnerFEC_9_10_ConvolutionCodeRate = 0x9,
355+        kInnerFEC_None                     = 0xF,
356     };
357     uint FECInner() const { return _data[12] & 0xf; }
358     QString FECInnerString() const { return coderate_inner(FECInner()); }
359@@ -769,15 +772,35 @@
360     bool IsLinearPolarization()   const { return !((_data[8]>>6)&0x1); }
361     bool IsHorizontalLeftPolarization() const { return (_data[8]>>5)&0x1; }
362     bool IsVerticalRightPolarization() const { return !((_data[8]>>5)&0x1); }
363-    // modulation               5   8.3
364+    // rolloff                  2   8.3
365+    uint RollOff() const { return (_data[8]>>3)&0x3; }
366+    QString RollOffString()  const
367+    {
368+        static QString ps[] = { "0.35", "0.20", "0.25", "auto" };
369+        return ps[RollOff()];
370+    }
371+    // modulation system        3   8.5
372     enum
373     {
374+        kModulationSystemDVBS  = 0x0,
375+        kModulationSystemDVBS2 = 0x1,
376+    };
377+    uint ModulationSystem() const { return _data[8]>>2&0x1; }
378+    QString ModulationSystemString() const
379+    {
380+        static QString mss[] = { "dvbs", "dvbs2" };
381+        return (mss[ModulationSystem()]);
382+    }
383+    // modulation               4   8.6
384+
385+    enum
386+    {
387         kModulationQPSK_NS = 0x0, // Non standard QPSK for Bell ExpressVu
388         kModulationQPSK   = 0x1,
389         kModulation8PSK   = 0x2,
390         kModulationQAM16  = 0x3,
391     };
392-    uint Modulation() const { return _data[8]&0x1f; }
393+    uint Modulation() const { return _data[8]&0x3; }
394     QString ModulationString() const
395     {
396         static QString ms[] = { "qpsk", "qpsk", "8psk", "qam_16" };
397@@ -797,13 +820,17 @@
398     // FEC_inner                4  12.4
399     enum
400     {
401-        kInnerFEC_1_2_ConvolutionCodeRate = 0x1,
402-        kInnerFEC_2_3_ConvolutionCodeRate = 0x2,
403-        kInnerFEC_3_4_ConvolutionCodeRate = 0x3,
404-        kInnerFEC_5_6_ConvolutionCodeRate = 0x4,
405-        kInnerFEC_7_8_ConvolutionCodeRate = 0x5,
406-        kInnerFEC_8_9_ConvolutionCodeRate = 0x6,
407-        kInnerFEC_None                    = 0xF,
408+        kInnerFEC_1_2_ConvolutionCodeRate  = 0x1,
409+        kInnerFEC_2_3_ConvolutionCodeRate  = 0x2,
410+        kInnerFEC_3_4_ConvolutionCodeRate  = 0x3,
411+        kInnerFEC_5_6_ConvolutionCodeRate  = 0x4,
412+        kInnerFEC_7_8_ConvolutionCodeRate  = 0x5,
413+        kInnerFEC_8_9_ConvolutionCodeRate  = 0x6,
414+        kInnerFEC_3_5_ConvolutionCodeRate  = 0x7,
415+        kInnerFEC_4_5_ConvolutionCodeRate  = 0x8,
416+        kInnerFEC_9_10_ConvolutionCodeRate = 0x9,
417+        kInnerFEC_Auto                     = 0xA,
418+        kInnerFEC_None                     = 0xF,
419     };
420     uint FECInner() const { return _data[12] & 0xf; }
421     QString FECInnerString() const { return coderate_inner(FECInner()); }
422@@ -1839,7 +1866,10 @@
423         case 0x3:  return "3/4";
424         case 0x4:  return "5/6";
425         case 0x5:  return "7/8";
426-        case 0x8:  return "8/9";
427+        case 0x6:  return "8/9";
428+        case 0x7:  return "3/5";
429+        case 0x8:  return "4/5";
430+        case 0x9:  return "9/10";
431         case 0xf:  return "none";
432         default:   return "auto"; // not actually defined in spec
433     }
434Index: libs/libmythtv/mpeg/dvbdescriptors.cpp
435===================================================================
436--- libs/libmythtv/mpeg/dvbdescriptors.cpp      (révision 20533)
437+++ libs/libmythtv/mpeg/dvbdescriptors.cpp      (copie de travail)
438@@ -418,8 +418,10 @@
439     QString str = QString("SatelliteDeliverySystemDescriptor: ");
440 
441     str.append(QString("Frequency: %1\n").arg(FrequencyHz()));
442-    str.append(QString("      Mod=%1, SymbR=%2, FECInner=%3, Orbit=%4, Pol=%5")
443+    str.append(QString("      ModSys=%1, Mod=%2, RollOff=%3. SymbR=%4, FECInner=%5, Orbit=%6, Pol=%7")
444+        .arg(ModulationSystemString())
445         .arg(ModulationString())
446+        .arg(RollOffString())
447         .arg(SymbolRateHz())
448         .arg(FECInnerString())
449         .arg(OrbitalPositionString())
450Index: libs/libmythtv/v4lchannel.cpp
451===================================================================
452--- libs/libmythtv/v4lchannel.cpp       (révision 20533)
453+++ libs/libmythtv/v4lchannel.cpp       (copie de travail)
454@@ -453,6 +453,7 @@
455 
456     // Fetch tuning data from the database.
457     QString tvformat, modulation, freqtable, freqid, dtv_si_std;
458+    QString msystem, rolloff;
459     int finetune;
460     uint64_t frequency;
461     int mpeg_prog_num;
462@@ -463,6 +464,7 @@
463         tvformat, modulation, freqtable, freqid,
464         finetune, frequency,
465         dtv_si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
466+        msystem, rolloff,
467         mplexid, commfree))
468     {
469         return false;
470@@ -738,10 +740,13 @@
471     uint64_t frequency;
472     uint     transportid;
473     uint     dvb_networkid;
474-
475+    QString  dvb_msystem;
476+    QString  dvb_rolloff;
477+   
478     if (!ChannelUtil::GetTuningParams(
479             mplexid, modulation, frequency,
480-            transportid, dvb_networkid, si_std))
481+            transportid, dvb_networkid,
482+            dvb_msystem, dvb_rolloff, si_std))
483     {
484         VERBOSE(VB_IMPORTANT, LOC_ERR + "TuneMultiplex(): " +
485                 QString("Could not find tuning parameters for multiplex %1.")
486Index: libs/libmythtv/dvbtypes.h
487===================================================================
488--- libs/libmythtv/dvbtypes.h   (révision 20533)
489+++ libs/libmythtv/dvbtypes.h   (copie de travail)
490@@ -20,13 +20,17 @@
491 #include <linux/dvb/dmx.h>
492 
493 #if (DVB_API_VERSION != 3 && DVB_API_VERSION != 5)
494-#    error "DVB driver includes with API version 3 not found!"
495+#    error "DVB driver includes with API version 3 or 5 not found!"
496 #endif
497 
498 #ifndef DVB_API_VERSION_MINOR
499 #    define DVB_API_VERSION_MINOR 0
500 #endif
501 
502+#if (DVB_API_VERSION == 5)
503+#    define USE_DVB_V5
504+#endif
505+
506 #if ((DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR >= 1) || (DVB_API_VERSION > 3))
507 #    define USE_ATSC
508 #else
509@@ -39,11 +43,7 @@
510 #    define VSB_16        (fe_modulation)(QAM_AUTO+2)
511 #endif
512 
513-#ifdef FE_GET_EXTENDED_INFO
514-  #define dvb_fe_params dvb_frontend_parameters_new
515-#else
516-  #define dvb_fe_params dvb_frontend_parameters
517-#endif
518+#define dvb_fe_params dvb_frontend_parameters
519 
520 class QString;
521 QString toString(fe_status);
522Index: libs/libmythtv/dvbchannel.cpp
523===================================================================
524--- libs/libmythtv/dvbchannel.cpp       (révision 20533)
525+++ libs/libmythtv/dvbchannel.cpp       (copie de travail)
526@@ -49,11 +49,21 @@
527 
528 static void drain_dvb_events(int fd);
529 static bool wait_for_backend(int fd, int timeout_ms);
530+
531 static struct dvb_fe_params dtvmultiplex_to_dvbparams(
532     DTVTunerType, const DTVMultiplex&);
533 static DTVMultiplex dvbparams_to_dtvmultiplex(
534     DTVTunerType, const dvb_fe_params&);
535 
536+#ifdef USE_DVB_V5
537+static bool dtvmultiplex_to_dtvproperties(
538+    DTVTunerType, const DTVMultiplex&, struct dtv_properties*, bool do_tune);
539+static bool dtvmultiplex_to_dtvproperties(
540+    DTVTunerType, const DTVMultiplex&, struct dtv_properties*);
541+static DTVMultiplex dtvproperties_to_dtvmultiplex(
542+    DTVTunerType, const dtv_properties&);
543+#endif
544+
545 #define LOC QString("DVBChan(%1:%2): ").arg(GetCardID()).arg(device)
546 #define LOC_WARN QString("DVBChan(%1:%2) Warning: ") \
547                  .arg(GetCardID()).arg(device)
548@@ -167,7 +177,6 @@
549         frontend_name       = master->frontend_name;
550         card_type           = master->card_type;
551         capabilities        = master->capabilities;
552-        ext_modulations     = master->ext_modulations;
553         frequency_minimum   = master->frequency_minimum;
554         frequency_maximum   = master->frequency_maximum;
555         symbol_rate_minimum = master->symbol_rate_minimum;
556@@ -210,59 +219,16 @@
557         return false;
558     }
559 
560-#ifdef FE_GET_EXTENDED_INFO
561-    if (info.caps & FE_HAS_EXTENDED_INFO)
562-    {
563-        bool ok = true;
564-        dvb_fe_caps_extended extinfo;
565-        bzero(&extinfo, sizeof(extinfo));
566-        if (ioctl(fd_frontend, FE_GET_EXTENDED_INFO, &extinfo) < 0)
567-        {
568-            VERBOSE(VB_IMPORTANT, LOC_ERR +
569-                    "Failed to get frontend extended information." + ENO);
570-
571-            ok = false;
572-        }
573-
574-        if (ok && (extinfo.modulations & MOD_8PSK))
575-        {
576-            if (ioctl(fd_frontend, FE_SET_STANDARD, FE_DVB_S2) < 0)
577-            {
578-                VERBOSE(VB_IMPORTANT, LOC_ERR +
579-                        "Failed to set frontend standard to DVB-S2." + ENO);
580-
581-                ok = false;
582-            }
583-            else if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0)
584-            {
585-                VERBOSE(VB_IMPORTANT, LOC_ERR +
586-                        "Failed to get frontend information." + ENO);
587-
588-                ok = false;
589-            }
590-        }
591-
592-        if (!ok)
593-        {
594-            close(fd_frontend);
595-            fd_frontend = -1;
596-            return false;
597-        }
598-
599-        ext_modulations   = extinfo.modulations;
600-    }
601-#endif
602-
603     frontend_name       = info.name;
604-    card_type           = info.type;
605     capabilities        = info.caps;
606     frequency_minimum   = info.frequency_min;
607     frequency_maximum   = info.frequency_max;
608     symbol_rate_minimum = info.symbol_rate_min;
609     symbol_rate_maximum = info.symbol_rate_max;
610+    card_type.Parse(CardUtil::ProbeDVBType(device));
611 
612-    VERBOSE(VB_RECORD, LOC + QString("Using DVB card %1, with frontend '%2'.")
613-            .arg(device).arg(frontend_name));
614+    VERBOSE(VB_RECORD, LOC + QString("Using DVB card %1, with frontend '%2', type '%3'.")
615+            .arg(device).arg(frontend_name).arg(card_type));
616 
617     // Turn on the power to the LNB
618     if (card_type == DTVTunerType::kTunerTypeQPSK ||
619@@ -309,7 +275,9 @@
620 bool DVBChannel::TuneMultiplex(uint mplexid, QString inputname)
621 {
622     DTVMultiplex tuning;
623-    if (!tuning.FillFromDB(card_type, mplexid))
624+    bool ok = true;
625+    ok = tuning.FillFromDB(card_type, mplexid);
626+    if (!ok)
627         return false;
628 
629     CheckOptions(tuning);
630@@ -365,6 +333,7 @@
631 
632     // Get the input data for the channel
633     QString tvformat, modulation, freqtable, freqid, si_std;
634+    QString msystem, rolloff;
635     int finetune;
636     uint64_t frequency;
637     int mpeg_prog_num;
638@@ -375,6 +344,7 @@
639         tvformat, modulation, freqtable, freqid,
640         finetune, frequency,
641         si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
642+        msystem, rolloff,
643         mplexid, commfree))
644     {
645         VERBOSE(VB_IMPORTANT, loc_err +
646@@ -394,7 +364,8 @@
647     if (!mplexid || !tuning.FillFromDB(card_type, mplexid))
648     {
649         VERBOSE(VB_IMPORTANT, loc_err +
650-                "Failed to initialize multiplex options");
651+                QString("Failed to initialize multiplex options (card_type=%1, mplexid=%2)").
652+                        arg(card_type).arg(mplexid));
653 
654         return false;
655     }
656@@ -509,7 +480,11 @@
657 
658     if (card_type.IsFECVariable() && !CheckCodeRate(tuning.fec))
659     {
660-        VERBOSE(VB_GENERAL, LOC_WARN + "Unsupported fec_inner parameter.");
661+        VERBOSE(VB_GENERAL, LOC_WARN +
662+                       QString("Unsupported fec_inner parameter (fec=%1, caps=%2, card_type=%3).")
663+                       .arg(tuning.fec)
664+                       .arg(capabilities)
665+                       .arg(card_type));
666     }
667 
668     if (card_type.IsModulationVariable() && !CheckModulation(tuning.modulation))
669@@ -575,17 +550,28 @@
670 bool DVBChannel::CheckCodeRate(DTVCodeRate rate) const
671 {
672     const uint64_t caps = capabilities;
673+
674+    /* Hmm... there are no FE_CAN_FEC_3_5 or FE_CAN_FEC_9_10 capabilities
675+     * in S2API defined yet.
676+     * So, let's assume that every DVB-S2 device can do them... */
677+    if (card_type == DTVTunerType::kTunerTypeDVB_S2)
678+    {
679+       if ((DTVCodeRate::kFEC_3_5  == rate) ||
680+               (DTVCodeRate::kFEC_9_10 == rate))
681+               return true;
682+    }
683+   
684     return
685-        ((DTVCodeRate::kFECNone == rate))                            ||
686-        ((DTVCodeRate::kFEC_1_2 == rate) && (caps & FE_CAN_FEC_1_2)) ||
687-        ((DTVCodeRate::kFEC_2_3 == rate) && (caps & FE_CAN_FEC_2_3)) ||
688-        ((DTVCodeRate::kFEC_3_4 == rate) && (caps & FE_CAN_FEC_3_4)) ||
689-        ((DTVCodeRate::kFEC_4_5 == rate) && (caps & FE_CAN_FEC_4_5)) ||
690-        ((DTVCodeRate::kFEC_5_6 == rate) && (caps & FE_CAN_FEC_5_6)) ||
691-        ((DTVCodeRate::kFEC_6_7 == rate) && (caps & FE_CAN_FEC_6_7)) ||
692-        ((DTVCodeRate::kFEC_7_8 == rate) && (caps & FE_CAN_FEC_7_8)) ||
693-        ((DTVCodeRate::kFEC_8_9 == rate) && (caps & FE_CAN_FEC_8_9)) ||
694-        ((DTVCodeRate::kFECAuto == rate) && (caps & FE_CAN_FEC_AUTO));
695+        ((DTVCodeRate::kFECNone  == rate))                             ||
696+        ((DTVCodeRate::kFEC_1_2  == rate) && (caps & FE_CAN_FEC_1_2))  ||
697+        ((DTVCodeRate::kFEC_2_3  == rate) && (caps & FE_CAN_FEC_2_3))  ||
698+        ((DTVCodeRate::kFEC_3_4  == rate) && (caps & FE_CAN_FEC_3_4))  ||
699+        ((DTVCodeRate::kFEC_4_5  == rate) && (caps & FE_CAN_FEC_4_5))  ||
700+        ((DTVCodeRate::kFEC_5_6  == rate) && (caps & FE_CAN_FEC_5_6))  ||
701+        ((DTVCodeRate::kFEC_6_7  == rate) && (caps & FE_CAN_FEC_6_7))  ||
702+        ((DTVCodeRate::kFEC_7_8  == rate) && (caps & FE_CAN_FEC_7_8))  ||
703+        ((DTVCodeRate::kFEC_8_9  == rate) && (caps & FE_CAN_FEC_8_9))  ||
704+        ((DTVCodeRate::kFECAuto  == rate) && (caps & FE_CAN_FEC_AUTO));
705 }
706 
707 /**
708@@ -596,15 +582,6 @@
709     const DTVModulation m = modulation;
710     const uint64_t      c = capabilities;
711 
712-#ifdef FE_GET_EXTENDED_INFO
713-    if ((c & FE_HAS_EXTENDED_INFO)            &&
714-        (DTVModulation::kModulation8PSK == m) &&
715-        (ext_modulations & DTVModulation::kModulation8PSK))
716-    {
717-        return true;
718-    }
719-#endif // FE_GET_EXTENDED_INFO
720-
721     return
722         ((DTVModulation::kModulationQPSK    == m) && (c & FE_CAN_QPSK))     ||
723         ((DTVModulation::kModulationQAM16   == m) && (c & FE_CAN_QAM_16))   ||
724@@ -640,6 +617,7 @@
725 bool DVBChannel::Tune(const DTVMultiplex &tuning, QString inputname)
726 {
727     int inputid = inputname.isEmpty() ? currentInputID : GetInputByName(inputname);
728+
729     if (inputid < 0)
730     {
731         VERBOSE(VB_IMPORTANT, LOC_ERR + QString("Tune(): Invalid input '%1'.")
732@@ -671,6 +649,7 @@
733                       bool same_input)
734 {
735     QMutexLocker lock(&tune_lock);
736+    uint64_t frequency = tuning.frequency;
737 
738     if (master)
739     {
740@@ -680,7 +659,27 @@
741     }
742 
743     bool reset = (force_reset || first_tune);
744+#ifdef USE_DVB_V5
745+    struct dtv_properties cmds;
746+
747+    //clear card cache
748+    dtv_property props[11];
749+    memset(&props, 0, sizeof(props));
750+    props[0].cmd = DTV_CLEAR;
751+    cmds.num = 1;
752+    cmds.props = props;
753+    if (ioctl(fd_frontend, FE_SET_PROPERTY, &cmds) < 0)
754+    {
755+        VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
756+                "Clearing tuner cache failed." + ENO);
757+        return false;
758+    }
759+    if ((!dtvmultiplex_to_dtvproperties(card_type, tuning, &cmds)) ||
760+       (cmds.num < 2))
761+       return false;   
762+#else
763     struct dvb_fe_params params = dtvmultiplex_to_dvbparams(card_type, tuning);
764+#endif
765 
766     bool is_dvbs = (DTVTunerType::kTunerTypeQPSK   == card_type ||
767                     DTVTunerType::kTunerTypeDVB_S2 == card_type);
768@@ -737,13 +736,24 @@
769             // make sure we tune to frequency, if the lnb has changed
770             reset = first_tune = true;
771         }
772-       
773-        params.frequency = lnb->GetIntermediateFrequency(
774-            diseqc_settings, tuning);
775 
776+        frequency = lnb->GetIntermediateFrequency(diseqc_settings, tuning);
777+#ifdef USE_DVB_V5
778+        for (uint i = 0; i < cmds.num; i++)
779+        {
780+            if (cmds.props[i].cmd == DTV_FREQUENCY)
781+            {
782+                cmds.props[i].u.data = frequency;
783+                break;
784+            }
785+        }
786+#else
787+        params.frequency = frequency;
788+
789         // if card can auto-FEC, use it -- sometimes NITs are inaccurate
790         if (capabilities & FE_CAN_FEC_AUTO)
791             params.u.qpsk.fec_inner = FEC_AUTO;
792+#endif
793     }
794 
795     VERBOSE(VB_CHANNEL, LOC + "Old Params: " +
796@@ -758,28 +768,24 @@
797     if (reset || !prev_tuning.IsEqual(card_type, tuning, 500 * freq_mult))
798     {
799         VERBOSE(VB_CHANNEL, LOC + QString("Tune(): Tuning to %1%2")
800-                .arg(params.frequency).arg(suffix));
801+                .arg(frequency).arg(suffix));
802 
803-#ifdef FE_GET_EXTENDED_INFO
804-        if (card_type == DTVTunerType::kTunerTypeDVB_S2)
805+#ifdef USE_DVB_V5
806+        VERBOSE(VB_CHANNEL, LOC + QString("Tune(): Tuning with %1 properties...").arg(cmds.num));
807+        if (ioctl(fd_frontend, FE_SET_PROPERTY, &cmds) < 0)
808         {
809-            if (ioctl(fd_frontend, FE_SET_FRONTEND2, &params) < 0)
810-            {
811-                VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
812-                        "Setting Frontend(2) tuning parameters failed." + ENO);
813-                return false;
814-            }
815+            VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
816+                    "Setting Frontend tuning parameters failed." + ENO);
817+            return false;
818         }
819-        else
820-#endif // FE_GET_EXTENDED_INFO
821+#else
822+        if (ioctl(fd_frontend, FE_SET_FRONTEND, &params) < 0)
823         {
824-            if (ioctl(fd_frontend, FE_SET_FRONTEND, &params) < 0)
825-            {
826-                VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
827-                        "Setting Frontend tuning parameters failed." + ENO);
828-                return false;
829-            }
830+            VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
831+                    "Setting Frontend tuning parameters failed." + ENO);
832+            return false;
833         }
834+#endif
835 
836         // Extra delay to add for broken DVB drivers
837         if (tuning_delay)
838@@ -835,8 +841,14 @@
839         return false;
840     }
841 
842+#ifdef USE_DVB_V5
843+    struct dtv_properties cmds;
844+    cmds.num = 0;
845+    return ioctl(fd_frontend, FE_GET_PROPERTY, &cmds) >= 0;
846+#else
847     dvb_fe_params params;
848     return ioctl(fd_frontend, FE_GET_FRONTEND, &params) >= 0;
849+#endif
850 }
851 
852 /** \fn DVBChannel::ProbeTuningParams(DTVMultiplex&) const
853@@ -868,8 +880,19 @@
854         return false;
855     }
856 
857+    int fe_ok;
858+#ifdef USE_DVB_V5
859+    struct dtv_properties cmds;
860+    dtv_property props[11];
861+    memset(&props, 0, sizeof(props));
862+    cmds.props = props;
863+    dtvmultiplex_to_dtvproperties(card_type, tuning, &cmds, false);
864+    fe_ok = ioctl(fd_frontend, FE_GET_PROPERTY, &cmds);
865+#else
866     dvb_fe_params params;
867-    if (ioctl(fd_frontend, FE_GET_FRONTEND, &params) < 0)
868+    fe_ok = ioctl(fd_frontend, FE_GET_FRONTEND, &params);
869+#endif
870+    if (fe_ok < 0)
871     {
872         VERBOSE(VB_IMPORTANT, LOC_ERR +
873                 "Getting Frontend tuning parameters failed." + ENO);
874@@ -880,7 +903,11 @@
875     uint    mplex      = tuning.mplex;
876     QString sistandard = tuning.sistandard; sistandard.detach();
877 
878+#ifdef USE_DVB_V5
879+    tuning = dtvproperties_to_dtvmultiplex(card_type, cmds);
880+#else
881     tuning = dvbparams_to_dtvmultiplex(card_type, params);
882+#endif
883 
884     tuning.mplex       = mplex;
885     tuning.sistandard  = sistandard;
886@@ -967,9 +994,7 @@
887     // We use uint16_t for sig because this is correct for DVB API 4.0,
888     // and works better than the correct int16_t for the 3.x API
889     uint16_t sig = 0;
890-
891     int ret = ioctl(fd_frontend, FE_READ_SIGNAL_STRENGTH, &sig);
892-
893     if (ok)
894         *ok = (0 == ret);
895 
896@@ -987,7 +1012,6 @@
897 
898     uint16_t snr = 0;
899     int ret = ioctl(fd_frontend, FE_READ_SNR, &snr);
900-
901     if (ok)
902         *ok = (0 == ret);
903 
904@@ -1002,7 +1026,6 @@
905 
906     uint32_t ber = 0;
907     int ret = ioctl(fd_frontend, FE_READ_BER, &ber);
908-
909     if (ok)
910         *ok = (0 == ret);
911 
912@@ -1017,7 +1040,6 @@
913 
914     uint32_t ublocks = 0;
915     int ret = ioctl(fd_frontend, FE_READ_UNCORRECTED_BLOCKS, &ublocks);
916-
917     if (ok)
918         *ok = (0 == ret);
919 
920@@ -1111,14 +1133,8 @@
921 
922     if (DTVTunerType::kTunerTypeDVB_S2 == tuner_type)
923     {
924-#ifdef FE_GET_EXTENDED_INFO
925-        params.u.qpsk2.symbol_rate = tuning.symbolrate;
926-        params.u.qpsk2.fec_inner   = (fe_code_rate_t) (int) tuning.fec;
927-        params.u.qpsk2.modulation  = (fe_modulation_t) (int) tuning.modulation;
928-#else // if !FE_GET_EXTENDED_INFO
929         VERBOSE(VB_IMPORTANT, "DVBChan Error, MythTV was compiled without "
930                 "DVB-S2 headers being present so DVB-S2 tuning will fail.");
931-#endif // !FE_GET_EXTENDED_INFO
932     }
933 
934     if (DTVTunerType::kTunerTypeQAM  == tuner_type)
935@@ -1199,3 +1215,258 @@
936 
937     return tuning;
938 }
939+
940+
941+#ifdef USE_DVB_V5
942+static DTVMultiplex dtvproperties_to_dtvmultiplex(
943+    DTVTunerType tuner_type, const dtv_properties &cmds)
944+{
945+    DTVMultiplex tuning;
946+
947+    for (uint i = 0; i < cmds.num; i++)
948+    {
949+        switch (cmds.props[i].cmd)
950+        {
951+            case DTV_MODULATION:
952+                tuning.modulation = cmds.props[i].u.data;
953+                break;
954+            case DTV_DELIVERY_SYSTEM:
955+                switch (cmds.props[i].u.data)
956+                {
957+                    case SYS_DVBS:
958+                        tuning.msystem = DTVModulationSystem::kModulationSystemDVBS;
959+                        break;
960+                    case SYS_DVBS2:
961+                        tuning.msystem = DTVModulationSystem::kModulationSystemDVBS2;
962+                        break;
963+                    case SYS_DVBT:
964+                    case SYS_DVBC_ANNEX_AC:
965+                    case SYS_DVBC_ANNEX_B:
966+#ifdef USE_ATSC
967+                    case SYS_ATSC:
968+#endif
969+                        break;
970+                    default:
971+                        VERBOSE(VB_IMPORTANT, "Unknown DVB delivery system." + ENO);
972+                };
973+                break;
974+            case DTV_FREQUENCY:
975+                if (tuning.modulation == DTVModulation::kModulationQPSK ||
976+                    tuning.modulation == DTVModulation::kModulation8PSK)
977+                    tuning.frequency = cmds.props[i].u.data / 1000UL;
978+                else
979+                    tuning.frequency = cmds.props[i].u.data;
980+                break;
981+            case DTV_SYMBOL_RATE:
982+                if (tuner_type == DTVTunerType::kTunerTypeQPSK   ||
983+                    tuner_type == DTVTunerType::kTunerTypeDVB_S2 ||
984+                    tuner_type == DTVTunerType::kTunerTypeQAM)
985+                {
986+                    if (tuning.modulation == DTVModulation::kModulationQPSK ||
987+                        tuning.modulation == DTVModulation::kModulation8PSK)
988+                        tuning.symbolrate = cmds.props[i].u.data / 1000UL;
989+                    else
990+                        tuning.symbolrate = cmds.props[i].u.data;
991+                };
992+                break;
993+            case DTV_INNER_FEC:
994+                if (tuner_type == DTVTunerType::kTunerTypeQPSK   ||
995+                    tuner_type == DTVTunerType::kTunerTypeDVB_S2 ||
996+                    tuner_type == DTVTunerType::kTunerTypeQAM)
997+                {
998+                    tuning.symbolrate = cmds.props[i].u.data;
999+                }
1000+                break;
1001+            case DTV_PILOT:
1002+                break;
1003+            case DTV_ROLLOFF:
1004+                if (tuner_type == DTVTunerType::kTunerTypeDVB_S2)
1005+                    tuning.rolloff = cmds.props[i].u.data;
1006+                break;
1007+            case DTV_INVERSION:
1008+                tuning.inversion = cmds.props[i].u.data;
1009+                break;
1010+            case DTV_BANDWIDTH_HZ:
1011+                if (tuner_type == DTVTunerType::kTunerTypeOFDM)
1012+                    tuning.bandwidth = cmds.props[i].u.data;
1013+                break;
1014+            case DTV_CODE_RATE_HP:
1015+                if (tuner_type == DTVTunerType::kTunerTypeOFDM)
1016+                    tuning.hp_code_rate = cmds.props[i].u.data;
1017+                break;
1018+            case DTV_CODE_RATE_LP:
1019+                if (tuner_type == DTVTunerType::kTunerTypeOFDM)
1020+                    tuning.lp_code_rate = cmds.props[i].u.data;
1021+                break;
1022+            case DTV_TRANSMISSION_MODE:
1023+                if (tuner_type == DTVTunerType::kTunerTypeOFDM)
1024+                    tuning.trans_mode = cmds.props[i].u.data;
1025+                break;
1026+            case DTV_GUARD_INTERVAL:
1027+                if (tuner_type == DTVTunerType::kTunerTypeOFDM)
1028+                    tuning.guard_interval = cmds.props[i].u.data;
1029+                break;
1030+            case DTV_HIERARCHY:
1031+                if (tuner_type == DTVTunerType::kTunerTypeOFDM)
1032+                    tuning.hierarchy = cmds.props[i].u.data;
1033+                break;
1034+            case DTV_TUNE:
1035+                break;
1036+            default:
1037+                VERBOSE(VB_IMPORTANT, "Unknown DTV command." + ENO);
1038+        }
1039+    }
1040+    return tuning;
1041+}
1042+
1043+static bool dtvmultiplex_to_dtvproperties(
1044+    DTVTunerType tuner_type,
1045+    const DTVMultiplex &tuning,
1046+    struct dtv_properties *cmdseq)
1047+{
1048+    return dtvmultiplex_to_dtvproperties(tuner_type, tuning, cmdseq, true);
1049+}
1050+
1051+static bool dtvmultiplex_to_dtvproperties(
1052+    DTVTunerType tuner_type,
1053+    const DTVMultiplex &tuning,
1054+    struct dtv_properties *cmdseq,
1055+    bool do_tune)
1056+{
1057+    if (tuner_type == DTVTunerType::kTunerTypeQPSK ||
1058+        (tuner_type == DTVTunerType::kTunerTypeDVB_S2 &&
1059+         tuning.modulation == DTVModulation::kModulationQPSK))
1060+    {
1061+        cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
1062+        cmdseq->props[0].u.data = SYS_DVBS;
1063+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
1064+        cmdseq->props[1].u.data = tuning.frequency;
1065+        cmdseq->props[2].cmd    = DTV_MODULATION;
1066+        cmdseq->props[2].u.data = tuning.modulation;
1067+        cmdseq->props[3].cmd    = DTV_SYMBOL_RATE;
1068+        cmdseq->props[3].u.data = tuning.symbolrate;
1069+        cmdseq->props[4].cmd    = DTV_INNER_FEC;
1070+        cmdseq->props[4].u.data = tuning.fec;
1071+        cmdseq->props[5].cmd    = DTV_INVERSION;
1072+        cmdseq->props[5].u.data = tuning.inversion;
1073+        if (do_tune)
1074+        {
1075+            cmdseq->props[6].cmd    = DTV_TUNE;
1076+            cmdseq->num = 7;
1077+        }
1078+        else
1079+        {
1080+            cmdseq->num = 6;
1081+        }
1082+    }
1083+    else if (tuner_type == DTVTunerType::kTunerTypeDVB_S2 &&
1084+             tuning.modulation == DTVModulation::kModulation8PSK)
1085+    {
1086+        cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
1087+        cmdseq->props[0].u.data = SYS_DVBS2;
1088+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
1089+        cmdseq->props[1].u.data = tuning.frequency;
1090+        cmdseq->props[2].cmd    = DTV_MODULATION;
1091+        cmdseq->props[2].u.data = tuning.modulation;
1092+        cmdseq->props[3].cmd    = DTV_SYMBOL_RATE;
1093+        cmdseq->props[3].u.data = tuning.symbolrate;
1094+        cmdseq->props[4].cmd    = DTV_INNER_FEC;
1095+        cmdseq->props[4].u.data = tuning.fec;
1096+        cmdseq->props[5].cmd    = DTV_INVERSION;
1097+        cmdseq->props[5].u.data = tuning.inversion;
1098+        cmdseq->props[6].cmd    = DTV_PILOT;
1099+        cmdseq->props[6].u.data = PILOT_AUTO;
1100+        cmdseq->props[7].cmd    = DTV_ROLLOFF;
1101+        if (tuning.msystem == DTVModulationSystem::kModulationSystemDVBS2)
1102+            cmdseq->props[7].u.data = tuning.rolloff;
1103+        else
1104+            cmdseq->props[7].u.data = DTVRollOff::kRollOff35;
1105+        if (do_tune)
1106+        {
1107+            cmdseq->props[8].cmd = DTV_TUNE;
1108+            cmdseq->num = 9;
1109+        }
1110+        else
1111+            cmdseq->num = 8;
1112+    }
1113+    else if (tuner_type == DTVTunerType::kTunerTypeQAM)
1114+    {
1115+        cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
1116+        cmdseq->props[0].u.data = (fe_delivery_system_t) (int) tuning.msystem;
1117+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
1118+        cmdseq->props[1].u.data = tuning.frequency;
1119+        cmdseq->props[2].cmd    = DTV_MODULATION;
1120+        cmdseq->props[2].u.data = (fe_modulation_t) (int) tuning.modulation;
1121+        cmdseq->props[3].cmd    = DTV_SYMBOL_RATE;
1122+        cmdseq->props[3].u.data = tuning.symbolrate;
1123+        cmdseq->props[4].cmd    = DTV_INNER_FEC;
1124+        cmdseq->props[4].u.data = (fe_code_rate_t) (int) tuning.fec;
1125+        cmdseq->props[5].cmd    = DTV_INVERSION;
1126+        cmdseq->props[5].u.data = (fe_spectral_inversion_t) (int) tuning.inversion;
1127+        if (do_tune)
1128+        {
1129+            cmdseq->props[6].cmd    = DTV_TUNE;
1130+            cmdseq->num = 7;
1131+        }
1132+        else
1133+            cmdseq->num = 6;
1134+    }
1135+    else if (tuner_type == DTVTunerType::kTunerTypeOFDM)
1136+    {
1137+        cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
1138+        cmdseq->props[0].u.data = SYS_DVBC_ANNEX_AC;
1139+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
1140+        cmdseq->props[1].u.data = tuning.frequency;
1141+        cmdseq->props[2].cmd    = DTV_MODULATION;
1142+        cmdseq->props[2].u.data = (fe_modulation_t) (int) tuning.modulation;
1143+        cmdseq->props[3].cmd    = DTV_INVERSION;
1144+        cmdseq->props[3].u.data = (fe_spectral_inversion_t) (int) tuning.inversion;
1145+        cmdseq->props[4].cmd    = DTV_BANDWIDTH_HZ;
1146+        cmdseq->props[4].u.data = (fe_bandwidth_t) (int) tuning.bandwidth;
1147+        cmdseq->props[5].cmd    = DTV_CODE_RATE_HP;
1148+        cmdseq->props[5].u.data = (fe_code_rate_t) (int) tuning.hp_code_rate;
1149+        cmdseq->props[6].cmd    = DTV_CODE_RATE_LP;
1150+        cmdseq->props[6].u.data = (fe_code_rate_t) (int) tuning.lp_code_rate;
1151+        cmdseq->props[7].cmd    = DTV_TRANSMISSION_MODE;
1152+        cmdseq->props[7].u.data = (fe_transmit_mode_t) (int) tuning.trans_mode;
1153+        cmdseq->props[8].cmd    = DTV_GUARD_INTERVAL;
1154+        cmdseq->props[8].u.data = (fe_guard_interval_t) (int) tuning.guard_interval;
1155+        cmdseq->props[9].cmd    = DTV_HIERARCHY;
1156+        cmdseq->props[9].u.data = (fe_hierarchy_t) (int) tuning.hierarchy;
1157+        if (do_tune)
1158+        {
1159+            cmdseq->props[10].cmd    = DTV_TUNE;
1160+            cmdseq->num = 11;
1161+        }
1162+        else
1163+            cmdseq->num = 10;
1164+    }
1165+#ifdef USE_ATSC
1166+    else if (tuner_type == DTVTunerType::kTunerTypeATSC)
1167+    {
1168+        cmdseq->props[0].cmd    = DTV_DELIVERY_SYSTEM;
1169+        cmdseq->props[0].u.data = SYS_ATSC;
1170+        cmdseq->props[1].cmd    = DTV_FREQUENCY;
1171+        cmdseq->props[1].u.data = tuning.frequency * 1000UL;
1172+        cmdseq->props[2].cmd    = DTV_MODULATION;
1173+        cmdseq->props[2].u.data = (fe_modulation_t) (int) tuning.modulation;;
1174+        cmdseq->props[3].cmd    = DTV_INVERSION;
1175+        cmdseq->props[3].u.data = (fe_spectral_inversion_t) (int) tuning.inversion;
1176+        if (do_tune)
1177+        {
1178+            cmdseq->props[4].cmd    = DTV_TUNE;
1179+            cmdseq->num = 5;
1180+        }
1181+        else
1182+            cmdseq->num = 4;
1183+    }
1184+#endif
1185+    else
1186+    {
1187+        VERBOSE(VB_IMPORTANT, "Unknown tuner type." + ENO);
1188+        return false;
1189+    }
1190+    return true;
1191+}
1192+#endif
1193+
1194Index: libs/libmythtv/cardutil.cpp
1195===================================================================
1196--- libs/libmythtv/cardutil.cpp (révision 20533)
1197+++ libs/libmythtv/cardutil.cpp (copie de travail)
1198@@ -249,6 +249,16 @@
1199     close(fd_frontend);
1200 
1201     DTVTunerType type(info.type);
1202+#ifdef USE_DVB_V5   
1203+    if (type == DTVTunerType::kTunerTypeQPSK)
1204+    {
1205+       /* We basically have a DVB-S device. Check capabilities to see if
1206+        * the device is capable of doing DVB-S2.
1207+        * Caution: Needs "Add missing S2 caps flag to S2API" patch in S2API. */
1208+       if (info.caps & FE_CAN_2G_MODULATION)
1209+           type = DTVTunerType::kTunerTypeDVB_S2;             
1210+       }
1211+#endif
1212     ret = (type.toString() != "UNKNOWN") ? type.toString().toUpper() : ret;
1213 #endif // USING_DVB
1214 
1215@@ -341,7 +351,7 @@
1216 {
1217     QString ct = card_type.toUpper();
1218     return (ct == "DVB") || (ct == "QAM") || (ct == "QPSK") ||
1219-        (ct == "OFDM") || (ct == "ATSC");
1220+        (ct == "OFDM") || (ct == "ATSC") || (ct == "DVB_S2");
1221 }
1222 
1223 QString get_on_cardid(const QString &to_get, uint cardid)
1224Index: libs/libmythtv/siscan.h
1225===================================================================
1226--- libs/libmythtv/siscan.h     (révision 0)
1227+++ libs/libmythtv/siscan.h     (révision 0)
1228@@ -0,0 +1,228 @@
1229+// -*- Mode: c++ -*-
1230+
1231+#ifndef SISCAN_H
1232+#define SISCAN_H
1233+
1234+#include <pthread.h>
1235+
1236+// Qt includes
1237+#include <qobject.h>
1238+#include <qstring.h>
1239+#include <qmap.h>
1240+#include <qmutex.h>
1241+#include <qdatetime.h>
1242+
1243+// MythTV includes
1244+#include "frequencytables.h"
1245+#include "streamlisteners.h"
1246+#include "dtvconfparser.h"
1247+#include "signalmonitorlistener.h"
1248+
1249+class MSqlQuery;
1250+
1251+class ChannelBase;
1252+class DTVChannel;
1253+class V4LChannel;
1254+class DVBChannel;
1255+class HDHRChannel;
1256+
1257+class SignalMonitor;
1258+class DTVSignalMonitor;
1259+class DVBSignalMonitor;
1260+
1261+typedef enum
1262+{
1263+    IDLE,           ///< Don't do anything
1264+    TRANSPORT_LIST, ///< Actively scan for channels
1265+} SCANMODE;
1266+
1267+typedef vector<const ProgramMapTable*>  pmt_vec_t;
1268+typedef QMap<uint, pmt_vec_t>           pmt_map_t;
1269+
1270+class SIScan : public QObject,
1271+               public MPEGStreamListener,
1272+               public ATSCMainStreamListener,
1273+               public DVBMainStreamListener,
1274+               public SignalMonitorListener
1275+{
1276+    Q_OBJECT
1277+  public:
1278+    SIScan(const QString &_cardtype, ChannelBase* _channel, int _sourceID,
1279+           uint signal_timeout, uint channel_timeout,
1280+           const QString &_inputname);
1281+    ~SIScan();
1282+
1283+    void StartScanner(void);
1284+    void StopScanner(void);
1285+
1286+    bool ScanTransports(
1287+        int src, const QString std, const QString mod, const QString country);
1288+    bool ScanTransportsStartingOn(
1289+        int sourceid, const QMap<QString,QString> &valueMap);
1290+    bool ScanTransport(int mplexid);
1291+    bool ScanForChannels(
1292+        uint sourceid, const QString &std, const QString &cardtype,
1293+        const DTVChannelList&);
1294+
1295+    bool ScanServicesSourceID(int SourceID);
1296+
1297+    void SetAnalog(bool is_analog)    { isAnalog                = is_analog; }
1298+    void SetSourceID(int _SourceID)   { sourceID                = _SourceID; }
1299+    void SetFTAOnly(bool _fFTAOnly)   { ignoreEncryptedServices = _fFTAOnly; }
1300+    void SetTVOnly(bool _tvOnly)
1301+        { ignoreAudioOnlyServices = ignoreDataServices = _tvOnly; }
1302+    void SetForceUpdate(bool _force)  { forceUpdate             = _force;    }
1303+    void SetRenameChannels(bool _r)   { renameChannels          = _r; }
1304+    void SetChannelFormat(const QString _fmt) { channelFormat   = _fmt; }
1305+    void SetSignalTimeout(uint val)    { signalTimeout = val; }
1306+    void SetChannelTimeout(uint val)   { channelTimeout = val; }
1307+
1308+    uint GetSignalTimeout(void)  const { return signalTimeout; }
1309+    uint GetChannelTimeout(void) const { return channelTimeout; }
1310+
1311+    SignalMonitor    *GetSignalMonitor(void) { return signalMonitor; }
1312+    DTVSignalMonitor *GetDTVSignalMonitor(void);
1313+    DVBSignalMonitor *GetDVBSignalMonitor(void);
1314+
1315+    // MPEG
1316+    void HandlePAT(const ProgramAssociationTable*);
1317+    void HandleCAT(const ConditionalAccessTable*) { }
1318+    void HandlePMT(uint, const ProgramMapTable*) { }
1319+    void HandleEncryptionStatus(uint /*pnum*/, bool /*encrypted*/) { }
1320+
1321+    // ATSC Main
1322+    void HandleSTT(const SystemTimeTable*) {}
1323+    void HandleMGT(const MasterGuideTable*);
1324+    void HandleVCT(uint tsid, const VirtualChannelTable*);
1325+
1326+    // DVB Main
1327+    void HandleNIT(const NetworkInformationTable*);
1328+    void HandleSDT(uint tsid, const ServiceDescriptionTable*);
1329+    void HandleTDT(const TimeDateTable*) {}
1330+
1331+    // SignalMonitorListener
1332+    virtual void AllGood(void);
1333+    virtual void StatusSignalLock(const SignalMonitorValue&) { }
1334+    virtual void StatusSignalStrength(const SignalMonitorValue&) { }
1335+
1336+  public slots:
1337+    void deleteLater(void);
1338+
1339+  signals:
1340+    // Values from 1-100 of scan completion
1341+    void PctServiceScanComplete(int pct);
1342+    void PctTransportScanComplete(int pct);
1343+    void ServiceScanUpdateStatusText(const QString& status);
1344+    void ServiceScanUpdateText(const QString& status);
1345+    void TransportScanUpdateText(const QString& status);
1346+    void ServiceScanComplete(void);
1347+    void TransportScanComplete(void);
1348+
1349+  private:
1350+    // some useful gets
1351+    DTVChannel       *GetDTVChannel(void);
1352+    V4LChannel       *GetV4LChannel(void);
1353+    DVBChannel       *GetDVBChannel(void);
1354+
1355+    /// \brief Called by SpawnScanner to run scanning thread
1356+    void RunScanner(void);
1357+    /// \brief Thunk to call RunScanner from pthread
1358+    static void *SpawnScanner(void *param);
1359+
1360+    bool HasTimedOut(void);
1361+    void HandleActiveScan(void);
1362+    bool Tune(const transport_scan_items_it_t transport);
1363+    uint InsertMultiplex(const transport_scan_items_it_t transport);
1364+    void ScanTransport(const transport_scan_items_it_t transport);
1365+
1366+    /// \brief Updates Transport Scan progress bar
1367+    inline void UpdateScanPercentCompleted(void);
1368+
1369+    bool CheckImportedList(const DTVChannelInfoList&,
1370+                           uint mpeg_program_num,
1371+                           QString &service_name,
1372+                           QString &callsign,
1373+                           QString &common_status_info);
1374+
1375+    void IgnoreDataOnlyMsg( const QString &name, int aux_num);
1376+    void IgnoreEmptyChanMsg(const QString &name, int aux_num);
1377+    void IgnoreAudioOnlyMsg(const QString &name, int aux_num);
1378+    void IgnoreEncryptedMsg(const QString &name, int aux_num);
1379+
1380+    void HandleMPEGDBInsertion(const ScanStreamData *sd, bool wait);
1381+    void UpdatePATinDB(int mplexid, const QString &friendlyName, int freqid,
1382+                       const ProgramAssociationTable*, const pmt_map_t&,
1383+                       const DTVChannelInfoList&, const QString &si_standard,
1384+                       bool force_update);
1385+
1386+    void UpdatePMTinDB(int sourceid,
1387+                       int mplexid, const QString &friendlyName, int freqid,
1388+                       int pmt_indx, const ProgramMapTable*,
1389+                       const DTVChannelInfoList&,
1390+                       bool force_update);
1391+
1392+    void HandleATSCDBInsertion(const ScanStreamData *sd, bool wait);
1393+    void UpdateVCTinDB(int mplexid, const QString &friendlyName, int freqid,
1394+                       const VirtualChannelTable*,
1395+                       const DTVChannelInfoList&,
1396+                       bool force_update);
1397+
1398+    void HandleDVBDBInsertion(const ScanStreamData *sd, bool wait);
1399+    void UpdateSDTinDB(int mplexid,
1400+                       const ServiceDescriptionTable*,
1401+                       const DTVChannelInfoList&,
1402+                       bool force_update);
1403+
1404+    bool HandlePostInsertion(void);
1405+
1406+    uint64_t FindBestMplexFreq(const uint64_t tuning_freq,
1407+                               const transport_scan_items_it_t transport,
1408+                               const uint sourceid, const uint transportid,
1409+                               const uint networkid);
1410+
1411+
1412+    static QString loc(const SIScan*);
1413+
1414+  private:
1415+    // Set in constructor
1416+    ChannelBase      *channel;
1417+    SignalMonitor    *signalMonitor;
1418+    int               sourceID;
1419+    SCANMODE          scanMode;
1420+    uint              signalTimeout;
1421+    uint              channelTimeout;
1422+    QString           inputname;
1423+
1424+    // Settable
1425+    bool              isAnalog;
1426+    bool              ignoreAudioOnlyServices;
1427+    bool              ignoreDataServices;
1428+    bool              ignoreEncryptedServices;
1429+    bool              forceUpdate;
1430+    bool              renameChannels;
1431+    QString           channelFormat;
1432+
1433+    // State
1434+    bool              threadExit;
1435+    bool              waitingForTables;
1436+    QTime             timer;
1437+
1438+    // Transports List
1439+    int                         transportsScanned;
1440+    transport_scan_items_t      scanTransports;
1441+    transport_scan_items_it_t   current;
1442+    transport_scan_items_it_t   nextIt;
1443+    QMap<uint, uint>            dvbChanNums;
1444+
1445+    /// Scanner thread, runs SIScan::StartScanner()
1446+    pthread_t        scanner_thread;
1447+    bool             scanner_thread_running;
1448+};
1449+
1450+inline void SIScan::UpdateScanPercentCompleted(void)
1451+{
1452+    int tmp = (transportsScanned * 100) / scanTransports.size();
1453+    emit PctServiceScanComplete(tmp);
1454+}
1455+
1456+#endif // SISCAN_H
1457Index: libs/libmythtv/videosource.cpp
1458===================================================================
1459--- libs/libmythtv/videosource.cpp      (révision 20533)
1460+++ libs/libmythtv/videosource.cpp      (copie de travail)
1461@@ -2940,6 +2940,12 @@
1462             signal_timeout->setValue(60000);
1463             channel_timeout->setValue(62500);
1464             break;
1465+        case CardUtil::DVBS2:
1466+            cardtype->setValue("DVB-S2");
1467+            cardname->setValue(frontend_name);
1468+            signal_timeout->setValue(60000);
1469+            channel_timeout->setValue(62500);
1470+            break;
1471         case CardUtil::QAM:
1472             cardtype->setValue("DVB-C");
1473             cardname->setValue(frontend_name);
1474Index: libs/libmythtv/frequencytables.cpp
1475===================================================================
1476--- libs/libmythtv/frequencytables.cpp  (révision 20533)
1477+++ libs/libmythtv/frequencytables.cpp  (copie de travail)
1478@@ -72,7 +72,9 @@
1479         _tuning.lp_code_rate.toString(),     _tuning.modulation.toString(),
1480         _tuning.trans_mode.toString(),       _tuning.guard_interval.toString(),
1481         _tuning.hierarchy.toString(),        _tuning.modulation.toString(),
1482-        _tuning.bandwidth.toString());
1483+        _tuning.bandwidth.toString(),        _tuning.msystem.toString(),
1484+        _tuning.rolloff.toString());
1485+    tuning.sistandard = _tuning.sistandard;
1486 }
1487 
1488 TransportScanItem::TransportScanItem(uint sourceid,
1489@@ -92,25 +94,24 @@
1490 
1491     // setup tuning params
1492     tuning.frequency  = freq;
1493-    tuning.sistandard = (std.toLower() != "atsc") ? "dvb" : "atsc";
1494-    tuning.modulation = ft.modulation;
1495+    tuning.sistandard = std;
1496     freq_offsets[1]   = ft.offset1;
1497     freq_offsets[2]   = ft.offset2;
1498 
1499-    if (std == "dvbt")
1500+    if (std == "dvb")
1501     {
1502         tuning.inversion      = ft.inversion;
1503         tuning.bandwidth      = ft.bandwidth;
1504         tuning.hp_code_rate   = ft.coderate_hp;
1505         tuning.lp_code_rate   = ft.coderate_lp;
1506+        tuning.modulation     = ft.modulation;
1507         tuning.trans_mode     = ft.trans_mode;
1508         tuning.guard_interval = ft.guard_interval;
1509         tuning.hierarchy      = ft.hierarchy;
1510     }
1511-    else if (std == "dvbc" || std == "dvbs")
1512+    else
1513     {
1514-        tuning.symbolrate     = ft.symbol_rate;
1515-        tuning.fec            = ft.fec_inner;
1516+        tuning.modulation     = ft.modulation;
1517     }
1518 
1519     mplexid = GetMultiplexIdFromDB();
1520@@ -284,8 +285,7 @@
1521 {
1522     // United Kingdom
1523     fmap["dvbt_ofdm_uk0"] = new FrequencyTable(
1524-        474000000, 850000000, 8000000, "Channel %1", 21,
1525-        DTVInversion::kInversionOff,
1526+        474000000, 850000000, 8000000, "" , 0, DTVInversion::kInversionOff,
1527         DTVBandwidth::kBandwidth8MHz, DTVCodeRate::kFECAuto,
1528         DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1529         DTVTransmitMode::kTransmissionMode2K,
1530@@ -294,8 +294,7 @@
1531 
1532     // Finland
1533     fmap["dvbt_ofdm_fi0"] = new FrequencyTable(
1534-        474000000, 850000000, 8000000, "Channel %1", 21,
1535-        DTVInversion::kInversionOff,
1536+        474000000, 850000000, 8000000, "", 0, DTVInversion::kInversionOff,
1537         DTVBandwidth::kBandwidth8MHz, DTVCodeRate::kFECAuto,
1538         DTVCodeRate::kFECAuto, DTVModulation::kModulationQAM64,
1539         DTVTransmitMode::kTransmissionModeAuto,
1540@@ -304,8 +303,7 @@
1541 
1542     // Sweden
1543     fmap["dvbt_ofdm_se0"] = new FrequencyTable(
1544-        474000000, 850000000, 8000000, "Channel %1", 21,
1545-        DTVInversion::kInversionOff,
1546+        474000000, 850000000, 8000000, "", 0, DTVInversion::kInversionOff,
1547         DTVBandwidth::kBandwidth8MHz, DTVCodeRate::kFECAuto,
1548         DTVCodeRate::kFECAuto, DTVModulation::kModulationQAM64,
1549         DTVTransmitMode::kTransmissionModeAuto,
1550@@ -314,16 +312,13 @@
1551 
1552     // Australia
1553     fmap["dvbt_ofdm_au0"] = new FrequencyTable(
1554-        177500000, 226500000, 7000000, "Channel %1", 6,
1555-        DTVInversion::kInversionOff,
1556+        177500000, 226500000, 7000000, "", 0, DTVInversion::kInversionOff,
1557         DTVBandwidth::kBandwidth7MHz, DTVCodeRate::kFECAuto,
1558         DTVCodeRate::kFECAuto, DTVModulation::kModulationQAM64,
1559-        DTVTransmitMode::kTransmissionMode8K,
1560-        DTVGuardInterval::kGuardIntervalAuto, DTVHierarchy::kHierarchyNone,
1561+        DTVTransmitMode::kTransmissionMode8K, DTVGuardInterval::kGuardIntervalAuto, DTVHierarchy::kHierarchyNone,
1562         DTVModulation::kModulationQAMAuto, 125000, 0); // VHF 6-12
1563     fmap["dvbt_ofdm_au1"] = new FrequencyTable(
1564-        529500000, 816500000, 7000000, "Channel %1", 28,
1565-        DTVInversion::kInversionOff,
1566+        529500000, 816500000, 7000000, "", 0, DTVInversion::kInversionOff,
1567         DTVBandwidth::kBandwidth7MHz, DTVCodeRate::kFECAuto,
1568         DTVCodeRate::kFECAuto, DTVModulation::kModulationQAM64,
1569         DTVTransmitMode::kTransmissionMode8K,
1570@@ -332,26 +327,23 @@
1571 
1572     // Germany (Deuschland)
1573     fmap["dvbt_ofdm_de0"] = new FrequencyTable(
1574-        177500000, 226500000, 7000000, "Channel %1", 6,
1575-        DTVInversion::kInversionOff,
1576+        177500000, 226500000, 7000000, "", 0, DTVInversion::kInversionOff,
1577         DTVBandwidth::kBandwidth7MHz, DTVCodeRate::kFECAuto,
1578         DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1579         DTVTransmitMode::kTransmissionMode8K,
1580         DTVGuardInterval::kGuardIntervalAuto, DTVHierarchy::kHierarchyNone,
1581-        DTVModulation::kModulationQAMAuto, 0, 0); // VHF 6-12
1582+        DTVModulation::kModulationQAMAuto, 125000, 0); // VHF 6-12
1583     fmap["dvbt_ofdm_de1"] = new FrequencyTable(
1584-        474000000, 826000000, 8000000, "Channel %1", 21,
1585-        DTVInversion::kInversionOff,
1586+        474000000, 826000000, 8000000, "", 0, DTVInversion::kInversionOff,
1587         DTVBandwidth::kBandwidth8MHz, DTVCodeRate::kFECAuto,
1588         DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1589         DTVTransmitMode::kTransmissionModeAuto,
1590         DTVGuardInterval::kGuardIntervalAuto, DTVHierarchy::kHierarchyNone,
1591-        DTVModulation::kModulationQAMAuto, 0, 0); // UHF 21-65
1592+        DTVModulation::kModulationQAMAuto, 125000, 0); // UHF 21-65
1593 
1594     // Spain
1595     fmap["dvbt_ofdm_es0"] = new FrequencyTable(
1596-        474000000, 858000000, 8000000, "Channel %1", 21,
1597-        DTVInversion::kInversionOff,
1598+        474000000, 858000000, 8000000, "", 0, DTVInversion::kInversionOff,
1599         DTVBandwidth::kBandwidth8MHz, DTVCodeRate::kFECAuto,
1600         DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1601         DTVTransmitMode::kTransmissionModeAuto,
1602@@ -360,8 +352,7 @@
1603 
1604     // New Zealand
1605     fmap["dvbt_ofdm_nz0"] = new FrequencyTable(
1606-        474000000, 858000000, 8000000, "Channel %1", 21,
1607-        DTVInversion::kInversionOff,
1608+        474000000, 858000000, 8000000, "", 0, DTVInversion::kInversionOff,
1609         DTVBandwidth::kBandwidth8MHz, DTVCodeRate::kFEC_3_4,
1610         DTVCodeRate::kFEC_3_4, DTVModulation::kModulationQAM64,
1611         DTVTransmitMode::kTransmissionMode8K,
1612@@ -370,54 +361,13 @@
1613 
1614     // france
1615     fmap["dvbt_ofdm_fr0"] = new FrequencyTable(
1616-        474000000, 850000000, 8000000, "Channel %1", 21,
1617-        DTVInversion::kInversionOff,
1618+        474000000, 850000000, 8000000, "" , 0, DTVInversion::kInversionOff,
1619         DTVBandwidth::kBandwidth8MHz, DTVCodeRate::kFECAuto,
1620         DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1621         DTVTransmitMode::kTransmissionMode8K,
1622         DTVGuardInterval::kGuardIntervalAuto, DTVHierarchy::kHierarchyNone,
1623         DTVModulation::kModulationQAMAuto, 167000, -166000);
1624-
1625-    // DVB-C Germany
1626-    fmap["dvbc_qam_de0"] = new FrequencyTable(
1627-         73000000,  73000000, 8000000, "Channel D%1", 73,
1628-        DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1629-        6900000, 0, 0);
1630-    fmap["dvbc_qam_de1"] = new FrequencyTable(
1631-         81000000,  81000000, 8000000, "Channel D%1", 81,
1632-        DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1633-        6900000, 0, 0);
1634-    fmap["dvbc_qam_de2"] = new FrequencyTable(
1635-        113000000, 121000000, 8000000, "Channel S0%1", 2,
1636-        DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1637-        6900000, 0, 0);
1638-    fmap["dvbc_qam_de3"] = new FrequencyTable(
1639-        306000000, 466000000, 8000000, "Channel S%1", 21,
1640-        DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1641-        6900000, 0, 0);
1642-    fmap["dvbc_qam_de4"] = new FrequencyTable(
1643-        474000000, 858000000, 8000000, "Channel %1", 21,
1644-        DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1645-        6900000, 0, 0);
1646-
1647-    fmap["dvbc_qam_uk0"] = new FrequencyTable(
1648-        12324000, 12324000+1, 10, "Channel %1", 1,
1649-        DTVCodeRate::kFEC_3_4, DTVModulation::kModulationQAMAuto,
1650-        29500000, 0, 0);
1651-    fmap["dvbc_qam_uk1"] = new FrequencyTable(
1652-        459000000, 459000000+1, 10, "Channel %1", 2,
1653-        DTVCodeRate::kFEC_3_4, DTVModulation::kModulationQAM64,
1654-        6952000, 0, 0);
1655-
1656-    fmap["dvbc_qam_bf0"] = new FrequencyTable(
1657-        203000000, 795000000, 100000, "BF Channel %1", 1,
1658-        DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1659-        6900000, 0, 0);
1660-    fmap["dvbc_qam_bf1"] = new FrequencyTable(
1661-        194750000, 794750000, 100000, "BF Channel %1", 1 + (795000-203000) / 100,
1662-        DTVCodeRate::kFECAuto, DTVModulation::kModulationQAMAuto,
1663-        6900000, 0, 0);
1664-
1665+   
1666 //#define DEBUG_DVB_OFFSETS
1667 #ifdef DEBUG_DVB_OFFSETS
1668     // UHF 14-69
1669Index: libs/libmythtv/scanwizard.cpp
1670===================================================================
1671--- libs/libmythtv/scanwizard.cpp       (révision 20533)
1672+++ libs/libmythtv/scanwizard.cpp       (copie de travail)
1673@@ -29,14 +29,12 @@
1674  *
1675  */
1676 
1677-#include "scanwizardconfig.h"
1678-#include "channelscanner_gui.h"
1679+#include "scanwizardhelpers.h"
1680+#include "scanwizardscanner.h"
1681 #include "scanwizard.h"
1682 #include "sourceutil.h"
1683 #include "cardutil.h"
1684 #include "videosource.h"
1685-#include "scaninfo.h"
1686-#include "channelimporter.h"
1687 #include "mythverbose.h"
1688 
1689 #define LOC QString("SWiz: ")
1690@@ -49,7 +47,7 @@
1691     lastHWCardType(CardUtil::ERROR_PROBE),
1692     configPane(new ScanWizardConfig(
1693                    this, default_sourceid, default_cardid, default_inputname)),
1694-    scannerPane(new ChannelScannerGUI())
1695+    scannerPane(new ScanWizardScanner())
1696 {
1697     addChild(configPane);
1698     addChild(scannerPane);
1699@@ -68,8 +66,8 @@
1700 
1701 void ScanWizard::SetPage(const QString &pageTitle)
1702 {
1703-    VERBOSE(VB_CHANSCAN, QString("SetPage(%1)").arg(pageTitle));
1704-    if (pageTitle != ChannelScannerGUI::kTitle)
1705+    VERBOSE(VB_SIPARSER, QString("SetPage(%1)").arg(pageTitle));
1706+    if (pageTitle != ScanWizardScanner::kTitle)
1707         return;
1708 
1709     QMap<QString,QString> start_chan;
1710@@ -81,7 +79,7 @@
1711     int     scantype  = configPane->GetScanType();
1712     bool    do_scan   = true;
1713 
1714-    VERBOSE(VB_CHANSCAN, LOC + "SetPage(): " +
1715+    VERBOSE(VB_SIPARSER, LOC + "SetPage(): " +
1716             QString("type(%1) cardid(%2) inputname(%3)")
1717             .arg(scantype).arg(cardid).arg(inputname));
1718 
1719@@ -90,19 +88,24 @@
1720         scannerPane->ImportDVBUtils(sourceid, lastHWCardType,
1721                                     configPane->GetFilename());
1722     }
1723-    else if (scantype == ScanTypeSetting::NITAddScan_DVBT)
1724+    else if (scantype == ScanTypeSetting::NITAddScan_OFDM)
1725     {
1726         start_chan = configPane->GetStartChan();
1727         parse_type = DTVTunerType::kTunerTypeOFDM;
1728     }
1729-    else if (scantype == ScanTypeSetting::NITAddScan_DVBS)
1730+    else if (scantype == ScanTypeSetting::NITAddScan_QPSK)
1731     {
1732         start_chan = configPane->GetStartChan();
1733         parse_type = DTVTunerType::kTunerTypeQPSK;
1734     }
1735-    else if (scantype == ScanTypeSetting::NITAddScan_DVBC)
1736+    else if (scantype == ScanTypeSetting::NITAddScan_DVBS2)
1737     {
1738         start_chan = configPane->GetStartChan();
1739+        parse_type = DTVTunerType::kTunerTypeDVB_S2;
1740+    }
1741+    else if (scantype == ScanTypeSetting::NITAddScan_QAM)
1742+    {
1743+        start_chan = configPane->GetStartChan();
1744         parse_type = DTVTunerType::kTunerTypeQAM;
1745     }
1746     else if (scantype == ScanTypeSetting::IPTVImport)
1747@@ -113,23 +116,15 @@
1748     else if ((scantype == ScanTypeSetting::FullScan_ATSC)     ||
1749              (scantype == ScanTypeSetting::FullTransportScan) ||
1750              (scantype == ScanTypeSetting::TransportScan)     ||
1751-             (scantype == ScanTypeSetting::FullScan_DVBT)     ||
1752+             (scantype == ScanTypeSetting::FullScan_OFDM)     ||
1753              (scantype == ScanTypeSetting::FullScan_Analog))
1754     {
1755         ;
1756     }
1757-    else if (scantype == ScanTypeSetting::ExistingScanImport)
1758-    {
1759-        do_scan = false;
1760-        uint scanid = configPane->GetScanID();
1761-        ScanDTVTransportList transports = LoadScan(scanid);
1762-        ChannelImporter ci(true, true, true, false);
1763-        ci.Process(transports);
1764-    }
1765     else
1766     {
1767         do_scan = false;
1768-        VERBOSE(VB_CHANSCAN, LOC_ERR + "SetPage(): " +
1769+        VERBOSE(VB_SIPARSER, LOC_ERR + "SetPage(): " +
1770                 QString("type(%1) src(%2) cardid(%3) not handled")
1771                 .arg(scantype).arg(sourceid).arg(cardid));
1772 
1773@@ -149,7 +144,8 @@
1774             start_chan["coderate_hp"],    start_chan["coderate_lp"],
1775             start_chan["constellation"],  start_chan["trans_mode"],
1776             start_chan["guard_interval"], start_chan["hierarchy"],
1777-            start_chan["modulation"],     start_chan["bandwidth"]))
1778+            start_chan["modulation"],     start_chan["bandwidth"],
1779+            start_chan["msystem"],        start_chan["rolloff"]))
1780     {
1781         MythPopupBox::showOkPopup(
1782             gContext->GetMainWindow(), tr("ScanWizard"),
1783@@ -160,18 +156,14 @@
1784 
1785     if (do_scan)
1786     {
1787-        QString table_start, table_end;
1788-        configPane->GetFrequencyTableRange(table_start, table_end);
1789-
1790         scannerPane->Scan(
1791             configPane->GetScanType(),       configPane->GetCardID(),
1792             configPane->GetInputName(),      configPane->GetSourceID(),
1793-            /*configPane->DoDeleteChannels(),configPane->DoRenameChannels(),*/
1794+            configPane->DoDeleteChannels(),  configPane->DoRenameChannels(),
1795             configPane->DoIgnoreSignalTimeout(), configPane->GetMultiplex(),
1796             start_chan,
1797             configPane->GetFrequencyStandard(), configPane->GetModulation(),
1798-            configPane->GetFrequencyTable()/*,configPane->GetATSCFormat()*/,
1799-            table_start, table_end);
1800+            configPane->GetFrequencyTable(), configPane->GetATSCFormat());
1801     }
1802 }
1803 
1804@@ -191,5 +183,7 @@
1805         lastHWCardID    = cardid;
1806         QString subtype = CardUtil::ProbeSubTypeName(cardid);
1807         lastHWCardType  = CardUtil::toCardType(subtype);
1808+        configPane->SetDefaultATSCFormat(
1809+            SourceUtil::GetChannelFormat(configPane->GetSourceID()));
1810     }
1811 }
1812Index: libs/libmythtv/scanwizardscanner.h
1813===================================================================
1814--- libs/libmythtv/scanwizardscanner.h  (révision 0)
1815+++ libs/libmythtv/scanwizardscanner.h  (révision 0)
1816@@ -0,0 +1,148 @@
1817+/* -*- Mode: c++ -*-
1818+ * vim: set expandtab tabstop=4 shiftwidth=4:
1819+ *
1820+ * Original Project
1821+ *      MythTV      http://www.mythtv.org
1822+ *
1823+ * Author(s):
1824+ *      John Pullan  (john@pullan.org)
1825+ *
1826+ * Description:
1827+ *     Collection of classes to provide dvb channel scanning
1828+ *     functionallity
1829+ *
1830+ *
1831+ * This program is free software; you can redistribute it and/or
1832+ * modify it under the terms of the GNU General Public License
1833+ * as published by the Free Software Foundation; either version 2
1834+ * of the License, or (at your option) any later version.
1835+ *
1836+ * This program is distributed in the hope that it will be useful,
1837+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1838+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1839+ * GNU General Public License for more details.
1840+ *
1841+ * You should have received a copy of the GNU General Public License
1842+ * along with this program; if not, write to the Free Software
1843+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1844+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
1845+ *
1846+ */
1847+
1848+#ifndef _SCANWIZARDSCANNER_H_
1849+#define _SCANWIZARDSCANNER_H_
1850+
1851+// Standard UNIX C headers
1852+#include <pthread.h>
1853+
1854+// Qt headers
1855+#include <qstring.h>
1856+#include <QEvent>
1857+
1858+// MythTV headers
1859+#include "settings.h"
1860+#include "dtvconfparser.h"
1861+#include "signalmonitorlistener.h"
1862+
1863+class ScanWizard;
1864+class AnalogScan;
1865+class IPTVChannelFetcher;
1866+class LogList;
1867+class SIScan;
1868+class ScanProgressPopup;
1869+
1870+class ChannelBase;
1871+class V4LChannel;
1872+class DVBChannel;
1873+class SignalMonitorValue;
1874+
1875+class ScanWizardScanner :
1876+    public VerticalConfigurationGroup,
1877+    public DVBSignalMonitorListener
1878+{
1879+    Q_OBJECT
1880+
1881+    friend void *spawn_popup(void*);
1882+
1883+  public:
1884+    ScanWizardScanner(void);
1885+    virtual void deleteLater(void)
1886+        { Teardown(); VerticalConfigurationGroup::deleteLater(); }
1887+
1888+    void Scan(int            scantype,
1889+              uint           cardid,
1890+              const QString &inputname,
1891+              uint           sourceid,
1892+              bool           do_delete_channels,
1893+              bool           do_rename_channels,
1894+              bool           do_ignore_signal_timeout,
1895+              // stuff needed for particular scans
1896+              uint           mplexid,
1897+              const QMap<QString,QString> &startChan,
1898+              const QString &freq_std,
1899+              const QString &mod,
1900+              const QString &tbl,
1901+              const QString &atsc_format);
1902+
1903+    void ImportDVBUtils(uint sourceid, int cardtype, const QString &file);
1904+    void ImportM3U(     uint cardid, const QString &inputname, uint sourceid);
1905+
1906+    // SignalMonitorListener
1907+    virtual void AllGood(void) { }
1908+    virtual void StatusSignalLock(const SignalMonitorValue&);
1909+    virtual void StatusSignalStrength(const SignalMonitorValue&);
1910+
1911+    // DVBSignalMonitorListener
1912+    virtual void StatusSignalToNoise(const SignalMonitorValue&);
1913+    virtual void StatusBitErrorRate(const SignalMonitorValue&) { }
1914+    virtual void StatusUncorrectedBlocks(const SignalMonitorValue&) { }
1915+    virtual void StatusRotorPosition(const SignalMonitorValue&) { }
1916+
1917+  protected slots:
1918+    void CancelScan(void) { Teardown(); }
1919+    void scanComplete(void);
1920+    void transportScanComplete(void);
1921+    void updateText(const QString& status);
1922+    void updateStatusText(const QString& status);
1923+
1924+    void serviceScanPctComplete(int pct);
1925+
1926+  protected:
1927+    ~ScanWizardScanner();
1928+    void Teardown(void);
1929+
1930+    void PreScanCommon(int scantype, uint cardid,
1931+                       const QString &inputname,
1932+                       uint sourceid, bool do_ignore_signal_timeout);
1933+
1934+    void dvbLock(int);
1935+    void dvbSNR(int);
1936+    void dvbSignalStrength(int);
1937+    void customEvent(QEvent *e);
1938+
1939+    void MonitorProgress(bool lock, bool strength, bool snr);
1940+    void RunPopup(void);
1941+    void StopPopup(void);
1942+
1943+  public:
1944+    static QString kTitle;
1945+
1946+  private:
1947+    LogList           *log;
1948+    ChannelBase       *channel;
1949+
1950+    ScanProgressPopup  *popupProgress;
1951+    pthread_t           popup_thread;
1952+    mutable QMutex      popupLock;
1953+
1954+    SIScan             *scanner;
1955+    IPTVChannelFetcher *freeboxScanner;
1956+
1957+    uint               nVideoSource;
1958+
1959+    // dvb-utils imported channels
1960+    DTVChannelList channels;
1961+};
1962+
1963+#endif // _SCANWIZARDSCANNER_H_
1964+
1965Index: libs/libmythtv/iptv/iptvchannelfetcher.cpp
1966===================================================================
1967--- libs/libmythtv/iptv/iptvchannelfetcher.cpp  (révision 20533)
1968+++ libs/libmythtv/iptv/iptvchannelfetcher.cpp  (copie de travail)
1969@@ -15,7 +15,6 @@
1970 #include "cardutil.h"
1971 #include "channelutil.h"
1972 #include "iptvchannelfetcher.h"
1973-#include "scanmonitor.h"
1974 
1975 #define LOC QString("IPTVChanFetch: ")
1976 #define LOC_ERR QString("IPTVChanFetch, Error: ")
1977@@ -39,9 +38,7 @@
1978 }
1979 
1980 IPTVChannelFetcher::IPTVChannelFetcher(
1981-    uint cardid, const QString &inputname, uint sourceid,
1982-    ScanMonitor *monitor) :
1983-    _scan_monitor(monitor),
1984+    uint cardid, const QString &inputname, uint sourceid) :
1985     _cardid(cardid),       _inputname(inputname),
1986     _sourceid(sourceid),
1987     _chan_cnt(1),          _thread_running(false),
1988@@ -118,11 +115,8 @@
1989     VERBOSE(VB_CHANNEL, QString("Playlist URL: %1").arg(url));
1990 
1991     // Step 2/4 : Download
1992-    if (_scan_monitor)
1993-    {
1994-        _scan_monitor->ScanPercentComplete(5);
1995-        _scan_monitor->ScanAppendTextToLog(QObject::tr("Downloading Playlist"));
1996-    }
1997+    emit ServiceScanPercentComplete(5);
1998+    emit ServiceScanUpdateText(tr("Downloading Playlist"));
1999 
2000     QString playlist = DownloadPlaylist(url, true);
2001 
2002@@ -133,17 +127,13 @@
2003     }
2004 
2005     // Step 3/4 : Process
2006-    if (_scan_monitor)
2007-    {
2008-        _scan_monitor->ScanPercentComplete(35);
2009-        _scan_monitor->ScanAppendTextToLog(QObject::tr("Processing Playlist"));
2010-    }
2011+    emit ServiceScanPercentComplete(35);
2012+    emit ServiceScanUpdateText(tr("Processing Playlist"));
2013 
2014     const fbox_chan_map_t channels = ParsePlaylist(playlist, this);
2015 
2016     // Step 4/4 : Finish up
2017-    if (_scan_monitor)
2018-        _scan_monitor->ScanAppendTextToLog(QObject::tr("Adding Channels"));
2019+    emit ServiceScanUpdateText(tr("Adding Channels"));
2020     SetTotalNumChannels(channels.size());
2021     fbox_chan_map_t::const_iterator it = channels.begin();   
2022     for (uint i = 1; it != channels.end(); ++it, ++i)
2023@@ -151,16 +141,12 @@
2024         QString channum = it.key();
2025         QString name    = (*it).m_name;
2026         QString xmltvid = (*it).m_xmltvid.isEmpty() ? "" : (*it).m_xmltvid;
2027-        QString msg = QObject::tr("Channel #%1 : %2").arg(channum).arg(name);
2028+        QString msg     = tr("Channel #%1 : %2").arg(channum).arg(name);
2029 
2030         int chanid = ChannelUtil::GetChanID(_sourceid, channum);
2031         if (chanid <= 0)
2032         {
2033-            if (_scan_monitor)
2034-            {
2035-                _scan_monitor->ScanAppendTextToLog(
2036-                    QObject::tr("Adding %1").arg(msg));
2037-            }
2038+            emit ServiceScanUpdateText(tr("Adding %1").arg(msg));
2039             chanid = ChannelUtil::CreateChanID(_sourceid, channum);
2040             ChannelUtil::CreateChannel(
2041                 0, _sourceid, chanid, name, name, channum,
2042@@ -169,11 +155,7 @@
2043         }
2044         else
2045         {
2046-            if (_scan_monitor)
2047-            {
2048-                _scan_monitor->ScanAppendTextToLog(
2049-                    QObject::tr("Updating %1").arg(msg));
2050-            }
2051+            emit ServiceScanUpdateText(tr("Updating %1").arg(msg));
2052             ChannelUtil::UpdateChannel(
2053                 0, _sourceid, chanid, name, name, channum,
2054                 0, 0, 0, false, false, false, QString::null,
2055@@ -183,13 +165,10 @@
2056         SetNumChannelsInserted(i);
2057     }
2058 
2059-    if (_scan_monitor)
2060-    {
2061-        _scan_monitor->ScanAppendTextToLog(QObject::tr("Done"));
2062-        _scan_monitor->ScanAppendTextToLog("");
2063-        _scan_monitor->ScanPercentComplete(100);
2064-        _scan_monitor->ScanComplete();
2065-    }
2066+    emit ServiceScanUpdateText(tr("Done"));
2067+    emit ServiceScanUpdateText("");
2068+    emit ServiceScanPercentComplete(100);
2069+    emit ServiceScanComplete();
2070 
2071     _thread_running = false;
2072 }
2073@@ -198,22 +177,19 @@
2074 {
2075     uint minval = 35, range = 70 - minval;
2076     uint pct = minval + (uint) truncf((((float)val) / _chan_cnt) * range);
2077-    if (_scan_monitor)
2078-        _scan_monitor->ScanPercentComplete(pct);
2079+    emit ServiceScanPercentComplete(pct);
2080 }
2081 
2082 void IPTVChannelFetcher::SetNumChannelsInserted(uint val)
2083 {
2084     uint minval = 70, range = 100 - minval;
2085     uint pct = minval + (uint) truncf((((float)val) / _chan_cnt) * range);
2086-    if (_scan_monitor)
2087-        _scan_monitor->ScanPercentComplete(pct);
2088+    emit ServiceScanPercentComplete(pct);
2089 }
2090 
2091 void IPTVChannelFetcher::SetMessage(const QString &status)
2092 {
2093-    if (_scan_monitor)
2094-        _scan_monitor->ScanAppendTextToLog(status);
2095+    emit ServiceScanUpdateText(status);
2096 }
2097 
2098 QString IPTVChannelFetcher::DownloadPlaylist(const QString &url,
2099@@ -289,10 +265,7 @@
2100                 QString("Invalid channel list header (%1)").arg(header));
2101 
2102         if (fetcher)
2103-        {
2104-            fetcher->SetMessage(
2105-                QObject::tr("ERROR: M3U channel list is malformed"));
2106-        }
2107+            fetcher->SetMessage(tr("ERROR: M3U channel list is malformed"));
2108 
2109         return chanmap;
2110     }
2111@@ -317,12 +290,12 @@
2112         if (!parse_chan_info(rawdata, info, channum, lineNum))
2113             break;
2114 
2115-        QString msg = QObject::tr("Encountered malformed channel");
2116+        QString msg = tr("Encountered malformed channel");
2117         if (!channum.isEmpty())
2118         {
2119             chanmap[channum] = info;
2120 
2121-            msg = QObject::tr("Parsing Channel #%1 : %2 : %3")
2122+            msg = tr("Parsing Channel #%1 : %2 : %3")
2123                 .arg(channum).arg(info.m_name).arg(info.m_url);
2124             VERBOSE(VB_CHANNEL, msg);
2125 
2126Index: libs/libmythtv/iptv/iptvchannelfetcher.h
2127===================================================================
2128--- libs/libmythtv/iptv/iptvchannelfetcher.h    (révision 20533)
2129+++ libs/libmythtv/iptv/iptvchannelfetcher.h    (copie de travail)
2130@@ -2,14 +2,13 @@
2131 #define _IPTVCHANNELFETCHER_H_
2132 
2133 // Qt headers
2134-#include <QObject>
2135-#include <QMutex>
2136-#include <QThread>
2137+#include <qobject.h>
2138+#include <qmutex.h>
2139+#include <qthread.h>
2140 
2141 // MythTV headers
2142 #include "iptvchannelinfo.h"
2143 
2144-class ScanMonitor;
2145 class IPTVChannelFetcher;
2146 
2147 class IPTVChannelFetcherThread : public QThread
2148@@ -19,14 +18,14 @@
2149     IPTVChannelFetcher *iptvfetcher;
2150 };
2151 
2152-class IPTVChannelFetcher
2153+class IPTVChannelFetcher : public QObject
2154 {
2155+    Q_OBJECT
2156+
2157     friend class IPTVChannelFetcherThread;
2158 
2159   public:
2160-    IPTVChannelFetcher(uint cardid, const QString &inputname, uint sourceid,
2161-                       ScanMonitor *monitor = NULL);
2162-    ~IPTVChannelFetcher();
2163+    IPTVChannelFetcher(uint cardid, const QString &inputname, uint sourceid);
2164 
2165     bool Scan(void);
2166     void Stop(void);
2167@@ -35,17 +34,27 @@
2168     static fbox_chan_map_t ParsePlaylist(
2169         const QString &rawdata, IPTVChannelFetcher *fetcher = NULL);
2170 
2171+  signals:
2172+    /** \brief Tells listener how far along we are from 0..100%
2173+     *  \param p percentage completion
2174+     */
2175+    void ServiceScanPercentComplete(int p);
2176+    /// \brief Returns tatus message from the scanner
2177+    void ServiceScanUpdateText(const QString &status);
2178+    /// \brief Signals that the scan is complete
2179+    void ServiceScanComplete(void);
2180+
2181+  protected:
2182+    void RunScan(void);
2183+
2184   private:
2185+    ~IPTVChannelFetcher();
2186     void SetTotalNumChannels(uint val) { _chan_cnt = (val) ? val : 1; }
2187     void SetNumChannelsParsed(uint);
2188     void SetNumChannelsInserted(uint);
2189     void SetMessage(const QString &status);
2190 
2191-  protected:
2192-    void RunScan(void);
2193-
2194   private:
2195-    ScanMonitor *_scan_monitor;
2196     uint      _cardid;
2197     QString   _inputname;
2198     uint      _sourceid;
2199Index: libs/libmythtv/transporteditor.cpp
2200===================================================================
2201--- libs/libmythtv/transporteditor.cpp  (révision 20533)
2202+++ libs/libmythtv/transporteditor.cpp  (copie de travail)
2203@@ -98,7 +98,7 @@
2204     MSqlQuery query(MSqlQuery::InitCon());
2205     query.prepare(
2206         "SELECT mplexid, modulation, frequency, "
2207-        "       symbolrate, networkid, transportid, constellation "
2208+        "       symbolrate, networkid, transportid, constellation, msystem "
2209         "FROM dtv_multiplex, videosource "
2210         "WHERE dtv_multiplex.sourceid = :SOURCEID AND "
2211         "      dtv_multiplex.sourceid = videosource.sourceid "
2212@@ -129,13 +129,17 @@
2213         QString tid = query.value(5).toUInt() ?
2214             QString("tid %1").arg(query.value(5).toUInt(), 5) : "";
2215 
2216-        QString hz = (CardUtil::QPSK == cardtype) ? "kHz" : "Hz";
2217+        QString hz = (CardUtil::QPSK == cardtype ||
2218+                      CardUtil::DVBS2 == cardtype) ? "kHz" : "Hz";
2219 
2220         QString type = "";
2221         if (CardUtil::OFDM == cardtype)
2222             type = "(DVB-T)";
2223         if (CardUtil::QPSK == cardtype)
2224             type = "(DVB-S)";
2225+        if (CardUtil::DVBS2 == cardtype)
2226+            type = (query.value(7).toString() == "dvbs2")?"(DVB-S2)":"(DVB-S)";
2227+
2228         if (CardUtil::QAM == cardtype)
2229             type = "(DVB-C)";
2230 
2231@@ -487,6 +491,20 @@
2232     };
2233 };
2234 
2235+class DVBS2ModulationSystem: public ComboBoxSetting, public MuxDBStorage
2236+{
2237+  public:
2238+    DVBS2ModulationSystem(const MultiplexID *id) :
2239+        ComboBoxSetting(this), MuxDBStorage(this, id, "msystem")
2240+    {
2241+        setLabel(QObject::tr("Modulation system"));
2242+        setHelpText(QObject::tr("Modulation system (Default: DVB-S)\n"
2243+                                "Standard selection: DVB-S/DVB-S2"));
2244+        addSelection(QObject::tr("DVB-S"), "dvbs");
2245+        addSelection(QObject::tr("DVB-S2"), "dvbs2");
2246+    };
2247+};
2248+
2249 class Modulation : public ComboBoxSetting, public MuxDBStorage
2250 {
2251   public:
2252@@ -506,6 +524,15 @@
2253         // no modulation options
2254         setVisible(false);
2255     }
2256+    if (CardUtil::QPSK == nType)
2257+    {
2258+        addSelection("QPSK", "qpsk");
2259+    }
2260+    if (CardUtil::DVBS2 == nType)
2261+    {
2262+        addSelection("QPSK", "qpsk");
2263+        addSelection("8PSK", "8psk");
2264+    }
2265     else if ((CardUtil::QAM == nType) || (CardUtil::OFDM == nType))
2266     {
2267         addSelection(QObject::tr("QAM Auto"), "auto");
2268@@ -576,11 +603,13 @@
2269         addSelection("1/2");
2270         addSelection("2/3");
2271         addSelection("3/4");
2272+        addSelection("3/5");
2273         addSelection("4/5");
2274         addSelection("5/6");
2275         addSelection("6/7");
2276         addSelection("7/8");
2277         addSelection("8/9");
2278+        addSelection("9/10");
2279     };
2280 };
2281 
2282@@ -597,6 +626,21 @@
2283     };
2284 };
2285 
2286+class DVBS2RollOff: public ComboBoxSetting, public MuxDBStorage
2287+{
2288+  public:
2289+    DVBS2RollOff(const MultiplexID *id) :
2290+        ComboBoxSetting(this), MuxDBStorage(this, id, "rolloff")
2291+    {
2292+        setLabel(QObject::tr("Roll-off"));
2293+        setHelpText(QObject::tr("Roll-off (Default: 0.35)"));
2294+        addSelection(QObject::tr("0.35"), "0.35");
2295+        addSelection(QObject::tr("0.20"), "0.20");
2296+        addSelection(QObject::tr("0.25"), "0.25");
2297+        addSelection(QObject::tr("Auto"), "auto");
2298+    };
2299+};
2300+
2301 class DVBTCoderateLP :
2302     public DVBForwardErrorCorrectionSelector, public MuxDBStorage
2303 {
2304@@ -715,6 +759,20 @@
2305         right->addChild(new DVBForwardErrorCorrection(id));
2306         right->addChild(new SignalPolarity(id));
2307     }
2308+    else if (CardUtil::DVBS2 == nType)
2309+    {
2310+        left->addChild(new DTVStandard(id, true, false));
2311+        left->addChild(new Frequency(id, true));
2312+        left->addChild(new DVBSymbolRate(id));
2313+        left->addChild(new DVBInversion(id));
2314+        left->addChild(new SignalPolarity(id));
2315+
2316+        right = new VerticalConfigurationGroup(false, true, false, false);
2317+        right->addChild(new DVBS2ModulationSystem(id));
2318+        right->addChild(new Modulation(id, nType));
2319+        right->addChild(new DVBForwardErrorCorrection(id));
2320+        right->addChild(new DVBS2RollOff(id));
2321+    }
2322     else if (CardUtil::QAM == nType)
2323     {
2324         left->addChild(new DTVStandard(id, true, false));
2325Index: libs/libmythtv/scanwizardhelpers.cpp
2326===================================================================
2327--- libs/libmythtv/scanwizardhelpers.cpp        (révision 0)
2328+++ libs/libmythtv/scanwizardhelpers.cpp        (révision 0)
2329@@ -0,0 +1,869 @@
2330+/* -*- Mode: c++ -*-
2331+ * $Id$
2332+ * vim: set expandtab tabstop=4 shiftwidth=4:
2333+ *
2334+ * Original Project
2335+ *      MythTV      http://www.mythtv.org
2336+ *
2337+ * Author(s):
2338+ *      John Pullan  (john@pullan.org)
2339+ *
2340+ * Description:
2341+ *     Collection of classes to provide dvb channel scanning
2342+ *     functionallity
2343+ *
2344+ *
2345+ * This program is free software; you can redistribute it and/or
2346+ * modify it under the terms of the GNU General Public License
2347+ * as published by the Free Software Foundation; either version 2
2348+ * of the License, or (at your option) any later version.
2349+ *
2350+ * This program is distributed in the hope that it will be useful,
2351+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2352+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2353+ * GNU General Public License for more details.
2354+ *
2355+ * You should have received a copy of the GNU General Public License
2356+ * along with this program; if not, write to the Free Software
2357+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2358+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
2359+ *
2360+ */
2361+
2362+// Qt headers
2363+#include <QApplication>
2364+#include <QLocale>
2365+
2366+// MythTV headers
2367+#include "mythcontext.h"
2368+#include "mythdb.h"
2369+#include "mythverbose.h"
2370+#include "frequencies.h"
2371+#include "videosource.h"
2372+#include "cardutil.h"
2373+#include "sourceutil.h"
2374+#include "scanwizardhelpers.h"
2375+#include "scanwizardscanner.h"
2376+#include "scanwizard.h"
2377+
2378+static QString card_types(void)
2379+{
2380+    QString cardTypes = "";
2381+
2382+#ifdef USING_DVB
2383+    cardTypes += "'DVB'";
2384+#endif // USING_DVB
2385+
2386+#ifdef USING_V4L
2387+    if (!cardTypes.isEmpty())
2388+        cardTypes += ",";
2389+    cardTypes += "'V4L'";
2390+# ifdef USING_IVTV
2391+    cardTypes += ",'MPEG'";
2392+# endif // USING_IVTV
2393+# ifdef USING_HDPVR
2394+    cardTypes += ",'HDPVR'";
2395+# endif // USING_HDPVR
2396+#endif // USING_V4L
2397+
2398+#ifdef USING_IPTV
2399+    if (!cardTypes.isEmpty())
2400+        cardTypes += ",";
2401+    cardTypes += "'FREEBOX'";
2402+#endif // USING_IPTV
2403+
2404+#ifdef USING_HDHOMERUN
2405+    if (!cardTypes.isEmpty())
2406+        cardTypes += ",";
2407+    cardTypes += "'HDHOMERUN'";
2408+#endif // USING_HDHOMERUN
2409+
2410+    if (cardTypes.isEmpty())
2411+        cardTypes = "'DUMMY'";
2412+
2413+    return QString("(%1)").arg(cardTypes);
2414+}
2415+
2416+ScanProgressPopup::ScanProgressPopup(bool lock, bool strength, bool snr) :
2417+    ConfigurationPopupDialog(),
2418+    done(false), ss(NULL), sn(NULL), progressBar(NULL), sl(NULL), sta(NULL)
2419+{
2420+    setLabel(tr("Scan Progress"));
2421+
2422+    addChild(sta = new TransLabelSetting());
2423+    sta->setLabel(tr("Status"));
2424+    sta->setValue(tr("Tuning"));
2425+
2426+    if (lock)
2427+    {
2428+        addChild(sl = new TransLabelSetting());
2429+        sl->setValue("                                  "
2430+                     "                                  ");
2431+    }
2432+
2433+    if (strength)
2434+    {
2435+        addChild(ss = new ScanSignalMeter(65535));
2436+        ss->setLabel(tr("Signal Strength"));
2437+    }
2438+
2439+    if (snr)
2440+    {
2441+        addChild(sn = new ScanSignalMeter(65535));
2442+        sn->setLabel(tr("Signal/Noise"));
2443+    }
2444+
2445+    addChild(progressBar = new ScanSignalMeter(65535));
2446+    progressBar->setValue(0);
2447+    progressBar->setLabel(tr("Scan"));
2448+
2449+
2450+    TransButtonSetting *cancel = new TransButtonSetting();
2451+    cancel->setLabel(tr("Cancel"));
2452+    addChild(cancel);
2453+
2454+    connect(cancel, SIGNAL(pressed(void)),
2455+            this,   SLOT(  reject(void)));
2456+
2457+    //Seem to need to do this as the constructor doesn't seem enough
2458+    setUseLabel(false);
2459+    setUseFrame(false);
2460+}
2461+
2462+ScanProgressPopup::~ScanProgressPopup()
2463+{
2464+    VERBOSE(VB_SIPARSER, "~ScanProgressPopup()");
2465+}
2466+
2467+void ScanProgressPopup::SetStatusSignalToNoise(int value)
2468+{
2469+    if (sn)
2470+        sn->setValue(value);
2471+}
2472+
2473+void ScanProgressPopup::SetStatusSignalStrength(int value)
2474+{
2475+    if (ss)
2476+        ss->setValue(value);
2477+}
2478+
2479+void ScanProgressPopup::SetStatusLock(int value)
2480+{
2481+    if (sl)
2482+        sl->setValue((value) ? tr("Locked") : tr("No Lock"));
2483+}
2484+
2485+void ScanProgressPopup::SetScanProgress(double value)
2486+{
2487+    if (progressBar)
2488+        progressBar->setValue((uint)(value * 65535));
2489+}
2490+
2491+void ScanProgressPopup::SetStatusText(const QString &value)
2492+{
2493+    if (sta)
2494+        sta->setValue(value);
2495+}
2496+
2497+void ScanProgressPopup::SetStatusTitleText(const QString &value)
2498+{
2499+    QString msg = tr("Scan Progress") + QString(" %1").arg(value);
2500+    setLabel(msg);
2501+}
2502+
2503+void ScanProgressPopup::deleteLater(void)
2504+{
2505+    disconnect();
2506+    if (dialog)
2507+    {
2508+        VERBOSE(VB_IMPORTANT, "Programmer Error: "
2509+                "ScanProgressPopup::DeleteDialog() never called.");
2510+    }
2511+    ConfigurationPopupDialog::deleteLater();
2512+}
2513+
2514+void ScanProgressPopup::CreateDialog(void)
2515+{
2516+    if (!dialog)
2517+    {
2518+        dialog = (ConfigPopupDialogWidget*)
2519+            dialogWidget(gContext->GetMainWindow(),
2520+                         "ConfigurationPopupDialog");
2521+        dialog->ShowPopup(this, SLOT(Done(void)));
2522+    }
2523+}
2524+
2525+void ScanProgressPopup::DeleteDialog(void)
2526+{
2527+    if (dialog)
2528+    {
2529+        dialog->deleteLater();
2530+        dialog = NULL;
2531+    }
2532+}
2533+
2534+DialogCode ScanProgressPopup::exec(void)
2535+{
2536+    if (!dialog)
2537+    {
2538+        dialog = (ConfigPopupDialogWidget*)
2539+            dialogWidget(gContext->GetMainWindow(),
2540+                         "ConfigurationPopupDialog");
2541+    }
2542+
2543+    dialog->setResult(kDialogCodeRejected);
2544+
2545+    done = false;
2546+
2547+    // Qt4 requires a QMutex as a parameter...
2548+    // not sure if this is the best solution.  Mutex Must be locked before wait.
2549+    QMutex mutex;
2550+    QMutexLocker locker(&mutex);
2551+
2552+    while (!done)
2553+        wait.wait(&mutex, 100);
2554+
2555+    return dialog->result();
2556+}
2557+
2558+void ScanProgressPopup::Done(void)
2559+{
2560+    done = true;
2561+    wait.wakeAll();
2562+}
2563+
2564+void post_event(QObject *dest, ScannerEvent::TYPE type, int val)
2565+{
2566+    ScannerEvent *e = new ScannerEvent(type);
2567+    e->intValue(val);
2568+    QApplication::postEvent(dest, e);
2569+}
2570+
2571+void post_event(QObject *dest, ScannerEvent::TYPE type, const QString &val)
2572+{
2573+    ScannerEvent *e = new ScannerEvent(type);
2574+    QString tmp = val; tmp.detach();
2575+    e->strValue(tmp);
2576+    QApplication::postEvent(dest, e);
2577+}
2578+
2579+void post_event(QObject *dest, ScannerEvent::TYPE type, int val,
2580+                ScanProgressPopup *spp)
2581+{
2582+    ScannerEvent *e = new ScannerEvent(type);
2583+    e->intValue(val);
2584+    e->ScanProgressPopupValue(spp);
2585+    QApplication::postEvent(dest, e);
2586+}
2587+
2588+void MultiplexSetting::Load(void)
2589+{
2590+    clearSelections();
2591+
2592+    if (!sourceid)
2593+        return;
2594+
2595+    MSqlQuery query(MSqlQuery::InitCon());
2596+
2597+    query.prepare(
2598+        "SELECT mplexid,   networkid,  transportid, "
2599+        "       frequency, symbolrate, modulation "
2600+        "FROM dtv_multiplex "
2601+        "WHERE sourceid = :SOURCEID "
2602+        "ORDER by frequency, networkid, transportid");
2603+    query.bindValue(":SOURCEID", sourceid);
2604+
2605+    if (!query.exec() || !query.isActive() || query.size() <= 0)
2606+        return;
2607+
2608+    while (query.next())
2609+    {
2610+        QString DisplayText;
2611+        if (query.value(5).toString() == "8vsb")
2612+        {
2613+            QString ChannelNumber =
2614+                QString("Freq %1").arg(query.value(3).toInt());
2615+            struct CHANLIST* curList = chanlists[0].list;
2616+            int totalChannels = chanlists[0].count;
2617+            int findFrequency = (query.value(3).toInt() / 1000) - 1750;
2618+            for (int x = 0 ; x < totalChannels ; x++)
2619+            {
2620+                if ((curList[x].freq <= findFrequency + 200) &&
2621+                    (curList[x].freq >= findFrequency - 200))
2622+                {
2623+                    ChannelNumber = QString("%1").arg(curList[x].name);
2624+                }
2625+            }
2626+            DisplayText = QObject::tr("ATSC Channel %1").arg(ChannelNumber);
2627+        }
2628+        else
2629+        {
2630+            DisplayText = QString("%1 Hz (%2) (%3) (%4)")
2631+                .arg(query.value(3).toString())
2632+                .arg(query.value(4).toString())
2633+                .arg(query.value(1).toInt())
2634+                .arg(query.value(2).toInt());
2635+        }
2636+        addSelection(DisplayText, query.value(0).toString());
2637+    }
2638+}
2639+
2640+void MultiplexSetting::SetSourceID(uint _sourceid)
2641+{
2642+    sourceid = _sourceid;
2643+    Load();
2644+}
2645+
2646+InputSelector::InputSelector(
2647+    uint _default_cardid, const QString &_default_inputname) :
2648+    ComboBoxSetting(this), sourceid(0), default_cardid(_default_cardid),
2649+    default_inputname(_default_inputname)
2650+{
2651+    default_inputname.detach();
2652+    setLabel(tr("Input"));
2653+}
2654+
2655+void InputSelector::Load(void)
2656+{
2657+    clearSelections();
2658+
2659+    if (!sourceid)
2660+        return;
2661+
2662+    MSqlQuery query(MSqlQuery::InitCon());
2663+    query.prepare(
2664+        "SELECT capturecard.cardid, cardtype, videodevice, inputname "
2665+        "FROM capturecard, cardinput, videosource "
2666+        "WHERE cardinput.sourceid = videosource.sourceid AND "
2667+        "      hostname           = :HOSTNAME            AND "
2668+        "      cardinput.sourceid = :SOURCEID            AND "
2669+        "      cardinput.cardid   = capturecard.cardid");
2670+
2671+    query.bindValue(":HOSTNAME", gContext->GetHostName());
2672+    query.bindValue(":SOURCEID", sourceid);
2673+
2674+    if (!query.exec() || !query.isActive())
2675+    {
2676+        MythDB::DBError("InputSelector::Load()", query);
2677+        return;
2678+    }
2679+
2680+    uint which = 0, cnt = 0;
2681+    for (; query.next(); cnt++)
2682+    {
2683+        uint    cardid     = query.value(0).toUInt();
2684+        QString inputname  = query.value(3).toString();
2685+
2686+        QString desc = CardUtil::GetDeviceLabel(
2687+            cardid, query.value(1).toString(), query.value(2).toString());
2688+
2689+        desc += QString(" (%1)").arg(inputname);
2690+
2691+        QString key = QString("%1:%2").arg(cardid).arg(inputname);
2692+
2693+        addSelection(desc, key);
2694+
2695+        which = (default_cardid == cardid) ? cnt : which;
2696+    }
2697+
2698+    if (cnt)
2699+        setValue(which);
2700+}
2701+
2702+void InputSelector::SetSourceID(const QString &_sourceid)
2703+{
2704+    if (sourceid != _sourceid.toUInt())
2705+    {
2706+        sourceid = _sourceid.toUInt();
2707+        Load();
2708+    }
2709+}
2710+
2711+uint InputSelector::GetCardID(void) const
2712+{
2713+    uint    cardid    = 0;
2714+    QString inputname = QString::null;
2715+
2716+    Parse(getValue(), cardid, inputname);
2717+
2718+    return cardid;
2719+}
2720+
2721+QString InputSelector::GetInputName(void) const
2722+{
2723+    uint    cardid    = 0;
2724+    QString inputname = QString::null;
2725+
2726+    Parse(getValue(), cardid, inputname);
2727+
2728+    return inputname;
2729+}
2730+
2731+bool InputSelector::Parse(const QString &cardid_inputname,
2732+                          uint          &cardid,
2733+                          QString       &inputname)
2734+{
2735+    cardid    = 0;
2736+    inputname = QString::null;
2737+
2738+    int sep0 = cardid_inputname.indexOf(':');
2739+    if (sep0 < 1)
2740+        return false;
2741+
2742+    cardid    = cardid_inputname.left(sep0).toUInt();
2743+    inputname = cardid_inputname.mid(sep0 + 1);
2744+
2745+    return true;
2746+}
2747+
2748+void ScanTypeSetting::SetInput(const QString &cardids_inputname)
2749+{
2750+    uint    cardid    = 0;
2751+    QString inputname = QString::null;
2752+    if (!InputSelector::Parse(cardids_inputname, cardid, inputname))
2753+        return;
2754+
2755+    // Only refresh if we really have to. If we do it too often
2756+    // Then we end up fighting the scan routine when we want to
2757+    // check the type of dvb card :/
2758+    if (cardid == hw_cardid)
2759+        return;
2760+
2761+    hw_cardid       = cardid;
2762+    QString subtype = CardUtil::ProbeSubTypeName(hw_cardid);
2763+    int nCardType   = CardUtil::toCardType(subtype);
2764+    clearSelections();
2765+
2766+    bool importConf = false;
2767+
2768+    switch (nCardType)
2769+    {
2770+        case CardUtil::V4L:
2771+        case CardUtil::MPEG:
2772+            addSelection(tr("Full Scan"),
2773+                         QString::number(FullScan_Analog), true);
2774+            return;
2775+        case CardUtil::OFDM:
2776+            addSelection(tr("Full Scan"),
2777+                         QString::number(FullScan_OFDM), true);
2778+            addSelection(tr("Full Scan (Tuned)"),
2779+                         QString::number(NITAddScan_OFDM));
2780+            importConf = true;
2781+            break;
2782+        case CardUtil::QPSK:
2783+            addSelection(tr("Full Scan (Tuned)"),
2784+                         QString::number(NITAddScan_QPSK));
2785+            importConf = true;
2786+            break;
2787+    case CardUtil::DVBS2:
2788+        addSelection(tr("Full Scan (Tuned)"),
2789+                     QString::number(NITAddScan_DVBS2));
2790+        addSelection(tr("Import channels.conf"),
2791+                     QString::number(DVBUtilsImport));
2792+        break;
2793+
2794+        case CardUtil::QAM:
2795+            addSelection(tr("Full Scan (Tuned)"),
2796+                         QString::number(NITAddScan_QAM));
2797+            importConf = true;
2798+            break;
2799+        case CardUtil::ATSC:
2800+            addSelection(tr("Full Scan"),
2801+                         QString::number(FullScan_ATSC), true);
2802+            importConf = true;
2803+            break;
2804+        case CardUtil::HDHOMERUN:
2805+            addSelection(tr("Full Scan (ATSC)"),
2806+                         QString::number(FullScan_ATSC), true);
2807+            addSelection(tr("Full Scan (DVB)"),
2808+                         QString::number(FullScan_OFDM), true);
2809+            addSelection(tr("Full Scan (DVB, tuned)"),
2810+                         QString::number(NITAddScan_OFDM));
2811+            importConf = true;
2812+            break;
2813+        case CardUtil::FREEBOX:
2814+            addSelection(tr("M3U Import"),
2815+                         QString::number(IPTVImport), true);
2816+            return;
2817+        case CardUtil::ERROR_PROBE:
2818+            addSelection(QObject::tr("Failed to probe the card"),
2819+                         QString::number(Error_Probe), true);
2820+            return;
2821+        default:
2822+            addSelection(QObject::tr("Failed to open the card"),
2823+                         QString::number(Error_Open), true);
2824+            return;
2825+    }
2826+
2827+    if (importConf)
2828+        addSelection(tr("Import channels.conf"),
2829+                     QString::number(DVBUtilsImport));
2830+
2831+    addSelection(tr("Full Scan of Existing Transports"),
2832+                 QString::number(FullTransportScan));
2833+    addSelection(tr("Existing Transport Scan"),
2834+                 QString::number(TransportScan));
2835+}
2836+
2837+ScanCountry::ScanCountry() : ComboBoxSetting(this)
2838+{
2839+    Country country = AU;
2840+    QLocale locale = QLocale::system();
2841+    QLocale::Country qtcountry = locale.country();
2842+    if (qtcountry == QLocale::Australia)
2843+        country = AU;
2844+    else if (qtcountry == QLocale::Germany)
2845+        country = DE;
2846+    else if (qtcountry == QLocale::Finland)
2847+        country = FI;
2848+    else if (qtcountry == QLocale::Sweden)
2849+        country = SE;
2850+    else if (qtcountry == QLocale::UnitedKingdom)
2851+        country = UK;
2852+    else if (qtcountry == QLocale::Spain)
2853+        country = ES;
2854+    else if (qtcountry == QLocale::NewZealand)
2855+        country = NZ;
2856+    else if (qtcountry == QLocale::France)
2857+        country = FR;
2858+
2859+    setLabel(tr("Country"));
2860+    addSelection(QObject::tr("Australia"),      "au", country == AU);
2861+    addSelection(QObject::tr("Finland"),        "fi", country == FI);
2862+    addSelection(QObject::tr("Sweden"),         "se", country == SE);
2863+    addSelection(QObject::tr("United Kingdom"), "uk", country == UK);
2864+    addSelection(QObject::tr("Germany"),        "de", country == DE);
2865+    addSelection(QObject::tr("Spain"),          "es", country == ES);
2866+    addSelection(QObject::tr("New Zealand"),    "nz", country == NZ);
2867+    addSelection(QObject::tr("France"),         "fr", country == FR);
2868+}
2869+
2870+AnalogPane::AnalogPane() :
2871+    VerticalConfigurationGroup(false, false, true, false),
2872+    freq_table(new TransFreqTableSelector(0)),
2873+    old_channel_treatment(new ScanOldChannelTreatment(false))
2874+{
2875+    addChild(freq_table);
2876+    addChild(old_channel_treatment);
2877+}
2878+
2879+void AnalogPane::SetSourceID(uint sourceid)
2880+{
2881+    freq_table->SetSourceID(sourceid);
2882+}
2883+
2884+QString AnalogPane::GetFrequencyTable(void) const
2885+{
2886+    return freq_table->getValue();
2887+}
2888+
2889+ScanOptionalConfig::ScanOptionalConfig(ScanTypeSetting *_scan_type) :
2890+    TriggeredConfigurationGroup(false, false, true, true,
2891+                                false, false, true, true),
2892+    scanType(_scan_type),
2893+    country(new ScanCountry()),
2894+    ignoreSignalTimeoutAll(new IgnoreSignalTimeout()),
2895+    paneOFDM(new OFDMPane()),     paneQPSK(new QPSKPane()),
2896+    paneDVBS2(new DVBS2Pane()),   paneATSC(new ATSCPane()),
2897+    paneQAM(new QAMPane()),       paneAnalog(new AnalogPane()),
2898+    paneSingle(new STPane()),
2899+    paneDVBUtilsImport(new DVBUtilsImportPane())
2900+{
2901+    setTrigger(scanType);
2902+
2903+    // only save settings for the selected pane
2904+    setSaveAll(false);
2905+
2906+    // There need to be two IgnoreSignalTimeout instances
2907+    // because otherwise Qt will free the one instance twice..
2908+
2909+    // There need to be two IgnoreSignalTimeout instances
2910+    // because otherwise Qt will free the one instance twice..
2911+    VerticalConfigurationGroup *scanAllTransports =
2912+        new VerticalConfigurationGroup(false,false,true,true);
2913+    scanAllTransports->addChild(ignoreSignalTimeoutAll);
2914+
2915+    addTarget(QString::number(ScanTypeSetting::Error_Open),
2916+             new ErrorPane(QObject::tr("Failed to open the card")));
2917+    addTarget(QString::number(ScanTypeSetting::Error_Probe),
2918+             new ErrorPane(QObject::tr("Failed to probe the card")));
2919+    addTarget(QString::number(ScanTypeSetting::NITAddScan_QAM),
2920+              paneQAM);
2921+    addTarget(QString::number(ScanTypeSetting::NITAddScan_QPSK),
2922+              paneQPSK);
2923+    addTarget(QString::number(ScanTypeSetting::NITAddScan_DVBS2),
2924+              paneDVBS2);
2925+    addTarget(QString::number(ScanTypeSetting::NITAddScan_OFDM),
2926+              paneOFDM);
2927+    addTarget(QString::number(ScanTypeSetting::FullScan_ATSC),
2928+              paneATSC);
2929+    addTarget(QString::number(ScanTypeSetting::FullScan_OFDM),
2930+              country);
2931+    addTarget(QString::number(ScanTypeSetting::FullScan_Analog),
2932+              paneAnalog);
2933+    addTarget(QString::number(ScanTypeSetting::TransportScan),
2934+              paneSingle);
2935+    addTarget(QString::number(ScanTypeSetting::FullTransportScan),
2936+              scanAllTransports);
2937+    addTarget(QString::number(ScanTypeSetting::IPTVImport),
2938+              new BlankSetting());
2939+    addTarget(QString::number(ScanTypeSetting::DVBUtilsImport),
2940+              paneDVBUtilsImport);
2941+}
2942+
2943+void ScanOptionalConfig::triggerChanged(const QString& value)
2944+{
2945+    TriggeredConfigurationGroup::triggerChanged(value);
2946+}
2947+
2948+void ScanOptionalConfig::SetSourceID(const QString &sourceid)
2949+{
2950+    paneAnalog->SetSourceID(sourceid.toUInt());
2951+    paneSingle->SetSourceID(sourceid.toUInt());
2952+}
2953+
2954+void ScanOptionalConfig::SetDefaultATSCFormat(const QString &atscFormat)
2955+{
2956+    paneATSC->SetDefaultATSCFormat(atscFormat);
2957+    paneSingle->SetDefaultATSCFormat(atscFormat);
2958+    paneDVBUtilsImport->SetDefaultATSCFormat(atscFormat);
2959+}
2960+
2961+QString ScanOptionalConfig::GetATSCFormat(const QString &dfl) const
2962+{
2963+    int     st =  scanType->getValue().toInt();
2964+
2965+    bool    ts0 = (ScanTypeSetting::FullScan_ATSC  == st);
2966+    QString vl0 = paneATSC->GetATSCFormat();
2967+
2968+    bool    ts1 = (ScanTypeSetting::TransportScan  == st);
2969+    QString vl1 = paneSingle->GetATSCFormat();
2970+
2971+    bool    ts2 = (ScanTypeSetting::DVBUtilsImport == st);
2972+    QString vl2 = paneDVBUtilsImport->GetATSCFormat();
2973+
2974+    return (ts0) ? vl0 : ((ts1) ? vl1 : (ts2) ? vl2 : dfl);
2975+}
2976+
2977+QString ScanOptionalConfig::GetFrequencyStandard(void) const
2978+{
2979+    int     st =  scanType->getValue().toInt();
2980+
2981+    bool    ts0 = (ScanTypeSetting::FullScan_ATSC   == st);
2982+    bool    ts1 = (ScanTypeSetting::FullScan_Analog == st);
2983+
2984+    return (ts0) ? "atsc" : ((ts1) ? "analog" : "dvbt");
2985+}
2986+
2987+QString ScanOptionalConfig::GetModulation(void) const
2988+{
2989+    int     st =  scanType->getValue().toInt();
2990+
2991+    bool    ts0 = (ScanTypeSetting::FullScan_ATSC == st);
2992+    QString vl0 = paneATSC->atscModulation();
2993+
2994+    bool    ts1 = (ScanTypeSetting::FullScan_OFDM == st);
2995+    QString vl1 = "ofdm";
2996+
2997+    bool    ts2 = (ScanTypeSetting::FullScan_Analog == st);
2998+    QString vl2 = "analog";
2999+
3000+    return (ts0) ? vl0 : ((ts1) ? vl1 : (ts2) ? vl2 : "unknown");
3001+}
3002+
3003+QString ScanOptionalConfig::GetFrequencyTable(void) const
3004+{
3005+    int     st =  scanType->getValue().toInt();
3006+
3007+    bool    ts0 = (ScanTypeSetting::FullScan_ATSC == st);
3008+    QString vl0 = paneATSC->atscFreqTable();
3009+
3010+    bool    ts1 = (ScanTypeSetting::FullScan_OFDM == st);
3011+    QString vl1 = country->getValue();
3012+
3013+    bool    ts2 = (ScanTypeSetting::FullScan_Analog == st);
3014+    QString vl2 = paneAnalog->GetFrequencyTable();
3015+
3016+    return (ts0) ? vl0 : ((ts1) ? vl1 : (ts2) ? vl2 : "unknown");
3017+}
3018+
3019+bool ScanOptionalConfig::DoIgnoreSignalTimeout(void) const
3020+{
3021+    int  st  = scanType->getValue().toInt();
3022+
3023+    bool ts0 = (ScanTypeSetting::TransportScan     == st);
3024+    bool vl0 = paneSingle->ignoreSignalTimeout();
3025+
3026+    bool ts1 = (ScanTypeSetting::FullTransportScan == st);
3027+    bool vl1 = (ignoreSignalTimeoutAll->getValue().toInt());
3028+
3029+    bool ts2 = (ScanTypeSetting::DVBUtilsImport    == st);
3030+    bool vl2 = paneDVBUtilsImport->DoIgnoreSignalTimeout();
3031+
3032+    return (ts0) ? vl0 : ((ts1) ? vl1 : (ts2) ? vl2 : false);
3033+}
3034+
3035+bool ScanOptionalConfig::DoDeleteChannels(void) const
3036+{
3037+    int  st  = scanType->getValue().toInt();
3038+
3039+    bool ts0 = (ScanTypeSetting::FullScan_ATSC  == st);
3040+    bool vl0 = paneATSC->DoDeleteChannels();
3041+
3042+    bool ts1 = (ScanTypeSetting::TransportScan  == st);
3043+    bool vl1 = paneSingle->DoDeleteChannels();
3044+
3045+    bool ts2 = (ScanTypeSetting::DVBUtilsImport == st);
3046+    bool vl2 = paneDVBUtilsImport->DoDeleteChannels();
3047+
3048+    bool ts3 = (ScanTypeSetting::FullScan_Analog == st);
3049+    bool vl3 = paneAnalog->DoDeleteChannels();
3050+
3051+    return (ts0) ? vl0 : (((ts1) ? vl1 : (ts2) ? vl2 : (ts3) ? vl3 : false));
3052+}
3053+
3054+bool ScanOptionalConfig::DoRenameChannels(void) const
3055+{
3056+    int  st  = scanType->getValue().toInt();
3057+
3058+    bool ts0 = (ScanTypeSetting::FullScan_ATSC  == st);
3059+    bool vl0 = paneATSC->DoRenameChannels();
3060+
3061+    bool ts1 = (ScanTypeSetting::TransportScan  == st);
3062+    bool vl1 = paneSingle->DoRenameChannels();
3063+
3064+    bool ts2 = (ScanTypeSetting::DVBUtilsImport == st);
3065+    bool vl2 = paneDVBUtilsImport->DoRenameChannels();
3066+
3067+    bool ts3 = (ScanTypeSetting::FullScan_Analog == st);
3068+    bool vl3 = paneAnalog->DoRenameChannels();
3069+
3070+    return (ts0) ? vl0 : (((ts1) ? vl1 : (ts2) ? vl2 : (ts3) ? vl3 : false));
3071+}
3072+
3073+QString ScanOptionalConfig::GetFilename(void) const
3074+{
3075+    return paneDVBUtilsImport->GetFilename();
3076+}
3077+
3078+uint ScanOptionalConfig::GetMultiplex(void) const
3079+{
3080+    int mplexid = paneSingle->GetMultiplex();
3081+    return (mplexid <= 0) ? 0 : mplexid;
3082+}
3083+
3084+QMap<QString,QString> ScanOptionalConfig::GetStartChan(void) const
3085+{
3086+    QMap<QString,QString> startChan;
3087+
3088+    int st = scanType->getValue().toInt();
3089+    if (ScanTypeSetting::NITAddScan_OFDM == st)
3090+    {
3091+        const OFDMPane *pane = paneOFDM;
3092+
3093+        startChan["std"]            = "dvb";
3094+        startChan["frequency"]      = pane->frequency();
3095+        startChan["inversion"]      = pane->inversion();
3096+        startChan["bandwidth"]      = pane->bandwidth();
3097+        startChan["modulation"]     = "ofdm";
3098+        startChan["coderate_hp"]    = pane->coderate_hp();
3099+        startChan["coderate_lp"]    = pane->coderate_lp();
3100+        startChan["constellation"]  = pane->constellation();
3101+        startChan["trans_mode"]     = pane->trans_mode();
3102+        startChan["guard_interval"] = pane->guard_interval();
3103+        startChan["hierarchy"]      = pane->hierarchy();
3104+    }
3105+    else if (ScanTypeSetting::NITAddScan_QPSK == st)
3106+    {
3107+        const QPSKPane *pane = paneQPSK;
3108+
3109+        startChan["std"]        = "dvb";
3110+        startChan["frequency"]  = pane->frequency();
3111+        startChan["inversion"]  = pane->inversion();
3112+        startChan["symbolrate"] = pane->symbolrate();
3113+        startChan["fec"]        = pane->fec();
3114+        startChan["modulation"] = "qpsk";
3115+        startChan["polarity"]   = pane->polarity();
3116+    }
3117+    else if (ScanTypeSetting::NITAddScan_DVBS2 == st)
3118+    {
3119+        const DVBS2Pane *pane = paneDVBS2;
3120+
3121+        startChan["std"]        = "dvb";
3122+        startChan["frequency"]  = pane->frequency();
3123+        startChan["inversion"]  = pane->inversion();
3124+        startChan["symbolrate"] = pane->symbolrate();
3125+        startChan["fec"]        = pane->fec();
3126+        startChan["msystem"]    = pane->msystem();
3127+        startChan["modulation"] = pane->modulation();
3128+        startChan["polarity"]   = pane->polarity();
3129+        startChan["rolloff"]    = pane->rolloff();
3130+    }
3131+    else if (ScanTypeSetting::NITAddScan_QAM == st)
3132+    {
3133+        const QAMPane *pane = paneQAM;
3134+
3135+        startChan["std"]        = "dvb";
3136+        startChan["frequency"]  = pane->frequency();
3137+        startChan["inversion"]  = pane->inversion();
3138+        startChan["symbolrate"] = pane->symbolrate();
3139+        startChan["fec"]        = pane->fec();
3140+        startChan["modulation"] = pane->modulation();
3141+    }
3142+
3143+    return startChan;
3144+}
3145+
3146+ScanWizardConfig::ScanWizardConfig(
3147+    ScanWizard *_parent,
3148+    uint    default_sourceid,  uint default_cardid,
3149+    QString default_inputname) :
3150+    VerticalConfigurationGroup(false, true, false, false),
3151+    videoSource(new VideoSourceSelector(
3152+                    default_sourceid, card_types(), false)),
3153+    input(new InputSelector(default_cardid, default_inputname)),
3154+    scanType(new ScanTypeSetting()),
3155+    scanConfig(new ScanOptionalConfig(scanType))
3156+{
3157+    setLabel(tr("Scan Configuration"));
3158+
3159+    addChild(videoSource);
3160+    addChild(input);
3161+    addChild(scanType);
3162+    addChild(scanConfig);
3163+
3164+    connect(videoSource, SIGNAL(valueChanged(const QString&)),
3165+            scanConfig,  SLOT(  SetSourceID( const QString&)));
3166+
3167+    connect(videoSource, SIGNAL(valueChanged(const QString&)),
3168+            input,       SLOT(  SetSourceID( const QString&)));
3169+
3170+    connect(input,       SIGNAL(valueChanged(const QString&)),
3171+            scanType,    SLOT(  SetInput(    const QString&)));
3172+
3173+    connect(input,       SIGNAL(valueChanged(const QString&)),
3174+            _parent,     SLOT(  SetInput(    const QString&)));
3175+}
3176+
3177+uint ScanWizardConfig::GetSourceID(void) const
3178+{
3179+    return videoSource->getValue().toUInt();
3180+}
3181+
3182+QString ScanWizardConfig::GetATSCFormat(void) const
3183+{
3184+    QString dfl = SourceUtil::GetChannelFormat(GetSourceID());
3185+    return scanConfig->GetATSCFormat(dfl);
3186+}
3187+
3188+LogList::LogList() : ListBoxSetting(this), n(0)
3189+{
3190+    setSelectionMode(MythListBox::NoSelection);
3191+}
3192+
3193+void LogList::updateText(const QString& status)
3194+{
3195+    addSelection(status,QString::number(n));
3196+    setCurrentItem(n);
3197+    n++;
3198+}
3199Index: libs/libmythtv/dtvmultiplex.cpp
3200===================================================================
3201--- libs/libmythtv/dtvmultiplex.cpp     (révision 20533)
3202+++ libs/libmythtv/dtvmultiplex.cpp     (copie de travail)
3203@@ -24,6 +24,8 @@
3204     fec            = other.fec;
3205     mplex          = other.mplex;
3206     sistandard     = other.sistandard;
3207+    msystem        = other.msystem;
3208+    rolloff        = other.rolloff;
3209     sistandard.detach();
3210     return *this;
3211 }
3212@@ -40,7 +42,9 @@
3213             (guard_interval == m.guard_interval) &&
3214             (fec == m.fec) &&
3215             (polarity == m.polarity) &&
3216-            (hierarchy == m.hierarchy));
3217+            (hierarchy == m.hierarchy) &&
3218+            (msystem == m.msystem) &&
3219+            (rolloff == m.rolloff));
3220 }
3221 
3222 ///////////////////////////////////////////////////////////////////////////////
3223@@ -48,14 +52,15 @@
3224 
3225 QString DTVMultiplex::toString() const
3226 {
3227-    QString ret = QString("%1 %2 %3 ")
3228-        .arg(frequency).arg(modulation.toString()).arg(inversion.toString());
3229+    QString ret = QString("f: %1 mod: %2 inv: %3 fec: %4")
3230+        .arg(frequency).arg(modulation.toString()).arg(inversion.toString()).arg(fec.toString());
3231 
3232-    ret += QString("%1 %2 %3 %4 %5 %6 %7")
3233+    ret += QString("hp: %1 lp: %2 bandw: %3 transmode: %4 guardi: %5 hier: %6 polar: %7 msys: %8 rolloff: %9")
3234         .arg(hp_code_rate.toString()).arg(lp_code_rate.toString())
3235         .arg(bandwidth.toString()).arg(trans_mode.toString())
3236         .arg(guard_interval.toString()).arg(hierarchy.toString())
3237-        .arg(polarity.toString());
3238+        .arg(polarity.toString())
3239+        .arg(msystem.toString()).arg(rolloff.toString());
3240 
3241     return ret;
3242 }
3243@@ -127,7 +132,9 @@
3244             (inversion  == other.inversion)  &&
3245             (symbolrate == other.symbolrate) &&
3246             (polarity   == other.polarity)   &&
3247-            (fec        == other.fec);
3248+            (fec        == other.fec)        &&
3249+           (msystem    == other.msystem)    &&
3250+           (rolloff    == other.rolloff);
3251     }
3252 
3253     return false;
3254@@ -190,13 +197,10 @@
3255     const QString &_symbol_rate, const QString &_fec_inner,
3256     const QString &_modulation,  const QString &_polarity)
3257 {
3258-    bool ok = inversion.Parse(_inversion);
3259-    if (!ok)
3260+    if (!inversion.Parse(_inversion))
3261     {
3262         VERBOSE(VB_GENERAL, LOC_WARN +
3263-                "Invalid inversion, falling back to 'auto'");
3264-
3265-        ok = true;
3266+                QString("Invalid inversion '%1' , falling back to 'auto'.").arg(_inversion));
3267     }
3268 
3269     symbolrate = _symbol_rate.toInt();
3270@@ -204,29 +208,88 @@
3271     {
3272         VERBOSE(VB_IMPORTANT, LOC_ERR + "Invalid symbol rate " +
3273                 QString("parameter '%1', aborting.").arg(_symbol_rate));
3274-
3275         return false;
3276     }
3277 
3278-    ok &= fec.Parse(_fec_inner);
3279-    ok &= modulation.Parse(_modulation);
3280+    if (!fec.Parse(_fec_inner))
3281+    {
3282+        VERBOSE(VB_IMPORTANT, LOC_ERR + "Invalid fec_inner " +
3283+                QString("parameter '%1', aborting.").arg(_fec_inner));
3284+        return false;         
3285+    }
3286+   
3287+    if (!modulation.Parse(_modulation))
3288+    {
3289+        VERBOSE(VB_IMPORTANT, LOC_ERR + "Invalid modulation " +
3290+                QString("parameter '%1', aborting.").arg(_modulation));
3291+        return false;                 
3292+    }
3293 
3294     if (!_polarity.isEmpty())
3295-        polarity.Parse(_polarity.toLower());
3296+        if (!polarity.Parse(_polarity.toLower()))
3297+        {
3298+            VERBOSE(VB_IMPORTANT, LOC_ERR + "Invalid polarity " +
3299+                    QString("parameter '%1', aborting.").arg(_polarity));
3300+            return false;                             
3301+        }
3302 
3303-    if (ok)
3304-        frequency = _frequency.toInt(&ok);
3305+    bool ok;
3306+    frequency = _frequency.toInt(&ok);
3307+    if (!ok)
3308+    {
3309+        VERBOSE(VB_IMPORTANT, LOC_ERR + "Invalid frequency " +
3310+                QString("parameter '%1', aborting.").arg(_frequency));
3311+        return false;                                 
3312+       
3313+    }
3314 
3315-    return ok;
3316+    return true;
3317 }
3318 
3319+bool DTVMultiplex::ParseDVB_S2(
3320+    const QString &_frequency,   const QString &_inversion,
3321+    const QString &_symbol_rate, const QString &_fec_inner,
3322+    const QString &_modulation,  const QString &_polarity,
3323+    const QString &_msystem,     const QString &_rolloff)
3324+{
3325+       if (!ParseDVB_S_and_C(_frequency,   _inversion,
3326+                                                 _symbol_rate, _fec_inner,
3327+                                                 _modulation,  _polarity))
3328+       {
3329+               return false;
3330+       }
3331+       
3332+    if (!_msystem.isEmpty())
3333+    {
3334+        if (!msystem.Parse(_msystem))
3335+        {
3336+            VERBOSE(VB_IMPORTANT, LOC_ERR + "Invalid modulation system " +
3337+                    QString("parameter '%1', aborting.").arg(_msystem));
3338+            return false;
3339+        }
3340+    }
3341+
3342+    if (!_rolloff.isEmpty())
3343+    {
3344+        if(!rolloff.Parse(_rolloff))
3345+        {
3346+            VERBOSE(VB_IMPORTANT, LOC_ERR + "Invalid rolloff " +
3347+                    QString("parameter '%1', aborting.").arg(_rolloff));
3348+            return false;
3349+        }
3350+    }
3351+
3352+    return true;
3353+}
3354+
3355 bool DTVMultiplex::ParseTuningParams(
3356     DTVTunerType type,
3357     QString _frequency,    QString _inversion,      QString _symbolrate,
3358     QString _fec,          QString _polarity,
3359     QString _hp_code_rate, QString _lp_code_rate,   QString _ofdm_modulation,
3360     QString _trans_mode,   QString _guard_interval, QString _hierarchy,
3361-    QString _modulation,   QString _bandwidth)
3362+    QString _modulation,   QString _bandwidth,
3363+    QString _msystem,      QString _rolloff)
3364 {
3365     if (DTVTunerType::kTunerTypeOFDM == type)
3366     {
3367@@ -236,15 +299,22 @@
3368             _hierarchy);
3369     }
3370 
3371-    if ((DTVTunerType::kTunerTypeQPSK   == type) ||
3372-        (DTVTunerType::kTunerTypeDVB_S2 == type) ||
3373-        (DTVTunerType::kTunerTypeQAM    == type))
3374+    if ((DTVTunerType::kTunerTypeQPSK == type) ||
3375+       (DTVTunerType::kTunerTypeQAM  == type))
3376     {
3377         return ParseDVB_S_and_C(
3378             _frequency,       _inversion,     _symbolrate,
3379             _fec,             _modulation,    _polarity);
3380     }
3381 
3382+    if (DTVTunerType::kTunerTypeDVB_S2 == type)
3383+    {
3384+        return ParseDVB_S2(
3385+            _frequency,       _inversion,     _symbolrate,
3386+            _fec,             _modulation,    _polarity,
3387+            _msystem,         _rolloff);
3388+    }
3389+
3390     if (DTVTunerType::kTunerTypeATSC == type)
3391         return ParseATSC(_frequency, _modulation);
3392 
3393@@ -263,7 +333,8 @@
3394         "       fec,               polarity, "
3395         "       hp_code_rate,      lp_code_rate,   constellation, "
3396         "       transmission_mode, guard_interval, hierarchy, "
3397-        "       modulation,        bandwidth,      sistandard "
3398+        "       modulation,        bandwidth,      sistandard, "
3399+        "       msystem,           rolloff "
3400         "FROM dtv_multiplex "
3401         "WHERE dtv_multiplex.mplexid = :MPLEXID");
3402     query.bindValue(":MPLEXID", mplexid);
3403@@ -296,7 +367,8 @@
3404         query.value(6).toString(),  query.value(7).toString(),
3405         query.value(8).toString(),  query.value(9).toString(),
3406         query.value(10).toString(), query.value(11).toString(),
3407-        query.value(12).toString());
3408+        query.value(12).toString(), query.value(14).toString(),
3409+        query.value(15).toString());
3410 }
3411 
3412 ////////////////////////////////////////////////////////////////////////////
3413@@ -363,6 +435,7 @@
3414         "    mplexid,            frequency,       inversion,  "
3415         "    symbolrate,         fec,             polarity,   "
3416         "    hp_code_rate,       lp_code_rate,    modulation, "
3417+        "    msystem,            rolloff,                     "
3418         "    transmission_mode,  guard_interval,  hierarchy,  "
3419         "    bandwidth,          sistandard,      tuner_type  "
3420         " ) "
3421@@ -371,6 +444,7 @@
3422         "   :MPLEXID,           :FREQUENCY,      :INVERSION,  "
3423         "   :SYMBOLRATE,        :FEC,            :POLARITY,   "
3424         "   :HP_CODE_RATE,      :LP_CODE_RATE,   :MODULATION, "
3425+        "   :MSYSTEM,           :ROLLOFF,                     "
3426         "   :TRANSMISSION_MODE, :GUARD_INTERVAL, :HIERARCHY,  "
3427         "   :BANDWIDTH,         :SISTANDARD,     :TUNER_TYPE  "
3428         " );");
3429@@ -385,6 +459,8 @@
3430     query.bindValue(":HP_CODE_RATE", hp_code_rate.toString());
3431     query.bindValue(":LP_CODE_RATE", lp_code_rate.toString());
3432     query.bindValue(":MODULATION", modulation.toString());
3433+    query.bindValue(":MSYSTEM", msystem.toString());
3434+    query.bindValue(":ROLLOFF", rolloff.toString());
3435     query.bindValue(":TRANSMISSION_MODE", trans_mode.toString());
3436     query.bindValue(":GUARD_INTERVAL", guard_interval.toString());
3437     query.bindValue(":HIERARCHY", hierarchy.toString());
3438@@ -419,7 +495,8 @@
3439     QString _fec,          QString _polarity,
3440     QString _hp_code_rate, QString _lp_code_rate,   QString _ofdm_modulation,
3441     QString _trans_mode,   QString _guard_interval, QString _hierarchy,
3442-    QString _modulation,   QString _bandwidth)
3443+    QString _modulation,   QString _bandwidth,
3444+    QString _msystem,      QString _rolloff)
3445 {
3446     tuner_type = type;
3447 
3448@@ -429,7 +506,8 @@
3449         _fec,           _polarity,
3450         _hp_code_rate,  _lp_code_rate,    _ofdm_modulation,
3451         _trans_mode,    _guard_interval,  _hierarchy,
3452-        _modulation,    _bandwidth);
3453+        _modulation,    _bandwidth,
3454+       _msystem,       _rolloff);
3455 }
3456 
3457 
3458Index: programs/mythtv-setup/main.cpp
3459===================================================================
3460--- programs/mythtv-setup/main.cpp      (révision 20533)
3461+++ programs/mythtv-setup/main.cpp      (copie de travail)
3462@@ -20,11 +20,6 @@
3463 #include "mythuihelper.h"
3464 #include "mythdirs.h"
3465 
3466-#include "libmythtv/channelscan/channelscanner_cli.h"
3467-#include "libmythtv/channelscan/scanwizardconfig.h"
3468-#include "libmythtv/channelscan/scaninfo.h"
3469-#include "libmythtv/channelscan/channelimporter.h"
3470-#include "libmythtv/cardutil.h"
3471 #include "libmythtv/dbcheck.h"
3472 #include "libmythtv/videosource.h"
3473 #include "channeleditor.h"
3474@@ -132,15 +127,7 @@
3475 {
3476     QString geometry = QString::null;
3477     QString display  = QString::null;
3478-    bool    doScan   = false;
3479-    bool    doScanList = false;
3480-    bool    doScanSaveOnly = false;
3481-    bool    scanInteractive = true;
3482-    uint    scanImport = 0;
3483-    uint    scanCardId = 0;
3484-    QString scanTableName = "atsc-vsb8-us";
3485-    QString scanInputName = "";
3486-    bool    use_display = true;
3487+    QString verboseString = QString(" important general");
3488 
3489     for(int argpos = 1; argpos < argc; ++argpos)
3490     {
3491@@ -159,12 +146,6 @@
3492         else if (argpos+1 < argc && !strcmp(argv[argpos],"-display"))
3493             display = argv[argpos+1];
3494 #endif
3495-        else if (QString(argv[argpos]).left(6) == "--scan")
3496-        {
3497-            use_display = false;
3498-            print_verbose_messages = 0;
3499-            verboseString = "";
3500-        }
3501     }
3502 
3503 #ifdef Q_WS_MACX
3504@@ -172,7 +153,7 @@
3505     // of the MythPushButton widgets, and they don't use the themed background.
3506     QApplication::setDesktopSettingsAware(FALSE);
3507 #endif
3508-    QApplication a(argc, argv, use_display);
3509+    QApplication a(argc, argv);
3510 
3511     QMap<QString, QString> settingsOverride;
3512 
3513@@ -268,53 +249,6 @@
3514 
3515             ++argpos;
3516         }
3517-        else if (!strcmp(a.argv()[argpos],"--scan-list"))
3518-        {
3519-            doScanList = true;
3520-        }
3521-        else if (!strcmp(a.argv()[argpos],"--scan-import"))
3522-        {
3523-            if (a.argc()-1 > argpos)
3524-            {
3525-                QString tmpArg = a.argv()[argpos + 1];
3526-                scanImport = tmpArg.toUInt();
3527-                ++argpos;
3528-            }
3529-            else
3530-            {
3531-                cerr << "Missing scan number for import, please run "
3532-                     << "--scan-list to list importable scans." << endl;
3533-                return BACKEND_EXIT_INVALID_CMDLINE;
3534-            }
3535-        }
3536-        else if (!strcmp(a.argv()[argpos],"--scan-save-only"))
3537-        {
3538-            doScanSaveOnly = true;
3539-        }
3540-        else if (!strcmp(a.argv()[argpos],"--scan-non-interactive"))
3541-        {
3542-            scanInteractive = false;
3543-        }
3544-        else if (!strcmp(a.argv()[argpos],"--scan"))
3545-        {
3546-            if (a.argc()-1 > argpos)
3547-            {
3548-                scanTableName = a.argv()[argpos + 1];
3549-                ++argpos;
3550-            }
3551-            if (a.argc()-1 > argpos)
3552-            {
3553-                QString tmpArg = a.argv()[argpos + 1];
3554-                scanCardId = tmpArg.toUInt();
3555-                ++argpos;
3556-            }
3557-            if (a.argc()-1 > argpos)
3558-            {
3559-                scanInputName = a.argv()[argpos + 1];
3560-                ++argpos;
3561-            }
3562-            doScan = true;
3563-        }
3564         else
3565         {
3566             cerr << "Invalid argument: " << a.argv()[argpos] << endl;
3567@@ -332,7 +266,7 @@
3568 
3569     std::auto_ptr<MythContext> contextScopeDelete(gContext);
3570 
3571-    if (!gContext->Init(use_display))
3572+    if (!gContext->Init(true))
3573     {
3574         VERBOSE(VB_IMPORTANT, "Failed to init MythContext, exiting.");
3575         return GENERIC_EXIT_NO_MYTHCONTEXT;
3576@@ -367,129 +301,15 @@
3577         return GENERIC_EXIT_DB_ERROR;
3578     }
3579 
3580-    if (use_display)
3581-    {
3582-        gContext->SetSetting("Theme", "G.A.N.T");
3583-        GetMythUI()->LoadQtConfig();
3584+    gContext->SetSetting("Theme", "G.A.N.T");
3585+    GetMythUI()->LoadQtConfig();
3586 
3587-        QString fileprefix = GetConfDir();
3588+    QString fileprefix = GetConfDir();
3589 
3590-        QDir dir(fileprefix);
3591-        if (!dir.exists())
3592-            dir.mkdir(fileprefix);
3593-    }
3594+    QDir dir(fileprefix);
3595+    if (!dir.exists())
3596+        dir.mkdir(fileprefix);
3597 
3598-    if (doScan)
3599-    {
3600-        bool okCardID = scanCardId;
3601-
3602-        QStringList inputnames = CardUtil::GetInputNames(scanCardId);
3603-        okCardID &= !inputnames.empty();
3604-
3605-        if (scanInputName.isEmpty())
3606-            scanInputName = CardUtil::GetDefaultInput(scanCardId);
3607-
3608-        bool okInputName = inputnames.contains(scanInputName);
3609-
3610-        doScan = (okCardID && okInputName);
3611-
3612-        if (!okCardID)
3613-        {
3614-            cerr << "You must enter a valid cardid to scan." << endl;
3615-            vector<uint> cardids = CardUtil::GetCardIDs();
3616-            if (cardids.empty())
3617-            {
3618-                cerr << "But no cards have been defined on this host"
3619-                     << endl;
3620-                return BACKEND_EXIT_INVALID_CMDLINE;
3621-            }
3622-            cerr << "Valid cards: " << endl;
3623-            for (uint i = 0; i < cardids.size(); i++)
3624-            {
3625-                fprintf(stderr, "%5i: %s %s\n",
3626-                        cardids[i],
3627-                        CardUtil::GetRawCardType(cardids[i])
3628-                        .toAscii().constData(),
3629-                        CardUtil::GetVideoDevice(cardids[i])
3630-                        .toAscii().constData());
3631-            }
3632-            return BACKEND_EXIT_INVALID_CMDLINE;
3633-        }
3634-
3635-        if (!okInputName)
3636-        {
3637-            cerr << "You must enter a valid input to scan this card."
3638-                 << endl;
3639-            cerr << "Valid inputs: " << endl;
3640-            for (int i = 0; i < inputnames.size(); i++)
3641-            {
3642-                cerr << inputnames[i].toAscii().constData() << endl;
3643-            }
3644-            return BACKEND_EXIT_INVALID_CMDLINE;
3645-        }
3646-    }
3647-
3648-    if (doScan)
3649-    {
3650-        int ret = 0;
3651-        int firstBreak   = scanTableName.indexOf("-");
3652-        int secondBreak  = scanTableName.lastIndexOf("-");
3653-        QString freq_std = scanTableName.mid(0, firstBreak).toLower();
3654-        QString mod      = scanTableName.mid(
3655-            firstBreak+1, secondBreak-firstBreak-1).toLower();
3656-        QString tbl      = scanTableName.mid(secondBreak+1).toLower();
3657-        uint    inputid  = CardUtil::GetInputID(scanCardId, scanInputName);
3658-        uint    sourceid = ChannelUtil::GetSourceID(inputid);
3659-        QMap<QString,QString> startChan;
3660-        {
3661-            ChannelScannerCLI scanner(doScanSaveOnly, scanInteractive);
3662-            scanner.Scan(
3663-                (freq_std=="atsc") ?
3664-                ScanTypeSetting::FullScan_ATSC :
3665-                ((freq_std=="dvbt") ?
3666-                 ScanTypeSetting::FullScan_DVBT :
3667-                 ScanTypeSetting::FullScan_ATSC),
3668-                /* cardid    */ scanCardId,
3669-                /* inputname */ scanInputName,
3670-                /* sourceid  */ sourceid,
3671-                false,
3672-                // stuff needed for particular scans
3673-                /* mplexid   */ 0,
3674-                startChan, freq_std, mod, tbl);
3675-            ret = a.exec();
3676-        }
3677-        return (ret) ? GENERIC_EXIT_NOT_OK : BACKEND_EXIT_OK;
3678-    }
3679-
3680-    if (doScanList)
3681-    {
3682-        vector<ScanInfo> scans = LoadScanList();
3683-
3684-        cout<<" scanid cardid sourceid processed        date"<<endl;
3685-        for (uint i = 0; i < scans.size(); i++)
3686-        {
3687-            printf("%5i %6i %8i %8s    %20s\n",
3688-                   scans[i].scanid,   scans[i].cardid,
3689-                   scans[i].sourceid, (scans[i].processed) ? "yes" : "no",
3690-                   scans[i].scandate.toString().toAscii().constData());
3691-        }
3692-        cout<<endl;
3693-
3694-        return BACKEND_EXIT_OK;
3695-    }
3696-
3697-    if (scanImport)
3698-    {
3699-        cout<<"*** SCAN IMPORT START ***"<<endl;
3700-        {
3701-            ScanDTVTransportList list = LoadScan(scanImport);
3702-            ChannelImporter ci(false, true, true, false);
3703-            ci.Process(list);
3704-        }
3705-        cout<<"*** SCAN IMPORT END ***"<<endl;
3706-        return BACKEND_EXIT_OK;
3707-    }
3708-
3709     MythMainWindow *mainWindow = GetMythMainWindow();
3710     mainWindow->Init();
3711     gContext->SetMainWindow(mainWindow);