Ticket #1512: eit_sourceid2.patch
File eit_sourceid2.patch, 12.3 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/eithelper.cpp
6 6 7 7 const uint EITHelper::kChunkSize = 20; 8 8 9 static int get_chan_id_from_db(int tid_db, const Event& );9 static int get_chan_id_from_db(int tid_db, const Event&, bool ignore_source); 10 10 static uint update_eit_in_db(MSqlQuery&, MSqlQuery&, int, const Event&); 11 11 static uint delete_overlapping_in_db(MSqlQuery&, MSqlQuery&, 12 12 int, const Event&); … … 65 65 * \param mplexid multiplex we are inserting events for. 66 66 * \return Returns number of events inserted into DB. 67 67 */ 68 uint EITHelper::ProcessEvents(uint sourceid )68 uint EITHelper::ProcessEvents(uint sourceid, bool ignore_source) 69 69 { 70 70 QMutexLocker locker(&eitList_lock); 71 71 … … 79 79 eitList.pop_front(); 80 80 81 81 eitList_lock.unlock(); 82 insertCount += UpdateEITList(sourceid, *events );82 insertCount += UpdateEITList(sourceid, *events, ignore_source); 83 83 QList_Events::iterator it = events->begin(); 84 84 for (; it != events->end(); ++it) 85 85 delete *it; … … 97 97 events->erase(events->begin(), subset_end); 98 98 99 99 eitList_lock.unlock(); 100 insertCount += UpdateEITList(sourceid, subset );100 insertCount += UpdateEITList(sourceid, subset, ignore_source); 101 101 QList_Events::iterator it = subset.begin(); 102 102 for (; it != subset.end(); ++it) 103 103 delete *it; … … 112 112 return insertCount; 113 113 } 114 114 115 int EITHelper::GetChanID(uint sourceid, const Event &event ) const115 int EITHelper::GetChanID(uint sourceid, const Event &event, bool ignore_source) const 116 116 { 117 117 unsigned long long srv; 118 118 srv = ((unsigned long long) sourceid); … … 122 122 123 123 int chanid = srv_to_chanid[srv]; 124 124 if (chanid == 0) 125 srv_to_chanid[srv] = chanid = get_chan_id_from_db(sourceid, event );125 srv_to_chanid[srv] = chanid = get_chan_id_from_db(sourceid, event, ignore_source); 126 126 return chanid; 127 127 } 128 128 129 uint EITHelper::UpdateEITList(uint sourceid, const QList_Events &events) const 129 uint EITHelper::UpdateEITList(uint sourceid, const QList_Events &events, 130 bool ignore_source) const 130 131 { 131 132 MSqlQuery query1(MSqlQuery::InitCon()); 132 133 MSqlQuery query2(MSqlQuery::InitCon()); … … 136 137 137 138 QList_Events::const_iterator e = events.begin(); 138 139 for (; e != events.end(); ++e) 139 if ((chanid = GetChanID(sourceid, **e )) > 0)140 if ((chanid = GetChanID(sourceid, **e, ignore_source)) > 0) 140 141 counter += update_eit_in_db(query1, query2, chanid, **e); 141 142 142 143 return counter; 143 144 } 144 145 145 146 // Figure out the chanid for this channel 146 static int get_chan_id_from_db(int sourceid, const Event &event )147 static int get_chan_id_from_db(int sourceid, const Event &event, bool ignore_source) 147 148 { 148 149 MSqlQuery query(MSqlQuery::InitCon()); 149 150 … … 156 157 "WHERE atscsrcid = :ATSCSRCID AND " 157 158 " sourceid = :SOURCEID"); 158 159 query.bindValue(":ATSCSRCID", event.ServiceID); 160 query.bindValue(":SOURCEID", sourceid); 159 161 } 160 162 else 161 163 { 162 164 // DVB Link to chanid 163 query.prepare( 164 "SELECT chanid, useonairguide " 165 "FROM channel, dtv_multiplex " 166 "WHERE serviceid = :SERVICEID AND " 167 " networkid = :NETWORKID AND " 168 " transportid = :TRANSPORTID AND " 169 " channel.sourceid = :SOURCEID AND " 170 " channel.mplexid = dtv_multiplex.mplexid"); 165 if (!ignore_source) 166 { 167 query.prepare( 168 "SELECT chanid, useonairguide " 169 "FROM channel, dtv_multiplex " 170 "WHERE serviceid = :SERVICEID AND " 171 " networkid = :NETWORKID AND " 172 " transportid = :TRANSPORTID AND " 173 " channel.sourceid = :SOURCEID AND " 174 " channel.mplexid = dtv_multiplex.mplexid"); 175 query.bindValue(":SOURCEID", sourceid); 176 } 177 else 178 { 179 query.prepare( 180 "SELECT chanid, useonairguide " 181 "FROM channel, dtv_multiplex " 182 "WHERE serviceid = :SERVICEID AND " 183 " networkid = :NETWORKID AND " 184 " transportid = :TRANSPORTID AND " 185 " channel.mplexid = dtv_multiplex.mplexid"); 186 } 187 171 188 query.bindValue(":SERVICEID", event.ServiceID); 172 189 query.bindValue(":NETWORKID", event.NetworkID); 173 190 query.bindValue(":TRANSPORTID", event.TransportID); 174 191 } 175 query.bindValue(":SOURCEID", sourceid);176 192 177 193 if (!query.exec() || !query.isActive()) 178 194 MythContext::DBError("Looking up chanID", query); … … 183 199 return (useOnAirGuide) ? query.value(0).toInt() : -1; 184 200 } 185 201 186 VERBOSE(VB_EIT, "EITHelper: " + 187 QString("chanid not found for service %1 on source %2,") 188 .arg(event.ServiceID).arg(sourceid) + 189 "\n\t\t\tso event updates were skipped."); 202 if (event.ATSC || !ignore_source) 203 VERBOSE(VB_EIT, "EITHelper: " + 204 QString("chanid not found for service %1 on source %2,") 205 .arg(event.ServiceID).arg(sourceid) + 206 "\n\t\t\tso event updates were skipped."); 207 else 208 VERBOSE(VB_EIT, "EITHelper: " + 209 QString("chanid not found for service %1 on network %2,") 210 .arg(event.ServiceID).arg(event.NetworkID) + 211 "\n\t\t\tso event updates were skipped."); 190 212 191 213 return -1; 192 214 } -
libs/libmythtv/eithelper.h
25 25 26 26 void ClearList(void); 27 27 uint GetListSize(void) const; 28 uint ProcessEvents(uint sourceid );28 uint ProcessEvents(uint sourceid, bool ignore_source=false); 29 29 30 30 public slots: 31 31 void HandleEITs(QMap_Events* events); 32 32 33 33 private: 34 int GetChanID(uint sourceid, const Event &event) const; 35 uint UpdateEITList(uint sourceid, const QList_Events &events) const; 34 int GetChanID(uint sourceid, const Event &event, bool ignore_source) const; 35 uint UpdateEITList(uint sourceid, const QList_Events &events, 36 bool ignore_source) const; 36 37 37 38 QListList_Events eitList; ///< Event Information Tables List 38 39 mutable QMutex eitList_lock; ///< EIT List lock -
libs/libmythtv/eitscanner.h
24 24 EITScanner(); 25 25 ~EITScanner() { TeardownAll(); } 26 26 27 void StartPassiveScan(DVBChannel*, DVBSIParser*); 27 void StartPassiveScan(DVBChannel*, DVBSIParser*, 28 bool ignore_source=false); 28 29 void StopPassiveScan(void); 29 30 30 void StartActiveScan(TVRec*, uint max_seconds_per_source); 31 void StartActiveScan(TVRec*, uint max_seconds_per_source, 32 bool ignore_source=false); 31 33 void StopActiveScan(void); 32 34 33 35 private: … … 50 52 QStringList activeScanChannels; 51 53 QStringList::iterator activeScanNextChan; 52 54 55 bool ignore_source; 56 53 57 static QMutex resched_lock; 54 58 static QDateTime resched_next_time; 55 59 -
libs/libmythtv/tv_rec.cpp
1098 1098 } 1099 1099 1100 1100 if (scanner) 1101 scanner->StartPassiveScan(dvbc, dvbsiparser); 1101 { 1102 uint ignore = gContext->GetNumSetting("EITIgnoresSource", 0); 1103 scanner->StartPassiveScan(dvbc, dvbsiparser, (ignore ? true : false)); 1104 } 1102 1105 #endif // USING_DVB_EIT 1103 1106 1104 1107 #endif // USING_DVB … … 1326 1329 else 1327 1330 { 1328 1331 uint ttMin = gContext->GetNumSetting("EITTransportTimeout", 5); 1329 scanner->StartActiveScan(this, ttMin * 60); 1332 uint ignore = gContext->GetNumSetting("EITIgnoresSource", 0); 1333 scanner->StartActiveScan(this, ttMin * 60, (ignore ? true : false)); 1330 1334 SetFlags(kFlagEITScannerRunning); 1331 1335 eitScanStartTime = QDateTime::currentDateTime().addYears(1); 1332 1336 } -
libs/libmythtv/eitscanner.cpp
82 82 uint sourceid = channel->GetCurrentSourceID(); 83 83 if (sourceid && parser && eitHelper->GetListSize()) 84 84 { 85 eitCount += eitHelper->ProcessEvents(sourceid );85 eitCount += eitHelper->ProcessEvents(sourceid, ignore_source); 86 86 t.start(); 87 87 } 88 88 } … … 155 155 * \brief Start inserting Event Information Tables from the multiplex 156 156 * we happen to be tuned to into the database. 157 157 */ 158 void EITScanner::StartPassiveScan(DVBChannel *_channel, DVBSIParser *_parser) 158 void EITScanner::StartPassiveScan(DVBChannel *_channel, DVBSIParser *_parser, 159 bool _ignore_source) 159 160 { 160 161 eitHelper->ClearList(); 161 parser = _parser; 162 channel = _channel; 162 parser = _parser; 163 channel = _channel; 164 ignore_source = _ignore_source; 165 166 if (ignore_source) 167 VERBOSE(VB_EIT, LOC + "EIT scan ignoring sourceid.."); 168 163 169 QObject::connect(parser, SIGNAL(EventsReady(QMap_Events*)), 164 170 eitHelper, SLOT(HandleEITs(QMap_Events*))); 165 171 } … … 176 182 parser = NULL; 177 183 } 178 184 179 void EITScanner::StartActiveScan(TVRec *_rec, uint max_seconds_per_source) 185 void EITScanner::StartActiveScan(TVRec *_rec, uint max_seconds_per_source, 186 bool _ignore_source) 180 187 { 181 rec = _rec; 188 rec = _rec; 189 ignore_source = _ignore_source; 182 190 183 191 if (!activeScanChannels.size()) 184 192 { -
setup/backendsettings.cpp
238 238 return gc; 239 239 }; 240 240 241 static GlobalCheckBox *EITIgnoresSource() 242 { 243 GlobalCheckBox *gc = new GlobalCheckBox("EITIgnoresSource"); 244 gc->setLabel(QObject::tr("DVB EIT Scan not Limited to Source Input")); 245 gc->setValue(false); 246 gc->setHelpText(QObject::tr("If set, DVB EIT scan will not be limited to " 247 "channels which are on the same input " 248 "source as the channel being viewed. " 249 "If your provider delivers EIT for " 250 "multiple orbital locations on a single " 251 "transport, enable this.")); 252 return gc; 253 }; 254 255 241 256 static GlobalSpinBox *WOLbackendReconnectWaitTime() 242 257 { 243 258 GlobalSpinBox *gc = new GlobalSpinBox("WOLbackendReconnectWaitTime", 0, 1200, 5); … … 647 662 group2->addChild(VbiFormat()); 648 663 group2->addChild(FreqTable()); 649 664 group2->addChild(TimeOffset()); 650 group2->addChild(EITTransportTimeout());651 665 group2->addChild(MasterBackendOverride()); 652 666 group2->addChild(DeletesFollowLinks()); 653 667 addChild(group2); 654 668 669 VerticalConfigurationGroup* group2a1 = new VerticalConfigurationGroup(false); 670 group2a1->setLabel(QObject::tr("EIT Scanner Options")); 671 group2a1->addChild(EITTransportTimeout()); 672 group2a1->addChild(EITIgnoresSource()); 673 addChild(group2a1); 674 655 675 VerticalConfigurationGroup* group3 = new VerticalConfigurationGroup(false); 656 676 group3->setLabel(QObject::tr("Shutdown/Wakeup Options")); 657 677 group3->addChild(startupCommand());