Ticket #5562: defaultauthority-trunk-r23491.patch
File defaultauthority-trunk-r23491.patch, 11.9 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()->SetOtherTablePid(FREESAT_SI_PID); 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_IMPORTANT, 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_IMPORTANT, 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_IMPORTANT, 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 81 81 82 82 class ChannelScanSM : public MPEGStreamListener, 83 83 public ATSCMainStreamListener, 84 public DVBMainStreamListener 84 public DVBMainStreamListener, 85 public DVBOtherStreamListener 85 86 { 86 87 friend class AnalogSignalHandler; 87 88 … … 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); … … 201 207 int sourceID; 202 208 uint signalTimeout; 203 209 uint channelTimeout; 210 uint otherTableTimeout; 211 uint otherTableTime; 212 bool setOtherTables; 204 213 QString inputname; 205 214 bool m_test_decryption; 206 215 bool extend_scan_list; … … 224 233 bool currentTestingDecryption; 225 234 QMap<uint, uint> currentEncryptionStatus; 226 235 QMap<uint, bool> currentEncryptionStatusChecked; 236 QMap<uint64_t, QString> defAuthorities; 227 237 228 238 /// Found Channel Info 229 239 ChannelList channelList; -
mythtv/libs/libmythtv/mpeg/scanstreamdata.cpp
diff -aur a/mythtv/libs/libmythtv/mpeg/scanstreamdata.cpp b/mythtv/libs/libmythtv/mpeg/scanstreamdata.cpp
a b 8 8 : MPEGStreamData(-1, true), 9 9 ATSCStreamData(-1,-1, true), 10 10 DVBStreamData(0, 0, -1, true), 11 dvb_uk_freesat_si(false)11 otherTablepid(-1) 12 12 { 13 13 } 14 14 … … 19 19 */ 20 20 bool ScanStreamData::IsRedundant(uint pid, const PSIPTable &psip) const 21 21 { 22 // Treat BAT and SDTo as redundant unless they are on the FREESAT_SI_PID23 if (dvb_uk_freesat_si &&24 (psip.TableID() == TableID::BAT || psip.TableID() == TableID::SDTo))25 return pid != FREESAT_SI_PID;26 27 return (ATSCStreamData::IsRedundant(pid,psip) ||28 DVBStreamData::IsRedundant(pid,psip));22 if (ATSCStreamData::IsRedundant(pid,psip) || 23 DVBStreamData::IsRedundant(pid,psip)) 24 return true; 25 // Treat BAT and SDTo as redundant unless they are on the required PID. 26 if (psip.TableID() == TableID::BAT || psip.TableID() == TableID::SDTo) 27 return otherTablepid < 0 || pid != (uint)otherTablepid; 28 return false; 29 29 } 30 30 31 31 /** \fn ScanStreamData::HandleTables(uint, const PSIPTable&) … … 48 48 AddListeningPID(ATSC_PSIP_PID); 49 49 AddListeningPID(DVB_NIT_PID); 50 50 AddListeningPID(DVB_SDT_PID); 51 if ( dvb_uk_freesat_si)52 AddListeningPID( FREESAT_SI_PID);51 if (otherTablepid >= 0) 52 AddListeningPID((uint)otherTablepid); 53 53 } 54 54 55 55 QString ScanStreamData::GetSIStandard(QString guess) const … … 88 88 return "mpeg"; 89 89 } 90 90 91 /** \fn ScanStreamData::SetOtherTablePid(int pid) 92 * \brief Sets the PID to be used to receive BAT and SDTo tables 93 */ 94 void ScanStreamData::SetOtherTablePid(int pid) 95 { 96 if (pid >= 0) 97 AddListeningPID((uint)pid); 98 otherTablepid = pid; 99 } 91 100 92 101 bool ScanStreamData::DeleteCachedTable(PSIPTable *psip) const 93 102 { -
mythtv/libs/libmythtv/mpeg/scanstreamdata.h
diff -aur a/mythtv/libs/libmythtv/mpeg/scanstreamdata.h b/mythtv/libs/libmythtv/mpeg/scanstreamdata.h
a b 28 28 29 29 QString GetSIStandard(QString guess = "mpeg") const; 30 30 31 void Set FreesatAdditionalSI(bool freesat_si);31 void SetOtherTablePid(int pid); 32 32 33 33 private: 34 34 virtual bool DeleteCachedTable(PSIPTable *psip) const; 35 35 /// listen for addiotional Freesat service information 36 int dvb_uk_freesat_si;36 int otherTablepid;; 37 37 }; 38 38 39 inline void ScanStreamData::SetFreesatAdditionalSI(bool freesat_si) 40 { 41 QMutexLocker locker(&_listener_lock); 42 dvb_uk_freesat_si = freesat_si; 43 } 39 44 40 45 41 #endif // SCANSTREAMDATA_H_