Ticket #7486: mythtv_fix_broken_providers_with_gui.diff
File mythtv_fix_broken_providers_with_gui.diff, 7.9 KB (added by , 14 years ago) |
---|
-
libs/libmythtv/channelscan/channelscan_sm.cpp
174 174 { 175 175 VERBOSE(VB_CHANSCAN, LOC + "Connecting up DTVSignalMonitor"); 176 176 ScanStreamData *data = new ScanStreamData(); 177 178 MSqlQuery query(MSqlQuery::InitCon()); 179 query.prepare( 180 "SELECT dvb_nit_id " 181 "FROM videosource " 182 "WHERE videosource.sourceid = :SOURCEID"); 183 query.bindValue(":SOURCEID", _sourceID); 184 if (!query.exec() || !query.isActive()) 185 { 186 MythDB::DBError("ChannelScanSM", query); 187 } 188 else if (query.next()) 189 { 190 uint nitid = query.value(0).toInt(); 191 data->SetRealNetworkID(nitid); 192 VERBOSE(VB_CHANSCAN, LOC + QString("Setting NIT-ID to %1").arg(nitid)); 193 } 177 194 178 195 dtvSigMon->SetStreamData(data); 179 196 dtvSigMon->AddFlags(SignalMonitor::kDTVSigMon_WaitForMGT | -
libs/libmythtv/dbcheck.cpp
20 20 /// This is the DB schema version expected by the running MythTV instance. 21 21 const QString currentDatabaseVersion = "1244"; 22 22 23 static bool UpgradeDBSchemaInFixes(void); 23 24 static bool UpdateDBVersionNumber(const QString &newnumber); 24 25 static bool performActualUpdate( 25 26 const char **updates, const char *version, QString &dbver); … … 469 470 // There may be a race condition where another program (e.g. mythbackend) 470 471 // is upgrading, so wait up to 5 seconds for a more accurate version: 471 472 DBup->CompareAndWait(5); 473 474 if (!gContext->GetNumSetting("have-nit-fix", 0)) 475 { 476 UpgradeDBSchemaInFixes(); 477 } 472 478 473 if (DBup->versionsBehind == 0) // same schema 479 if (DBup->versionsBehind == 0 && 480 gContext->GetNumSetting("have-nit-fix", 0)) // same schema 474 481 { 475 482 gContext->ActivateSettingsCache(true); 476 483 GetMythDB()->SetSuppressDBMessages(false); … … 4922 4929 return true; 4923 4930 } 4924 4931 4932 static bool UpgradeDBSchemaInFixes() 4933 { 4934 QString dbver = gContext->GetSetting("DBSchemaVer"); 4935 4936 if (!gContext->GetNumSetting("have-nit-fix", 0)) 4937 { 4938 const char *updates[] = { 4939 "ALTER TABLE videosource ADD dvb_nit_id INT(6) DEFAULT -1;", 4940 NULL 4941 }; 4942 4943 if (!performActualUpdate(updates, "1244", dbver)) 4944 return false; 4945 4946 gContext->SaveSetting("have-nit-fix", 1); 4947 } 4948 4949 return true; 4950 } 4951 4925 4952 /** 4926 4953 * command to get the the initial database layout from an empty database: 4927 4954 * -
libs/libmythtv/mpeg/dvbtables.cpp
79 79 return _cached_network_name; 80 80 } 81 81 82 bool NetworkInformationTable::Mutate(void) 83 { 84 if (VerifyCRC()) 85 { 86 SetTableID((TableID() == TableID::NITo) ? TableID::NIT : TableID::NITo); 87 SetCRC(CalcCRC()); 88 return true; 89 } 90 else 91 return false; 92 } 82 93 83 94 void ServiceDescriptionTable::Parse(void) const 84 95 { -
libs/libmythtv/mpeg/dvbstreamdata.cpp
234 234 { 235 235 case TableID::NIT: 236 236 { 237 if (_dvb_real_network_id >= 0 && psip.TableIDExtension() != (uint)_dvb_real_network_id) 238 { 239 NetworkInformationTable *nit = new NetworkInformationTable(psip); 240 if (!nit->Mutate()) 241 { 242 delete nit; 243 return true; 244 } 245 bool retval = HandleTables(pid, *nit); 246 delete nit; 247 return retval; 248 } 249 237 250 SetVersionNIT(psip.Version(), psip.LastSection()); 238 251 SetNITSectionSeen(psip.Section()); 239 252 … … 291 304 } 292 305 case TableID::NITo: 293 306 { 307 if (_dvb_real_network_id >= 0 && psip.TableIDExtension() == (uint)_dvb_real_network_id) 308 { 309 NetworkInformationTable *nit = new NetworkInformationTable(psip); 310 if (!nit->Mutate()) 311 { 312 delete nit; 313 return true; 314 } 315 bool retval = HandleTables(pid, *nit); 316 delete nit; 317 return retval; 318 } 319 294 320 SetVersionNITo(psip.Version(), psip.LastSection()); 295 321 SetNIToSectionSeen(psip.Section()); 296 322 NetworkInformationTable nit(psip); -
libs/libmythtv/mpeg/dvbtables.h
79 79 { return _ptrs[i]+6; } 80 80 // } 81 81 82 /// mutates a NITo into a NITa (vice versa) and recalculates the CRC 83 bool Mutate(void); 84 82 85 void Parse(void) const; 83 86 QString toString(void) const; 84 87 QString NetworkName(void) const; … … 154 157 // } 155 158 ServiceDescriptor *GetServiceDescriptor(uint i) const; 156 159 157 /// mutates a SDTo into a SDTa and recalculates the CRC160 /// mutates a SDTo into a SDTa (vice versa) and recalculates the CRC 158 161 bool Mutate(void); 159 162 160 163 void Parse(void) const; -
libs/libmythtv/mpeg/dvbstreamdata.h
40 40 bool IsRedundant(uint pid, const PSIPTable&) const; 41 41 void ProcessSDT(uint tsid, const ServiceDescriptionTable*); 42 42 43 // NIT for broken providers 44 inline void SetRealNetworkID(int); 45 43 46 // EIT info/processing 44 47 inline void SetDishNetEIT(bool); 45 48 inline bool HasAnyEIT(void) const; … … 212 215 uint _desired_netid; 213 216 uint _desired_tsid; 214 217 218 // Real network ID for broken providers 219 int _dvb_real_network_id; 220 215 221 /// Decode DishNet's long-term DVB EIT 216 222 bool _dvb_eit_dishnet_long; 217 223 /// Tell us if the DVB service has EIT … … 251 257 _dvb_eit_dishnet_long = use_dishnet_eit; 252 258 } 253 259 260 inline void DVBStreamData::SetRealNetworkID(int real_network_id) 261 { 262 QMutexLocker locker(&_listener_lock); 263 _dvb_real_network_id = real_network_id; 264 } 265 254 266 inline bool DVBStreamData::HasAnyEIT(void) const 255 267 { 256 268 QMutexLocker locker(&_listener_lock); -
libs/libmythtv/videosource.cpp
197 197 }; 198 198 }; 199 199 200 class DVBNetID : public SpinBoxSetting, public VideoSourceDBStorage 201 { 202 public: 203 DVBNetID(const VideoSource &parent, uint value, signed int min_val) : 204 SpinBoxSetting(this, min_val, 100000, 1), 205 VideoSourceDBStorage(this, parent, "dvb_nit_id") 206 { 207 setLabel(QObject::tr("Network ID")); 208 setHelpText(QObject::tr("Set this to the actual network ID at your " 209 "location, if you have a provider that broadcasts a broken " 210 "NIT. Leave at -1 if everything works out of the box.")); 211 }; 212 }; 213 200 214 FreqTableSelector::FreqTableSelector(const VideoSource &parent) : 201 215 ComboBoxSetting(this), VideoSourceDBStorage(this, parent, "freqtable") 202 216 { … … 749 763 group->addChild(name = new Name(*this)); 750 764 group->addChild(xmltv = new XMLTVConfig(*this)); 751 765 group->addChild(new FreqTableSelector(*this)); 766 group->addChild(new DVBNetID(*this, -1, -1)); 752 767 addChild(group); 753 768 } 754 769