From ff090c0c0ea3a5b8b6534c5e95c0a72ef65d63d8 Mon Sep 17 00:00:00 2001
From: Karl Dietz <dekarl@users.sourceforge.net>
Date: Wed, 11 Jan 2012 20:13:01 +0100
Subject: [PATCH 1/5] unbreak the channels.conf importer for DVB
ChannelUtils knows the original_network_id and transport_id, but DTVMultiplex
ignored them completely...
Set SI standard to dvb as VDR style channels.conf we read are always DVB.
Also import symbol rate for DVB-C/S while here.
Fix frequency parsing for DVB-S.
---
mythtv/libs/libmythtv/dtvconfparser.cpp | 40 +++++++++++++++++++++++++-----
mythtv/libs/libmythtv/dtvmultiplex.cpp | 19 +++++++++++---
mythtv/libs/libmythtv/dtvmultiplex.h | 4 ++-
3 files changed, 51 insertions(+), 12 deletions(-)
diff --git a/mythtv/libs/libmythtv/dtvconfparser.cpp b/mythtv/libs/libmythtv/dtvconfparser.cpp
index e4bc862..8247db3 100644
a
|
b
|
DTVConfParser::return_t DTVConfParser::Parse(void) |
108 | 108 | |
109 | 109 | str = list[3]; |
110 | 110 | |
111 | | if ((str == "T") || (str == "C") || (str == "S")) |
| 111 | # http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf |
| 112 | # e.g. C, T, S19.2E |
| 113 | if ((str == "T") || (str == "C") || (str[0] == 'S')) |
112 | 114 | { |
113 | 115 | if ((type == OFDM) && (str == "T")) |
114 | 116 | ok &= ParseVDR(list, channelNo); |
115 | | else if ((type == QPSK || type == DVBS2) && (str == "S")) |
| 117 | else if ((type == QPSK || type == DVBS2) && (str[0] == 'S')) |
116 | 118 | ok &= ParseVDR(list, channelNo); |
117 | 119 | else if ((type == QAM) && (str == "C")) |
118 | 120 | ok &= ParseVDR(list, channelNo); |
… |
… |
bool DTVConfParser::ParseVDR(const QStringList &tokens, int channelNo) |
230 | 232 | |
231 | 233 | // BBC ONE:754166:I999B8C34D34M16T2G32Y0:T:27500:600:601, 602:0:0:4168:0:0:0 |
232 | 234 | |
233 | | PARSE_SKIP(unknown); |
| 235 | PARSE_SKIP(unknown); // channel name; bouquet name |
234 | 236 | |
235 | | PARSE_UINT_1000(mux.frequency); |
| 237 | // FIXME http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf#Frequency |
| 238 | // should read the number and multiply by 1,000 until its bigger then 1,000,000 |
| 239 | // to get frequency in Hz. |
| 240 | // But we have to return the frequency in Hz for DVB-C/T and kHz for DVB-S |
| 241 | long long frequency; |
| 242 | PARSE_UINT(frequency); |
| 243 | while ((frequency>0) && (frequency<1000000)) { |
| 244 | frequency *= 1000; |
| 245 | } |
236 | 246 | |
237 | 247 | if (it == tokens.end()) |
238 | 248 | return false; |
… |
… |
bool DTVConfParser::ParseVDR(const QStringList &tokens, int channelNo) |
286 | 296 | } |
287 | 297 | } |
288 | 298 | |
289 | | for (uint i = 0; i < 6; i++) |
290 | | PARSE_SKIP(unknown); |
291 | | |
| 299 | // http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf |
| 300 | QString source; |
| 301 | PARSE_STR(source); // source: C, S19.2E, T |
| 302 | if (source[0] == 'S') { |
| 303 | mux.frequency = frequency / 1000; |
| 304 | } else { |
| 305 | mux.frequency = frequency; |
| 306 | } |
| 307 | PARSE_UINT_1000(mux.symbolrate); // symbol rate / 1000 |
| 308 | PARSE_SKIP(unknown); // video pid |
| 309 | PARSE_SKIP(unknown); // audio pid |
| 310 | PARSE_SKIP(unknown); // teletext pid |
| 311 | PARSE_SKIP(unknown); // conditional access |
292 | 312 | PARSE_UINT(chan.serviceid); |
| 313 | PARSE_UINT(mux.original_network_id); |
| 314 | PARSE_UINT(mux.transport_id); |
| 315 | PARSE_SKIP(unknown); // radio_id <- VDR custom to make onid/tid/sid unique |
| 316 | |
| 317 | // VDR is always DVB, it doesn't do ATSC/SCTE (it does analogue TV, but we should only end up here for digital tv) |
| 318 | mux.sistandard = "dvb"; |
293 | 319 | |
294 | 320 | AddChannel(mux, chan); |
295 | 321 | |
diff --git a/mythtv/libs/libmythtv/dtvmultiplex.cpp b/mythtv/libs/libmythtv/dtvmultiplex.cpp
index 35b4666..192b9e7 100644
a
|
b
|
DTVMultiplex::DTVMultiplex(const DTVMultiplex &other) : |
22 | 22 | mod_sys(other.mod_sys), |
23 | 23 | rolloff(other.rolloff), |
24 | 24 | mplex(other.mplex), |
25 | | sistandard(other.sistandard) |
| 25 | sistandard(other.sistandard), |
| 26 | original_network_id(other.original_network_id), |
| 27 | transport_id(other.transport_id) |
26 | 28 | { |
27 | 29 | } |
28 | 30 | |
… |
… |
DTVMultiplex &DTVMultiplex::operator=(const DTVMultiplex &other) |
44 | 46 | rolloff = other.rolloff; |
45 | 47 | mplex = other.mplex; |
46 | 48 | sistandard = other.sistandard; |
| 49 | original_network_id = other.original_network_id; |
| 50 | transport_id = other.transport_id; |
47 | 51 | return *this; |
48 | 52 | } |
49 | 53 | |
… |
… |
bool DTVMultiplex::FillFromDB(DTVTunerType type, uint mplexid) |
320 | 324 | " hp_code_rate, lp_code_rate, constellation, " |
321 | 325 | " transmission_mode, guard_interval, hierarchy, " |
322 | 326 | " modulation, bandwidth, sistandard, " |
323 | | " mod_sys, rolloff " |
| 327 | " mod_sys, rolloff, networkid, " |
| 328 | " transportid " |
324 | 329 | "FROM dtv_multiplex " |
325 | 330 | "WHERE dtv_multiplex.mplexid = :MPLEXID"); |
326 | 331 | query.bindValue(":MPLEXID", mplexid); |
… |
… |
bool DTVMultiplex::FillFromDB(DTVTunerType type, uint mplexid) |
342 | 347 | |
343 | 348 | mplex = mplexid; |
344 | 349 | sistandard = query.value(13).toString(); |
| 350 | original_network_id = query.value(16).toString(); |
| 351 | transport_id = query.value(17).toString(); |
345 | 352 | |
346 | 353 | // Parse the query into our DVBTuning class |
347 | 354 | return ParseTuningParams( |
… |
… |
uint ScanDTVTransport::SaveScan(uint scanid) const |
503 | 510 | " hp_code_rate, lp_code_rate, modulation, " |
504 | 511 | " transmission_mode, guard_interval, hierarchy, " |
505 | 512 | " mod_sys, rolloff, " |
506 | | " bandwidth, sistandard, tuner_type " |
| 513 | " bandwidth, sistandard, tuner_type, " |
| 514 | " networkid, transportid, " |
507 | 515 | " ) " |
508 | 516 | "VALUES " |
509 | 517 | " ( :SCANID, " |
… |
… |
uint ScanDTVTransport::SaveScan(uint scanid) const |
512 | 520 | " :HP_CODE_RATE, :LP_CODE_RATE, :MODULATION, " |
513 | 521 | " :TRANSMISSION_MODE, :GUARD_INTERVAL, :HIERARCHY, " |
514 | 522 | " :MOD_SYS, :ROLLOFF, " |
515 | | " :BANDWIDTH, :SISTANDARD, :TUNER_TYPE " |
| 523 | " :BANDWIDTH, :SISTANDARD, :TUNER_TYPE, " |
| 524 | " :ONID, :TID " |
516 | 525 | " );"); |
517 | 526 | |
518 | 527 | query.bindValue(":SCANID", scanid); |
… |
… |
uint ScanDTVTransport::SaveScan(uint scanid) const |
533 | 542 | query.bindValue(":BANDWIDTH", bandwidth.toString()); |
534 | 543 | query.bindValue(":SISTANDARD", sistandard); |
535 | 544 | query.bindValue(":TUNER_TYPE", (uint)tuner_type); |
| 545 | query.bindValue(":ONID", original_network_id); |
| 546 | query.bindValue(":TID", transport_id); |
536 | 547 | |
537 | 548 | if (!query.exec()) |
538 | 549 | { |
diff --git a/mythtv/libs/libmythtv/dtvmultiplex.h b/mythtv/libs/libmythtv/dtvmultiplex.h
index 273131c..5d07e55 100644
a
|
b
|
class DTVMultiplex |
23 | 23 | { |
24 | 24 | public: |
25 | 25 | DTVMultiplex() |
26 | | : frequency(0), symbolrate(0), mplex(0), sistandard(QString::null) { } |
| 26 | : frequency(0), symbolrate(0), mplex(0), sistandard(QString::null), original_network_id(0), transport_id(0) { } |
27 | 27 | DTVMultiplex(const DTVMultiplex &other); |
28 | 28 | DTVMultiplex &operator=(const DTVMultiplex &other); |
29 | 29 | virtual ~DTVMultiplex() { } |
… |
… |
class DTVMultiplex |
90 | 90 | // Optional additional info |
91 | 91 | uint mplex; |
92 | 92 | QString sistandard; |
| 93 | uint original_network_id; |
| 94 | uint transport_id; |
93 | 95 | }; |
94 | 96 | |
95 | 97 | class ScanDTVTransport : public DTVMultiplex |