Ticket #2416: eitmapping.diff
| File eitmapping.diff, 3.8 KB (added by , 19 years ago) |
|---|
-
libs/libmythtv/eithelper.cpp
21 21 uint atscmajor, uint atscminor); 22 22 static uint get_chan_id_from_db(uint sourceid, uint serviceid, 23 23 uint networkid, uint transportid); 24 static uint get_mapped_chan_id_from_db(uint serviceid); 24 25 static void init_fixup(QMap<uint64_t,uint> &fix); 25 26 static int calc_eit_utc_offset(void); 26 27 … … 343 344 false, subtitled, 344 345 stereo, hdtv); 345 346 db_events.enqueue(event); 347 348 uint mapped_chanid = GetMappedChanID(serviceid); 349 350 if (mapped_chanid > 0) 351 { 352 DBEvent *event = new DBEvent(mapped_chanid, 353 title, subtitle, description, 354 category, category_type, 355 starttime, endtime, fix, 356 false, subtitled, 357 stereo, hdtv); 358 db_events.enqueue(event); 359 } 346 360 } 347 361 } 348 362 … … 414 428 415 429 uint chanid = get_chan_id_from_db(sourceid, serviceid, networkid, tsid); 416 430 if (chanid) 431 { 417 432 srv_to_chanid[key] = chanid; 433 434 uint mapped_chanid = get_mapped_chan_id_from_db(serviceid); 435 if(mapped_chanid) 436 serviceid_to_mapped_chanid[serviceid] = mapped_chanid; 437 } 418 438 419 439 return chanid; 420 440 } 421 441 442 uint EITHelper::GetMappedChanID(uint serviceid) 443 { 444 ServiceIDToMappedChanID::const_iterator it = serviceid_to_mapped_chanid.find(serviceid); 445 if (it != serviceid_to_mapped_chanid.end()) 446 return max(*it, 0); 447 return 0; 448 } 449 422 450 static uint get_chan_id_from_db(uint sourceid, 423 451 uint atsc_major, uint atsc_minor) 424 452 { … … 482 510 return 0; 483 511 } 484 512 513 static uint get_mapped_chan_id_from_db(uint serviceid) 514 { 515 MSqlQuery query(MSqlQuery::InitCon()); 516 517 QString qstr = 518 "SELECT mapped_chanid " 519 "FROM eit_mapping " 520 "WHERE serviceid = :SERVICEID"; 521 522 query.prepare(qstr); 523 query.bindValue(":SERVICEID", serviceid); 524 if (!query.exec() || !query.isActive()) 525 MythContext::DBError("Looking up mapped chanID", query); 526 527 if (query.next()) 528 { 529 return query.value(0).toUInt(); 530 } 531 532 return 0; 533 } 534 485 535 static void init_fixup(QMap<uint64_t,uint> &fix) 486 536 { 487 537 // transport_id<<32 | netword_id<<16 | service_id -
libs/libmythtv/eithelper.h
39 39 typedef QMap<uint,EventIDToATSCEvent> ATSCSRCToEvents; 40 40 typedef QMap<uint,EventIDToETT> ATSCSRCToETTs; 41 41 typedef QMap<unsigned long long,int> ServiceToChanID; 42 typedef QMap<int,int> ServiceIDToMappedChanID; 42 43 43 44 class DBEvent; 44 45 class EITFixUp; … … 81 82 private: 82 83 uint GetChanID(uint atsc_major, uint atsc_minor); 83 84 uint GetChanID(uint serviceid, uint networkid, uint transportid); 85 uint GetMappedChanID(uint serviceid); 84 86 85 87 void CompleteEvent(uint atsc_major, uint atsc_minor, 86 88 const ATSCEvent &event, … … 89 91 //QListList_Events eitList; ///< Event Information Tables List 90 92 mutable QMutex eitList_lock; ///< EIT List lock 91 93 mutable ServiceToChanID srv_to_chanid; 94 mutable ServiceIDToMappedChanID serviceid_to_mapped_chanid; 92 95 93 96 EITFixUp *eitfixup; 94 97 EITCache *eitcache;
