MythTV  master
dtvconfparserhelpers.cpp
Go to the documentation of this file.
1 
2 #include <QMutex>
3 #include <QMap>
4 
5 #include "mythlogging.h"
6 #include "dtvconfparserhelpers.h"
7 
8 bool DTVParamHelper::ParseParam(const QString &symbol, int &value,
9  const DTVParamHelperStruct *table)
10 {
11  const DTVParamHelperStruct *p = table;
12 
13  while (!p->symbol.isEmpty())
14  {
15  if (p->symbol == symbol) //.left(p->symbol.length()))
16  {
17  //symbol = symbol.mid(p->symbol.length());
18  value = p->value;
19  return true;
20  }
21  p++;
22  }
23 
24  return false;
25 }
26 
27 QString DTVParamHelper::toString(const char *strings[], int index,
28  uint strings_size)
29 {
30  if ((index < 0) || ((uint)index >= strings_size))
31  {
32  LOG(VB_GENERAL, LOG_ERR,
33  "DTVParamHelper::toString() index out of bounds");
34 
35  return QString();
36  }
37 
38  return strings[index];
39 }
40 
41 const int DTVTunerType::kTunerTypeDVBS1 = 0x0000;
42 const int DTVTunerType::kTunerTypeDVBS2 = 0x0020;
43 const int DTVTunerType::kTunerTypeDVBC = 0x0001;
44 const int DTVTunerType::kTunerTypeDVBT = 0x0002;
45 const int DTVTunerType::kTunerTypeDVBT2 = 0x0022;
46 const int DTVTunerType::kTunerTypeATSC = 0x0003;
47 const int DTVTunerType::kTunerTypeASI = 0x1000;
48 const int DTVTunerType::kTunerTypeOCUR = 0x2000;
49 const int DTVTunerType::kTunerTypeIPTV = 0x4000;
50 const int DTVTunerType::kTunerTypeUnknown = 0x80000000;
51 
53 static QMap<int,QString> dtv_tt_canonical_str;
55 {
56  QMutexLocker locker(&dtv_tt_canonical_str_lock);
66 }
67 
68 QString DTVTunerType::toString(int _value)
69 {
70  QMutexLocker locker(&dtv_tt_canonical_str_lock);
71  QMap<int,QString>::const_iterator it = dtv_tt_canonical_str.find(_value);
72  if (it != dtv_tt_canonical_str.end())
73  return *it;
75 }
76 
78 {
79  { "QPSK", kTunerTypeDVBS1 },
80  { "QAM", kTunerTypeDVBC },
81  { "OFDM", kTunerTypeDVBT },
82  { "DVB_T2", kTunerTypeDVBT2 },
83  { "ATSC", kTunerTypeATSC },
84  { "DVB_S2", kTunerTypeDVBS2 },
85  { "ASI", kTunerTypeASI },
86  { "OCUR", kTunerTypeOCUR },
87  { "UNKNOWN", kTunerTypeUnknown },
88  { nullptr, kTunerTypeUnknown },
89 };
90 
92 {
93  { "INVERSION_AUTO", kInversionAuto },
94  { "INVERSION_OFF", kInversionOff },
95  { "INVERSION_ON", kInversionOn },
96  { nullptr, kInversionAuto },
97 };
98 
100 {
101  { "999", kInversionAuto },
102  { "0", kInversionOff },
103  { "1", kInversionOn },
104  { nullptr, kInversionAuto },
105 };
106 
108 {
109  { "a", kInversionAuto },
110  { "0", kInversionOff },
111  { "1", kInversionOn },
112  { nullptr, kInversionAuto },
113 };
114 
116 {
117  "0",
118  "1",
119  "a"
120 };
121 
123 {
124  { "BANDWIDTH_AUTO", kBandwidthAuto },
125  { "BANDWIDTH_8_MHZ", kBandwidth8MHz },
126  { "BANDWIDTH_7_MHZ", kBandwidth7MHz },
127  { "BANDWIDTH_6_MHZ", kBandwidth6MHz },
128  { nullptr, kBandwidthAuto },
129 };
130 
132 {
133  { "999", kBandwidthAuto },
134  { "8", kBandwidth8MHz },
135  { "7", kBandwidth7MHz },
136  { "6", kBandwidth6MHz },
137  { nullptr, kBandwidthAuto },
138 };
139 
141 {
142  { "a", kBandwidthAuto },
143  { "8", kBandwidth8MHz },
144  { "7", kBandwidth7MHz },
145  { "6", kBandwidth6MHz },
146  { nullptr,kBandwidthAuto },
147 };
148 
150 {
151  "8",
152  "7",
153  "6",
154  "a"
155 };
156 
158 {
159  { "FEC_AUTO", kFECAuto },
160  { "FEC_1_2", kFEC_1_2 },
161  { "FEC_2_3", kFEC_2_3 },
162  { "FEC_3_4", kFEC_3_4 },
163  { "FEC_4_5", kFEC_4_5 },
164  { "FEC_5_6", kFEC_5_6 },
165  { "FEC_6_7", kFEC_6_7 },
166  { "FEC_7_8", kFEC_7_8 },
167  { "FEC_8_9", kFEC_8_9 },
168  { "FEC_NONE", kFECNone },
169  { "FEC_3_5", kFEC_3_5 },
170  { "FEC_9_10", kFEC_9_10 },
171  { nullptr, kFECAuto },
172 };
173 
175 {
176  { "999", kFECAuto },
177  { "12", kFEC_1_2 },
178  { "23", kFEC_2_3 },
179  { "34", kFEC_3_4 },
180  { "45", kFEC_4_5 },
181  { "56", kFEC_5_6 },
182  { "67", kFEC_6_7 },
183  { "78", kFEC_7_8 },
184  { "89", kFEC_8_9 },
185  { "0", kFECNone },
186  { "35", kFEC_3_5 },
187  { "910", kFEC_9_10 },
188  { nullptr, kFECAuto }
189 };
190 
192 {
193  { "auto", kFECAuto },
194  { "1/2", kFEC_1_2 },
195  { "2/3", kFEC_2_3 },
196  { "3/4", kFEC_3_4 },
197  { "4/5", kFEC_4_5 },
198  { "5/6", kFEC_5_6 },
199  { "6/7", kFEC_6_7 },
200  { "7/8", kFEC_7_8 },
201  { "8/9", kFEC_8_9 },
202  { "none", kFECNone },
203  { "3/5", kFEC_3_5 },
204  { "9/10", kFEC_9_10},
205  { nullptr, kFECAuto }
206 };
207 
209 {
210  "none",
211  "1/2",
212  "2/3",
213  "3/4",
214  "4/5",
215  "5/6",
216  "6/7",
217  "7/8",
218  "8/9",
219  "auto",
220  "3/5",
221  "9/10",
222 };
223 
225 {
226  { "QAM_AUTO", kModulationQAMAuto },
227  { "QAM_16", kModulationQAM16 },
228  { "QAM_32", kModulationQAM32 },
229  { "QAM_64", kModulationQAM64 },
230  { "QAM_128", kModulationQAM128 },
231  { "QAM_256", kModulationQAM256 },
232  { "QPSK", kModulationQPSK },
233  { "8VSB", kModulation8VSB },
234  { "16VSB", kModulation16VSB },
235  { "8PSK", kModulation8PSK },
236  { "16APSK", kModulation16APSK },
237  { "32APSK", kModulation32APSK },
238  { "DQPSK", kModulationDQPSK },
239  { "16PSK", kModulationInvalid },
240  { "2VSB", kModulationInvalid },
241  { "4VSB", kModulationInvalid },
242  { "BPSK", kModulationInvalid },
243  { "analog", kModulationAnalog },
244  { nullptr, kModulationQAMAuto },
245 };
246 
248 {
249  { "998", kModulationQAMAuto },
250  { "16", kModulationQAM16 },
251  { "32", kModulationQAM32 },
252  { "64", kModulationQAM64 },
253  { "128", kModulationQAM128 },
254  { "256", kModulationQAM256 },
255  { "2", kModulationQPSK },
256  { "5", kModulation8PSK },
257  { "6", kModulation16APSK },
258  { "7", kModulation32APSK },
259  { "10", kModulation8VSB },
260  { "11", kModulation16VSB },
261  { nullptr, kModulationQAMAuto },
262 };
263 
265 {
266  { "auto", kModulationQAMAuto },
267  { "qam_16", kModulationQAM16 },
268  { "qam_32", kModulationQAM32 },
269  { "qam_64", kModulationQAM64 },
270  { "qam_128", kModulationQAM128 },
271  { "qam_256", kModulationQAM256 },
272  { "qpsk", kModulationQPSK },
273  { "8vsb", kModulation8VSB },
274  { "16vsb", kModulation16VSB },
275  { "8psk", kModulation8PSK },
276  { "16apsk", kModulation16APSK },
277  { "32apsk", kModulation32APSK },
278  { "dqpsk", kModulationDQPSK },
279  // alternates
280  { "a", kModulationQAMAuto },
281  { "qam_auto", kModulationQAMAuto },
282  { "qam-16", kModulationQAM16 },
283  { "qam-32", kModulationQAM32 },
284  { "qam-64", kModulationQAM64 },
285  { "qam-128", kModulationQAM128 },
286  { "qam-256", kModulationQAM256 },
287  // qpsk, no alternative
288  { "8-vsb", kModulation8VSB },
289  { "16-vsb", kModulation16VSB },
290  // bpsk, no alternative
291  { "16-apsk", kModulation16APSK },
292  { "32-apsk", kModulation32APSK },
293  { "8-psk", kModulation8PSK },
294  // removed modulations and alternatives
295  { "bpsk", kModulationInvalid },
296  { "2vsb", kModulationInvalid },
297  { "2-vsb", kModulationInvalid },
298  { "4vsb", kModulationInvalid },
299  { "4-vsb", kModulationInvalid },
300  { "16psk", kModulationInvalid },
301  { "16-psk", kModulationInvalid },
302  { nullptr, kModulationQAMAuto },
303 };
304 
306 {
307  "qpsk",
308  "qam_16",
309  "qam_32",
310  "qam_64",
311  "qam_128",
312  "qam_256",
313  "auto",
314  "8vsb",
315  "16vsb",
316  "8psk",
317  "16apsk",
318  "32apsk",
319  "dqpsk"
320 };
321 
323 {
324  { "TRANSMISSION_MODE_AUTO", kTransmissionModeAuto },
325  { "TRANSMISSION_MODE_2K", kTransmissionMode2K },
326  { "TRANSMISSION_MODE_8K", kTransmissionMode8K },
327  { nullptr, kTransmissionModeAuto },
328 };
329 
331 {
332  { "999", kTransmissionModeAuto },
333  { "2", kTransmissionMode2K },
334  { "8", kTransmissionMode8K },
335  { nullptr, kTransmissionModeAuto },
336 };
337 
339 {
340  { "a", kTransmissionModeAuto },
341  { "2", kTransmissionMode2K },
342  { "8", kTransmissionMode8K },
343  { nullptr, kTransmissionModeAuto },
344 };
345 
347 {
348  "2",
349  "8",
350  "a"
351 };
352 
354 {
355  { "GUARD_INTERVAL_AUTO", kGuardIntervalAuto },
356  { "GUARD_INTERVAL_1_32", kGuardInterval_1_32 },
357  { "GUARD_INTERVAL_1_16", kGuardInterval_1_16 },
358  { "GUARD_INTERVAL_1_8", kGuardInterval_1_8 },
359  { "GUARD_INTERVAL_1_4", kGuardInterval_1_4 },
360  { nullptr, kGuardIntervalAuto },
361 };
362 
364 {
365  { "999", kGuardIntervalAuto },
366  { "32", kGuardInterval_1_32 },
367  { "16", kGuardInterval_1_16 },
368  { "8", kGuardInterval_1_8 },
369  { "4", kGuardInterval_1_4 },
370  { nullptr, kGuardIntervalAuto },
371 };
372 
374 {
375  { "auto", kGuardIntervalAuto },
376  { "1/32", kGuardInterval_1_32 },
377  { "1/16", kGuardInterval_1_16 },
378  { "1/8", kGuardInterval_1_8 },
379  { "1/4", kGuardInterval_1_4 },
380  { nullptr, kGuardIntervalAuto },
381 };
382 
384 {
385  "1/32",
386  "1/16",
387  "1/8",
388  "1/4",
389  "auto"
390 };
391 
393 {
394  { "HIERARCHY_NONE", kHierarchyNone },
395  { "HIERARCHY_1", kHierarchy1 },
396  { "HIERARCHY_2", kHierarchy2 },
397  { "HIERARCHY_4", kHierarchy4 },
398  { "HIERARCHY_AUTO", kHierarchyAuto },
399  { nullptr, kHierarchyAuto },
400 };
401 
403 {
404  { "0", kHierarchyNone },
405  { "1", kHierarchy1 },
406  { "2", kHierarchy2 },
407  { "4", kHierarchy4 },
408  { "999", kHierarchyAuto },
409  { nullptr, kHierarchyAuto },
410 };
411 
413 {
414  { "n", kHierarchyNone },
415  { "1", kHierarchy1 },
416  { "2", kHierarchy2 },
417  { "4", kHierarchy4 },
418  { "a", kHierarchyAuto },
419  { nullptr, kHierarchyAuto },
420 };
421 
423 {
424  "n",
425  "1",
426  "2",
427  "4",
428  "a"
429 };
430 
432 {
433  { "v", kPolarityVertical },
434  { "h", kPolarityHorizontal },
435  { "r", kPolarityRight },
436  { "l", kPolarityLeft },
437  { nullptr, kPolarityVertical },
438 };
439 
441 {
442  "v",
443  "h",
444  "r",
445  "l"
446 };
447 
449 {
450  { "SYS_UNDEFINED", kModulationSystem_UNDEFINED },
451  { "SYS_DVBC_ANNEX_A", kModulationSystem_DVBC_ANNEX_A },
452  { "SYS_DVBC_ANNEX_B", kModulationSystem_DVBC_ANNEX_B },
453  { "SYS_DVBT", kModulationSystem_DVBT },
454  { "SYS_DVBT2", kModulationSystem_DVBT2 },
455  { "SYS_DSS", kModulationSystem_DSS },
456  { "SYS_DVBS", kModulationSystem_DVBS },
457  { "SYS_DVBS2", kModulationSystem_DVBS2 },
458  { "SYS_DVBH", kModulationSystem_DVBH },
459  { "SYS_ISDBT", kModulationSystem_ISDBT },
460  { "SYS_ISDBS", kModulationSystem_ISDBS },
461  { "SYS_ISDBC", kModulationSystem_ISDBC },
462  { "SYS_ATSC", kModulationSystem_ATSC },
463  { "SYS_ATSCMH", kModulationSystem_ATSCMH },
464  { "SYS_DMBTH", kModulationSystem_DMBTH },
465  { "SYS_CMMB", kModulationSystem_CMMB },
466  { "SYS_DAB", kModulationSystem_DAB },
467  { "SYS_TURBO", kModulationSystem_TURBO },
468  { "SYS_DVBC_ANNEX_C", kModulationSystem_DVBC_ANNEX_C },
469  { nullptr, kModulationSystem_UNDEFINED },
470 };
471 
473 {
474  { "0", kModulationSystem_DVBS },
475  { "1", kModulationSystem_DVBS2 },
476  { nullptr, kModulationSystem_UNDEFINED },
477 };
478 
480 {
481  { "UNDEFINED", kModulationSystem_UNDEFINED },
482  { "DVB-C/A", kModulationSystem_DVBC_ANNEX_A },
483  { "DVB-C/B", kModulationSystem_DVBC_ANNEX_B },
484  { "DVB-T", kModulationSystem_DVBT },
485  { "DSS", kModulationSystem_DSS },
486  { "DVB-S", kModulationSystem_DVBS },
487  { "DVB-S2", kModulationSystem_DVBS2 },
488  { "DVBH", kModulationSystem_DVBH },
489  { "ISDBT", kModulationSystem_ISDBT },
490  { "ISDBS", kModulationSystem_ISDBS },
491  { "ISDBC", kModulationSystem_ISDBC },
492  { "ATSC", kModulationSystem_ATSC },
493  { "ATSCMH", kModulationSystem_ATSCMH },
494  { "DMBTH", kModulationSystem_DMBTH },
495  { "CMMB", kModulationSystem_CMMB },
496  { "DAB", kModulationSystem_DAB },
497  { "DVB-T2", kModulationSystem_DVBT2 },
498  { "TURBO", kModulationSystem_TURBO },
499  { "DVB-C/C", kModulationSystem_DVBC_ANNEX_C },
500  { nullptr, kModulationSystem_UNDEFINED },
501 };
502 
504 {
505  "UNDEFINED",
506  "DVB-C/A",
507  "DVB-C/B",
508  "DVB-T",
509  "DSS",
510  "DVB-S",
511  "DVB-S2",
512  "DVBH",
513  "ISDBT",
514  "ISDBS",
515  "ISDBC",
516  "ATSC",
517  "ATSCMH",
518  "DMBTH",
519  "CMMB",
520  "DAB",
521  "DVB-T2",
522  "TURBO",
523  "DVB-C/C",
524 };
525 
527 {
528  { "ROLLOFF_35", kRollOff_35 },
529  { "ROLLOFF_20", kRollOff_20 },
530  { "ROLLOFF_25", kRollOff_25 },
531  { "ROLLOFF_AUTO", kRollOff_Auto },
532  { nullptr, kRollOff_35 },
533 };
534 
536 {
537  { "35", kRollOff_35 },
538  { "20", kRollOff_20 },
539  { "25", kRollOff_25 },
540  { "0", kRollOff_Auto },
541  { nullptr, kRollOff_35 },
542 };
544 {
545  { "0.35", kRollOff_35 },
546  { "0.20", kRollOff_20 },
547  { "0.25", kRollOff_25 },
548  { "auto", kRollOff_Auto },
549  { nullptr, kRollOff_35 },
550 };
551 
553 {
554  "0.35",
555  "0.20",
556  "0.25",
557  "auto",
558 };
static const DTVParamHelperStruct s_confTable[]
static const DTVParamHelperStruct s_parseTable[]
static const DTVParamHelperStruct s_confTable[]
static const DTVParamHelperStruct s_parseTable[]
static QMap< int, QString > dtv_tt_canonical_str
static const DTVParamHelperStruct s_vdrTable[]
static const int kTunerTypeDVBT
static const uint kDBStrCnt
static const char * s_dbStr[kDBStrCnt]
static const int kTunerTypeATSC
static const DTVParamHelperStruct s_vdrTable[]
static const uint kDBStrCnt
static const DTVParamHelperStruct s_vdrTable[]
static const int kTunerTypeUnknown
static const char * s_dbStr[kDBStrCnt]
static const DTVParamHelperStruct s_confTable[]
static const uint kDBStrCnt
static const DTVParamHelperStruct s_parseTable[]
static const DTVParamHelperStruct s_vdrTable[]
static const int kTunerTypeOCUR
static const uint kDBStrCnt
static QString toString(const char *strings[], int index, uint strings_size)
static const DTVParamHelperStruct s_parseTable[]
unsigned int uint
Definition: compat.h:140
static QMutex dtv_tt_canonical_str_lock
static const int kTunerTypeDVBS1
static const DTVParamHelperStruct s_parseTable[]
static const DTVParamHelperStruct s_confTable[]
static const uint kDBStrCnt
static const int kTunerTypeDVBS2
static const DTVParamHelperStruct s_parseTable[]
static const int kTunerTypeDVBT2
static const int kTunerTypeDVBC
static const DTVParamHelperStruct s_confTable[]
static const DTVParamHelperStruct s_parseTable[]
static const char * s_dbStr[kDBStrCnt]
static const uint kDBStrCnt
static const DTVParamHelperStruct s_vdrTable[]
static const char * s_dbStr[kDBStrCnt]
static const uint kDBStrCnt
static const DTVParamHelperStruct s_vdrTable[]
static const DTVParamHelperStruct s_confTable[]
static const DTVParamHelperStruct s_parseTable[]
static const DTVParamHelperStruct s_vdrTable[]
static const uint kDBStrCnt
static const char * s_dbStr[kDBStrCnt]
static const DTVParamHelperStruct s_parseTable[]
static const char * s_dbStr[kDBStrCnt]
static bool ParseParam(const QString &symbol, int &value, const DTVParamHelperStruct *table)
static const DTVParamHelperStruct s_parseTable[]
static const DTVParamHelperStruct s_confTable[]
static const int kTunerTypeIPTV
static const int kTunerTypeASI
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
static const DTVParamHelperStruct s_vdrTable[]
static const DTVParamHelperStruct s_parseTable[]
static const DTVParamHelperStruct s_confTable[]
static const char * s_dbStr[kDBStrCnt]
static const uint kDBStrCnt
static const char * s_dbStr[kDBStrCnt]
static const DTVParamHelperStruct s_vdrTable[]
static void initStr(void)
static const DTVParamHelperStruct s_confTable[]
static const char * s_dbStr[kDBStrCnt]
static const char * s_dbStr[kDBStrCnt]
QString toString() const
static const uint kDBStrCnt