Ticket #1155: dvb-multiple-eit2.diff
File dvb-multiple-eit2.diff, 6.6 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/dvbchannel.cpp
136 136 channelnames.clear(); 137 137 inputChannel.clear(); 138 138 inputTuneTo.clear(); 139 sourceid.clear(); 139 140 140 141 MSqlQuery query(MSqlQuery::InitCon()); 141 142 query.prepare( 142 143 "SELECT cardinputid, inputname, " 143 144 " if (tunechan='', 'Undefined', tunechan), " 144 " if (startchan, startchan, '') " 145 " if (startchan, startchan, ''), " 146 " sourceid " 145 147 "FROM cardinput " 146 148 "WHERE cardid = :CARDID"); 147 149 query.bindValue(":CARDID", GetCardID()); … … 166 168 channelnames[inputNum] = query.value(1).toString(); 167 169 inputTuneTo[inputNum] = query.value(2).toString(); 168 170 inputChannel[inputNum] = query.value(3).toString(); 171 sourceid[inputNum] = query.value(4).toString(); 169 172 } 170 173 171 174 // print em -
libs/libmythtv/eithelper.cpp
62 62 /** \fn EITHelper::ProcessEvents(int) 63 63 * \brief Inserts events in EIT list. 64 64 * 65 * NOTE: This currently takes a mplexid key for the dtv_multiplex table,66 * but it should just take a sourceid key for the channel table.67 *68 65 * \param mplexid multiplex we are inserting events for. 69 66 * \return Returns number of events inserted into DB. 70 67 */ 71 uint EITHelper::ProcessEvents(int mplexid)68 uint EITHelper::ProcessEvents(int srcid) 72 69 { 73 70 QMutexLocker locker(&eitList_lock); 74 71 … … 82 79 eitList.pop_front(); 83 80 84 81 eitList_lock.unlock(); 85 insertCount += UpdateEITList( mplexid, *events);82 insertCount += UpdateEITList(srcid, *events); 86 83 QList_Events::iterator it = events->begin(); 87 84 for (; it != events->end(); ++it) 88 85 delete *it; … … 100 97 events->erase(events->begin(), subset_end); 101 98 102 99 eitList_lock.unlock(); 103 insertCount += UpdateEITList( mplexid, subset);100 insertCount += UpdateEITList(srcid, subset); 104 101 QList_Events::iterator it = subset.begin(); 105 102 for (; it != subset.end(); ++it) 106 103 delete *it; … … 115 112 return insertCount; 116 113 } 117 114 118 int EITHelper::GetChanID(int mplexid, const Event &event) const115 int EITHelper::GetChanID(int srcid, const Event &event) const 119 116 { 120 117 unsigned long long srv = event.ServiceID; 121 srv |= ((unsigned long long) event.TransportID) << 32; 122 srv |= (event.ATSC) ? (mplexid << 16) : (event.NetworkID << 16); 118 srv |= ((unsigned long long) event.TransportID) << 48; 119 srv |= srcid << 32; 120 srv |= event.NetworkID << 16; 123 121 124 122 int chanid = srv_to_chanid[srv]; 125 123 if (chanid == 0) 126 srv_to_chanid[srv] = chanid = get_chan_id_from_db( mplexid, event);124 srv_to_chanid[srv] = chanid = get_chan_id_from_db(srcid, event); 127 125 return chanid; 128 126 } 129 127 130 uint EITHelper::UpdateEITList(int mplexid, const QList_Events &events)128 uint EITHelper::UpdateEITList(int srcid, const QList_Events &events) 131 129 { 132 130 MSqlQuery query1(MSqlQuery::InitCon()); 133 131 MSqlQuery query2(MSqlQuery::InitCon()); … … 137 135 138 136 QList_Events::const_iterator e = events.begin(); 139 137 for (; e != events.end(); ++e) 140 if ((chanid = GetChanID( mplexid, **e)) > 0)138 if ((chanid = GetChanID(srcid, **e)) > 0) 141 139 counter += update_eit_in_db(query1, query2, chanid, **e); 142 140 143 141 return counter; 144 142 } 145 143 146 static int get_chan_id_from_db(int mplexid, const Event &event)144 static int get_chan_id_from_db(int srcid, const Event &event) 147 145 { 148 146 MSqlQuery query(MSqlQuery::InitCon()); 149 147 // Now figure out the chanid for this … … 153 151 if (event.ATSC) 154 152 { 155 153 query.prepare(QString("SELECT chanid, useonairguide FROM channel " 156 "WHERE atscsrcid = %1 AND mplexid = %2")154 "WHERE atscsrcid = %1 AND sourceid = %2") 157 155 .arg(event.ServiceID) 158 .arg( mplexid));156 .arg(srcid)); 159 157 } 160 158 else 161 159 { … … 165 163 "WHERE serviceid = %1 AND " 166 164 " networkid = %2 AND " 167 165 " transportid = %3 AND " 166 " channel.sourceid = %4 AND " 168 167 " channel.mplexid = dtv_multiplex.mplexid") 169 168 .arg(event.ServiceID) 170 169 .arg(event.NetworkID) 171 .arg(event.TransportID)); 170 .arg(event.TransportID) 171 .arg(srcid)); 172 172 } 173 173 174 174 if (!query.exec() || !query.isActive()) … … 177 177 if (query.size() <= 0) 178 178 { 179 179 VERBOSE(VB_EIT, QString( 180 "EITHelper: chanid not found for atscsrcid =%1 "181 " and mplexid =%2, \n\t\t\tso event updates were skipped.")182 .arg(event.ServiceID).arg( mplexid));180 "EITHelper: chanid not found for service %1 " 181 "on source %2, \n\t\t\tso event updates were skipped.") 182 .arg(event.ServiceID).arg(srcid)); 183 183 return -1; 184 184 } 185 185 -
libs/libmythtv/eitscanner.cpp
91 91 { 92 92 if (channel) 93 93 { 94 int mplex = channel->GetMultiplexID();95 if (( mplex> 0) && parser && eitHelper->GetListSize())94 int srcid = channel->GetCurrentSourceID(); 95 if ((srcid > 0) && parser && eitHelper->GetListSize()) 96 96 { 97 eitCount += eitHelper->ProcessEvents( mplex);97 eitCount += eitHelper->ProcessEvents(srcid); 98 98 t.start(); 99 99 } 100 100 } -
libs/libmythtv/channelbase.h
60 60 { return currentcapchannel; } 61 61 virtual QString GetCurrentInput(void) const 62 62 { return channelnames[GetCurrentInputNum()]; } 63 virtual int GetCurrentSourceID(void) const 64 { return sourceid[GetCurrentInputNum()].toInt(); } 63 65 virtual QString GetOrdering(void) const 64 66 { return channelorder; } 65 67 /// \brief Returns true iff commercial detection is not required