Ticket #5562: defaultauthority_patch2-0-22-fixes-r23473.patch
File defaultauthority_patch2-0-22-fixes-r23473.patch, 9.1 KB (added by , 14 years ago) |
---|
-
mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp
diff -aur a/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp b/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp
a b 146 146 sourceID(_sourceID), 147 147 signalTimeout(signal_timeout), 148 148 channelTimeout(channel_timeout), 149 otherTableTimeout(0), 150 otherTableTime(0), 151 setOtherTables(false), 149 152 inputname(_inputname), 150 153 m_test_decryption(test_decryption), 151 154 extend_scan_list(false), … … 190 193 data->AddMPEGListener(this); 191 194 data->AddATSCMainListener(this); 192 195 data->AddDVBMainListener(this); 196 data->AddDVBOtherListener(this); 193 197 } 194 198 } 195 199 … … 375 379 UpdateChannelInfo(true); 376 380 } 377 381 378 void ChannelScanSM::HandleSDT(uint , const ServiceDescriptionTable *sdt)382 void ChannelScanSM::HandleSDT(uint tsid, const ServiceDescriptionTable *sdt) 379 383 { 380 384 VERBOSE(VB_CHANSCAN, LOC + 381 385 QString("Got a Service Description Table for %1") 382 386 .arg((*current).FriendlyName) + "\n" + sdt->toString()); 383 387 388 // If this is Astra 28.2 add start listening for Freesat BAT and SDTo 389 if (!setOtherTables && (sdt->OriginalNetworkID() == 2 || sdt->OriginalNetworkID() == 59)) 390 { 391 GetDTVSignalMonitor()->GetScanStreamData()->SetFreesatAdditionalSI(true); 392 setOtherTables = true; 393 otherTableTimeout = 10000; // The whole BAT & SDTo group comes round in 10s 394 // Delay processing the SDT until we've seen BATs and SDTos 395 otherTableTime = timer.elapsed() + otherTableTimeout; 396 397 VERBOSE(VB_CHANSCAN, LOC + QString("SDT has OriginalNetworkID %1, look for " 398 "additional Freesat SI").arg(sdt->OriginalNetworkID())); 399 } 400 401 if (timer.elapsed() < otherTableTime) 402 { 403 // Set the version for the SDT so we see it again. 404 GetDTVSignalMonitor()->GetDVBStreamData()->SetVersionSDT(sdt->TSID(), -1, 0); 405 } 406 384 407 uint id = sdt->OriginalNetworkID() << 16 | sdt->TSID(); 385 408 ts_scanned.insert(id); 386 409 … … 404 427 UpdateChannelInfo(true); 405 428 } 406 429 430 void ChannelScanSM::HandleBAT(const BouquetAssociationTable *bat) 431 { 432 VERBOSE(VB_CHANSCAN, LOC + "Got a Bouquet Association Table\n" + 433 bat->toString()); 434 435 otherTableTime = timer.elapsed() + otherTableTimeout; 436 437 for (uint i = 0; i < bat->TransportStreamCount(); i++) 438 { 439 uint tsid = bat->TSID(i); 440 uint netid = bat->OriginalNetworkID(i); 441 desc_list_t parsed = 442 MPEGDescriptor::Parse(bat->TransportDescriptors(i), 443 bat->TransportDescriptorsLength(i)); 444 // Look for default authority 445 const unsigned char *def_auth = 446 MPEGDescriptor::Find(parsed, DescriptorID::default_authority); 447 const unsigned char *serv_list = 448 MPEGDescriptor::Find(parsed, DescriptorID::service_list); 449 450 if (def_auth && serv_list) 451 { 452 DefaultAuthorityDescriptor authority(def_auth); 453 ServiceListDescriptor services(serv_list); 454 455 for (uint j = 0; j < services.ServiceCount(); j++) 456 { 457 // If the default authority is given in the SDT this 458 // overrides any definition in the BAT (or in the NIT) 459 VERBOSE(VB_CHANSCAN, LOC + QString("found default authority(BAT) " 460 "for service %1 %2 %3") 461 .arg(netid).arg(tsid).arg(services.ServiceID(j))); 462 uint64_t index = 463 ((uint64_t)netid << 32) | (tsid << 16) | services.ServiceID(j); 464 if (! defAuthorities.contains(index)) 465 defAuthorities[index] = authority.DefaultAuthority(); 466 } 467 } 468 } 469 } 470 471 void ChannelScanSM::HandleSDTo(uint tsid, const ServiceDescriptionTable *sdt) 472 { 473 VERBOSE(VB_CHANSCAN, LOC + "Got a Service Description Table (other)\n" + 474 sdt->toString()); 475 476 otherTableTime = timer.elapsed() + otherTableTimeout; 477 478 uint netid = sdt->OriginalNetworkID(); 479 480 for (uint i = 0; i < sdt->ServiceCount(); i++) 481 { 482 uint serviceId = sdt->ServiceID(i); 483 desc_list_t parsed = 484 MPEGDescriptor::Parse(sdt->ServiceDescriptors(i), 485 sdt->ServiceDescriptorsLength(i)); 486 // Look for default authority 487 const unsigned char *def_auth = 488 MPEGDescriptor::Find(parsed, DescriptorID::default_authority); 489 if (def_auth) 490 { 491 DefaultAuthorityDescriptor authority(def_auth); 492 VERBOSE(VB_CHANSCAN, LOC + QString("found default authority(SDTo) " 493 "for service %1 %2 %3") 494 .arg(netid).arg(tsid).arg(serviceId)); 495 defAuthorities[((uint64_t)netid << 32) | (tsid << 16) | serviceId] = 496 authority.DefaultAuthority(); 497 } 498 } 499 } 500 407 501 void ChannelScanSM::HandleEncryptionStatus(uint pnum, bool encrypted) 408 502 { 409 503 currentEncryptionStatus[pnum] = encrypted ? kEncEncrypted : kEncDecrypted; … … 660 754 } 661 755 662 756 // DVB 663 if ((!wait_until_complete || sd->HasCachedAllNIT()) && currentInfo->nits.empty()) 757 if ((!wait_until_complete || sd->HasCachedAllNIT()) && (currentInfo->nits.empty() || 758 timer.elapsed() > (int)otherTableTime)) 759 { 664 760 currentInfo->nits = sd->GetCachedNIT(); 761 } 665 762 666 763 sdt_vec_t sdttmp = sd->GetCachedSDTs(); 667 764 tsid_checked.clear(); … … 823 920 currentEncryptionStatus.clear(); 824 921 currentEncryptionStatusChecked.clear(); 825 922 923 setOtherTables = false; 924 otherTableTime = 0; 925 826 926 if (scanning) 827 927 { 828 928 transportsScanned++; … … 886 986 } 887 987 888 988 static void update_info(ChannelInsertInfo &info, 889 const ServiceDescriptionTable *sdt, uint i) 989 const ServiceDescriptionTable *sdt, uint i, 990 const QMap<uint64_t, QString> &defAuthorities) 890 991 { 891 992 // HACK beg -- special exception for this network 892 993 // (dbver == "1067") … … 925 1026 (desc && !desc->IsDTV() && !desc->IsDigitalAudio()); 926 1027 info.is_audio_service = (desc && desc->IsDigitalAudio()); 927 1028 1029 info.service_id = sdt->ServiceID(i); 928 1030 info.sdt_tsid = sdt->TSID(); 929 1031 info.orig_netid = sdt->OriginalNetworkID(); 930 1032 info.in_sdt = true; … … 938 1040 if (def_auth) 939 1041 { 940 1042 DefaultAuthorityDescriptor authority(def_auth); 1043 VERBOSE(VB_CHANSCAN, QString("found default authority(SDT) " 1044 "for service %1 %2 %3") 1045 .arg(info.orig_netid).arg(info.sdt_tsid).arg(info.service_id)); 941 1046 info.default_authority = authority.DefaultAuthority(); 942 1047 } 1048 else 1049 { 1050 uint64_t index = (uint64_t)info.orig_netid << 32 | 1051 info.sdt_tsid << 16 | info.service_id; 1052 if (defAuthorities.contains(index)) 1053 info.default_authority = defAuthorities[index]; 1054 } 943 1055 } 944 1056 945 1057 uint ChannelScanSM::GetCurrentTransportInfo( … … 1090 1202 { 1091 1203 uint pnum = (*sdt_it)->ServiceID(i); 1092 1204 PCM_INFO_INIT("dvb"); 1093 update_info(info, *sdt_it, i );1205 update_info(info, *sdt_it, i, defAuthorities); 1094 1206 } 1095 1207 } 1096 1208 } -
mythtv/libs/libmythtv/channelscan/channelscan_sm.h
diff -aur a/mythtv/libs/libmythtv/channelscan/channelscan_sm.h b/mythtv/libs/libmythtv/channelscan/channelscan_sm.h
a b 83 83 84 84 class ChannelScanSM : public MPEGStreamListener, 85 85 public ATSCMainStreamListener, 86 public DVBMainStreamListener 86 public DVBMainStreamListener, 87 public DVBOtherStreamListener 87 88 { 88 89 friend class AnalogSignalHandler; 89 90 … … 146 147 void HandleSDT(uint tsid, const ServiceDescriptionTable*); 147 148 void HandleTDT(const TimeDateTable*) {} 148 149 150 // DVB Other 151 void HandleNITo(const NetworkInformationTable*) {} 152 void HandleSDTo(uint tsid, const ServiceDescriptionTable*); 153 void HandleBAT(const BouquetAssociationTable*); 154 149 155 private: 150 156 // some useful gets 151 157 DTVChannel *GetDTVChannel(void); … … 203 209 int sourceID; 204 210 uint signalTimeout; 205 211 uint channelTimeout; 212 uint otherTableTimeout; 213 uint otherTableTime; 214 bool setOtherTables; 206 215 QString inputname; 207 216 bool m_test_decryption; 208 217 bool extend_scan_list; … … 226 235 bool currentTestingDecryption; 227 236 QMap<uint, uint> currentEncryptionStatus; 228 237 QMap<uint, bool> currentEncryptionStatusChecked; 238 QMap<uint64_t, QString> defAuthorities; 229 239 230 240 /// Found Channel Info 231 241 ChannelList channelList;