Ticket #5562: t5562_populate_default_authority_r21414.diff
File t5562_populate_default_authority_r21414.diff, 17.7 KB (added by , 15 years ago) |
---|
-
mythtv/libs/libmythtv/channelscan/channelimporter.cpp
diff --git a/mythtv/libs/libmythtv/channelscan/channelimporter.cpp b/mythtv/libs/libmythtv/channelscan/channelimporter.cpp index 8b8086c..a44838d 100644
a b ScanDTVTransportList ChannelImporter::InsertChannels( 358 358 chan.atsc_minor_channel, 359 359 chan.use_on_air_guide, 360 360 chan.hidden, chan.hidden_in_guide, 361 chan.freqid); 361 chan.freqid, 362 QString::null, 363 QString::null, 364 QString::null, 365 chan.default_authority); 362 366 } 363 367 } 364 368 … … ScanDTVTransportList ChannelImporter::UpdateChannels( 484 488 chan.atsc_minor_channel, 485 489 chan.use_on_air_guide, 486 490 chan.hidden, chan.hidden_in_guide, 487 chan.freqid); 491 chan.freqid, 492 QString::null, 493 QString::null, 494 QString::null, 495 chan.default_authority); 488 496 } 489 497 490 498 if (filter) -
mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp
diff --git a/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp b/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp index bed9db3..233d23e 100644
a b 65 65 /// 10 seconds, so lets wait at least 30 seconds, in 66 66 /// case of bad transmitter or lost packets. 67 67 const uint ChannelScanSM::kDVBTableTimeout = 30 * 1000; 68 /// The whole BAT & SDTo group comes round in 10s, so wait additional 69 /// 12 seconds to kDVBTableTimeout 70 const uint ChannelScanSM::kDVBoTableTimeout = ChannelScanSM::kDVBTableTimeout + 71 12 * 1000; 68 72 /// No logic here, lets just wait at least 10 seconds. 69 73 const uint ChannelScanSM::kATSCTableTimeout = 10 * 1000; 70 74 /// No logic here, lets just wait at least 15 seconds. … … ChannelScanSM::ChannelScanSM( 148 152 wait_for_mpeg(false), 149 153 wait_for_atsc(false), 150 154 wait_for_dvb(false), 155 wait_for_dvbo(false), 151 156 // Transports List 152 157 transportsScanned(0), 153 158 currentTestingDecryption(false), … … ChannelScanSM::ChannelScanSM( 183 188 data->AddMPEGListener(this); 184 189 data->AddATSCMainListener(this); 185 190 data->AddDVBMainListener(this); 191 data->AddDVBOtherListener(this); 186 192 } 187 193 } 188 194 … … void ChannelScanSM::HandleMGT(const MasterGuideTable *mgt) 372 378 UpdateChannelInfo(true); 373 379 } 374 380 375 void ChannelScanSM::HandleSDT(uint , const ServiceDescriptionTable *sdt)381 void ChannelScanSM::HandleSDT(uint tsid, const ServiceDescriptionTable *sdt) 376 382 { 377 383 VERBOSE(VB_CHANSCAN, LOC + 378 384 QString("Got a Service Description Table for %1") … … void ChannelScanSM::HandleNIT(const NetworkInformationTable *nit) 396 402 QString("Got a Network Information Table for %1") 397 403 .arg((*current).FriendlyName) + "\n" + nit->toString()); 398 404 405 uint netid = nit->NetworkID(); 406 407 // If this is Astra 28.2 add start listening for Freesat BAT and SDTo 408 if (!wait_for_dvbo && (netid == 2 || netid == 59)) 409 { 410 GetDTVSignalMonitor()->GetScanStreamData()->SetFreesatAdditionalSI(true); 411 wait_for_dvbo = true; 412 } 413 399 414 wait_for_dvb = true; 400 415 UpdateChannelInfo(true); 401 416 } 402 417 418 void ChannelScanSM::HandleBAT(const BouquetAssociationTable *bat) 419 { 420 VERBOSE(VB_CHANSCAN, LOC + "Got a Bouquet Association Table\n" + 421 bat->toString()); 422 423 for (uint i = 0; i < bat->TransportStreamCount(); i++) 424 { 425 uint tsid = bat->TSID(i); 426 uint netid = bat->OriginalNetworkID(i); 427 desc_list_t parsed = 428 MPEGDescriptor::Parse(bat->TransportDescriptors(i), 429 bat->TransportDescriptorsLength(i)); 430 // Look for default authority 431 const unsigned char *def_auth = 432 MPEGDescriptor::Find(parsed, DescriptorID::default_authority); 433 const unsigned char *serv_list = 434 MPEGDescriptor::Find(parsed, DescriptorID::service_list); 435 436 if (def_auth && serv_list) 437 { 438 DefaultAuthorityDescriptor authority(def_auth); 439 ServiceListDescriptor services(serv_list); 440 441 for (uint j = 0; j < services.ServiceCount(); j++) 442 { 443 // If the default authority is given in the SDT this 444 // overrides any definition in the BAT (or in the NIT) 445 uint64_t index = 446 ((uint64_t)netid << 32) | (tsid << 16) | services.ServiceID(j); 447 if (! defAuthorities.contains(index)) 448 defAuthorities[index] = authority.DefaultAuthority(); 449 } 450 } 451 } 452 UpdateChannelInfo(true); 453 } 454 455 void ChannelScanSM::HandleSDTo(uint tsid, const ServiceDescriptionTable *sdt) 456 { 457 VERBOSE(VB_CHANSCAN, LOC + "Got a Service Description Table (other)\n" + 458 sdt->toString()); 459 460 uint netid = sdt->OriginalNetworkID(); 461 462 for (uint i = 0; i < sdt->ServiceCount(); i++) 463 { 464 uint serviceId = sdt->ServiceID(i); 465 desc_list_t parsed = 466 MPEGDescriptor::Parse(sdt->ServiceDescriptors(i), 467 sdt->ServiceDescriptorsLength(i)); 468 // Look for default authority 469 const unsigned char *def_auth = 470 MPEGDescriptor::Find(parsed, DescriptorID::default_authority); 471 if (def_auth) 472 { 473 DefaultAuthorityDescriptor authority(def_auth); 474 defAuthorities[((uint64_t)netid << 32) | (tsid << 16) | serviceId] = 475 authority.DefaultAuthority(); 476 } 477 } 478 UpdateChannelInfo(true); 479 } 480 403 481 void ChannelScanSM::HandleEncryptionStatus(uint pnum, bool encrypted) 404 482 { 405 483 currentEncryptionStatus[pnum] = encrypted ? kEncEncrypted : kEncDecrypted; … … bool ChannelScanSM::UpdateChannelInfo(bool wait_until_complete) 784 862 currentEncryptionStatus.clear(); 785 863 currentEncryptionStatusChecked.clear(); 786 864 787 wait_for_mpeg = wait_for_atsc = wait_for_dvb = false;865 wait_for_mpeg = wait_for_atsc = wait_for_dvb = wait_for_dvbo = false; 788 866 789 867 if (scanning) 790 868 { … … static void update_info(ChannelInsertInfo &info, 849 927 } 850 928 851 929 static void update_info(ChannelInsertInfo &info, 852 const ServiceDescriptionTable *sdt, uint i) 930 const ServiceDescriptionTable *sdt, uint i, 931 const QMap<uint64_t, QString> &defAuthorities) 853 932 { 854 933 // HACK beg -- special exception for this network 855 934 // (dbver == "1067") … … static void update_info(ChannelInsertInfo &info, 888 967 (desc && !desc->IsDTV() && !desc->IsDigitalAudio()); 889 968 info.is_audio_service = (desc && desc->IsDigitalAudio()); 890 969 970 info.service_id = sdt->ServiceID(i); 891 971 info.sdt_tsid = sdt->TSID(); 892 972 info.orig_netid = sdt->OriginalNetworkID(); 893 973 info.in_sdt = true; 974 975 desc_list_t parsed = 976 MPEGDescriptor::Parse(sdt->ServiceDescriptors(i), 977 sdt->ServiceDescriptorsLength(i)); 978 // Look for default authority 979 const unsigned char *def_auth = 980 MPEGDescriptor::Find(parsed, DescriptorID::default_authority); 981 if (def_auth) 982 { 983 DefaultAuthorityDescriptor authority(def_auth); 984 info.default_authority = authority.DefaultAuthority(); 985 } 986 else 987 { 988 uint64_t index = (uint64_t)info.orig_netid << 32 | 989 info.sdt_tsid << 16 | info.service_id; 990 if (defAuthorities.contains(index)) 991 info.default_authority = defAuthorities[index]; 992 } 894 993 } 895 994 896 995 uint ChannelScanSM::GetCurrentTransportInfo( … … ChannelScanSM::GetChannelList(transport_scan_items_it_t trans_info, 1041 1140 { 1042 1141 uint pnum = (*sdt_it)->ServiceID(i); 1043 1142 PCM_INFO_INIT("dvb"); 1044 update_info(info, *sdt_it, i );1143 update_info(info, *sdt_it, i, defAuthorities); 1045 1144 } 1046 1145 } 1047 1146 } … … bool ChannelScanSM::HasTimedOut(void) 1296 1395 if (wait_for_dvb && !sd->HasCachedAllNIT() && !sd->HasCachedAllSDTs()) 1297 1396 max_timeout = max(max_timeout, (int) kDVBTableTimeout); 1298 1397 1398 if (wait_for_dvbo) 1399 max_timeout = max(max_timeout, (int) kDVBoTableTimeout); 1400 1299 1401 if (wait_for_atsc && !sd->HasCachedMGT() && !sd->HasCachedAllVCTs()) 1300 1402 max_timeout = max(max_timeout, (int) kATSCTableTimeout); 1301 1403 -
mythtv/libs/libmythtv/channelscan/channelscan_sm.h
diff --git a/mythtv/libs/libmythtv/channelscan/channelscan_sm.h b/mythtv/libs/libmythtv/channelscan/channelscan_sm.h index 0c054e9..26b4d72 100644
a b class AnalogSignalHandler : public SignalMonitorListener 82 82 83 83 class ChannelScanSM : public MPEGStreamListener, 84 84 public ATSCMainStreamListener, 85 public DVBMainStreamListener 85 public DVBMainStreamListener, 86 public DVBOtherStreamListener 86 87 { 87 88 friend class AnalogSignalHandler; 88 89 … … class ChannelScanSM : public MPEGStreamListener, 144 145 void HandleSDT(uint tsid, const ServiceDescriptionTable*); 145 146 void HandleTDT(const TimeDateTable*) {} 146 147 148 // DVB Other 149 void HandleNITo(const NetworkInformationTable*) {} 150 void HandleSDTo(uint tsid, const ServiceDescriptionTable*); 151 void HandleBAT(const BouquetAssociationTable*); 152 147 153 private: 148 154 // some useful gets 149 155 DTVChannel *GetDTVChannel(void); … … class ChannelScanSM : public MPEGStreamListener, 188 194 static QString loc(const ChannelScanSM*); 189 195 190 196 static const uint kDVBTableTimeout; 197 static const uint kDVBoTableTimeout; 191 198 static const uint kATSCTableTimeout; 192 199 static const uint kMPEGTableTimeout; 193 200 … … class ChannelScanSM : public MPEGStreamListener, 213 220 bool wait_for_mpeg; 214 221 bool wait_for_atsc; 215 222 bool wait_for_dvb; 223 bool wait_for_dvbo; 216 224 217 225 // Transports List 218 226 int transportsScanned; … … class ChannelScanSM : public MPEGStreamListener, 223 231 bool currentTestingDecryption; 224 232 QMap<uint, uint> currentEncryptionStatus; 225 233 QMap<uint, bool> currentEncryptionStatusChecked; 234 QMap<uint64_t, QString> defAuthorities; 226 235 227 236 /// Found Channel Info 228 237 ChannelList channelList; -
mythtv/libs/libmythtv/channelscan/scaninfo.cpp
diff --git a/mythtv/libs/libmythtv/channelscan/scaninfo.cpp b/mythtv/libs/libmythtv/channelscan/scaninfo.cpp index e01035e..bfa3829 100644
a b ScanDTVTransportList LoadScan(uint scanid) 119 119 " in_pat, in_pmt, in_vct, " 120 120 " in_nit, in_sdt, is_encrypted, " 121 121 " is_data_service, is_audio_service, is_opencable, " 122 " could_be_opencable, decryption_status "122 " could_be_opencable, decryption_status, default_authority " 123 123 "FROM channelscan_channel " 124 124 "WHERE transportid = :TRANSPORTID"); 125 125 query2.bindValue(":TRANSPORTID", query.value(15).toUInt()); … … ScanDTVTransportList LoadScan(uint scanid) 178 178 query2.value(31).toBool()/*is_audio_service*/, 179 179 query2.value(32).toBool()/*is_opencable*/, 180 180 query2.value(33).toBool()/*could_be_opencable*/, 181 query2.value(34).toInt()/*decryption_status*/); 181 query2.value(34).toInt()/*decryption_status*/, 182 query2.value(35).toString()/*default_authority*/); 182 183 183 184 mux.channels.push_back(chan); 184 185 } -
mythtv/libs/libmythtv/dbchannelinfo.cpp
diff --git a/mythtv/libs/libmythtv/dbchannelinfo.cpp b/mythtv/libs/libmythtv/dbchannelinfo.cpp index aa500e3..cf6f623 100644
a b bool ChannelInsertInfo::SaveScan(uint scanid, uint transportid) const 170 170 " in_pat, in_pmt, in_vct, " 171 171 " in_nit, in_sdt, is_encrypted, " 172 172 " is_data_service, is_audio_service, is_opencable, " 173 " could_be_opencable, decryption_status 173 " could_be_opencable, decryption_status, default_authority " 174 174 " ) " 175 175 "VALUES " 176 176 " ( :SCANID, :TRANSPORTID, " … … bool ChannelInsertInfo::SaveScan(uint scanid, uint transportid) const 185 185 " :IN_PAT, :IN_PMT, :IN_VCT, " 186 186 " :IN_NIT, :IN_SDT, :IS_ENCRYPTED, " 187 187 " :IS_DATA_SERVICE, :IS_AUDIO_SERVICE, :IS_OPEBCABLE, " 188 " :COULD_BE_OPENCABLE,:DECRYPTION_STATUS 188 " :COULD_BE_OPENCABLE,:DECRYPTION_STATUS, :DEFAULT_AUTHORITY " 189 189 " );"); 190 190 191 191 query.bindValue(":SCANID", scanid); … … bool ChannelInsertInfo::SaveScan(uint scanid, uint transportid) const 225 225 query.bindValue(":IS_OPEBCABLE", is_opencable); 226 226 query.bindValue(":COULD_BE_OPENCABLE", could_be_opencable); 227 227 query.bindValue(":DECRYPTION_STATUS", decryption_status); 228 query.bindValue(":DEFAULT_AUTHORITY", default_authority); 228 229 229 230 if (!query.exec()) 230 231 { … … ChannelInsertInfo::ChannelInsertInfo( 254 255 bool _in_nit, bool _in_sdt, 255 256 bool _is_encrypted, bool _is_data_service, 256 257 bool _is_audio_service, bool _is_opencable, 257 bool _could_be_opencable, int _decryption_status) : 258 bool _could_be_opencable, int _decryption_status, 259 QString _default_authority) : 258 260 db_mplexid(_db_mplexid), 259 261 source_id(_source_id), 260 262 channel_id(_channel_id), … … ChannelInsertInfo::ChannelInsertInfo( 271 273 icon(_icon), 272 274 format(_format), 273 275 xmltvid(_xmltvid), 276 default_authority(_default_authority), 274 277 pat_tsid(_pat_tsid), 275 278 vct_tsid(_vct_tsid), 276 279 vct_chan_tsid(_vct_chan_tsid), … … ChannelInsertInfo::ChannelInsertInfo( 298 301 icon.detach(); 299 302 format.detach(); 300 303 xmltvid.detach(); 304 default_authority.detach(); 301 305 si_standard.detach(); 302 306 } 303 307 … … ChannelInsertInfo &ChannelInsertInfo::operator=( 320 324 icon = other.icon; icon.detach(); 321 325 format = other.format; format.detach(); 322 326 xmltvid = other.xmltvid; xmltvid.detach(); 327 default_authority = other.default_authority; default_authority.detach(); 323 328 324 329 // non-DB info 325 330 pat_tsid = other.pat_tsid; … … void ChannelInsertInfo::ImportExtraInfo(const ChannelInsertInfo &other) 391 396 { 392 397 xmltvid = other.xmltvid; xmltvid.detach(); 393 398 } 399 if (!other.default_authority.isEmpty() && default_authority.isEmpty()) 400 { 401 default_authority = other.default_authority; default_authority.detach(); 402 } 394 403 // non-DB info 395 404 if (other.pat_tsid && !pat_tsid) 396 405 pat_tsid = other.pat_tsid; -
mythtv/libs/libmythtv/dbchannelinfo.h
diff --git a/mythtv/libs/libmythtv/dbchannelinfo.h b/mythtv/libs/libmythtv/dbchannelinfo.h index 5d1dc14..b2f9135 100644
a b class MPUBLIC ChannelInsertInfo 90 90 hidden(false), hidden_in_guide(false), 91 91 freqid(QString::null), icon(QString::null), 92 92 format(QString::null), xmltvid(QString::null), 93 default_authority(QString::null), 93 94 pat_tsid(0), vct_tsid(0), vct_chan_tsid(0), sdt_tsid(0), 94 95 orig_netid(0), netid(0), 95 96 si_standard(QString::null), … … class MPUBLIC ChannelInsertInfo 128 129 129 130 bool _is_encrypted, bool _is_data_service, 130 131 bool _is_audio_service, bool _is_opencable, 131 bool _could_be_opencable, int _decryption_status); 132 bool _could_be_opencable, int _decryption_status, 133 QString _default_authority); 132 134 133 135 ChannelInsertInfo(const ChannelInsertInfo &other) { (*this = other); } 134 136 ChannelInsertInfo &operator=(const ChannelInsertInfo &other); … … class MPUBLIC ChannelInsertInfo 156 158 QString icon; 157 159 QString format; 158 160 QString xmltvid; 161 QString default_authority; 159 162 160 163 // non-DB info 161 164 uint pat_tsid; -
mythtv/libs/libmythtv/dtvmultiplex.cpp
diff --git a/mythtv/libs/libmythtv/dtvmultiplex.cpp b/mythtv/libs/libmythtv/dtvmultiplex.cpp index ebe3be3..d28896b 100644
a b bool ScanDTVTransport::FillFromDB(DTVTunerType type, uint mplexid) 425 425 " c.serviceid, c.atsc_major_chan, c.atsc_minor_chan, " 426 426 " c.useonairguide, c.visible, c.freqid, " 427 427 " c.icon, c.tvformat, c.xmltvid, " 428 " d.transportid, d.networkid 428 " d.transportid, d.networkid, c.default_authority " 429 429 "FROM channel AS c, dtv_multiplex AS d " 430 430 "WHERE c.mplexid = :MPLEXID AND" 431 431 " c.mplexid = d.mplexid"); … … bool ScanDTVTransport::FillFromDB(DTVTunerType type, uint mplexid) 455 455 QString::null, 456 456 false, false, false, false, 457 457 false, false, false, false, 458 false, false, false, 0); 458 false, false, false, 0, 459 query.value(18).toString() /* default_authority */); 459 460 460 461 channels.push_back(chan); 461 462 }