Ticket #2416: eitmapping_21_fixes.diff
File eitmapping_21_fixes.diff, 3.9 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/eithelper.cpp
31 31 uint atscmajor, uint atscminor); 32 32 static uint get_chan_id_from_db(uint sourceid, uint serviceid, 33 33 uint networkid, uint transportid); 34 static uint get_mapped_chan_id_from_db(uint serviceid); 34 35 static void init_fixup(QMap<uint64_t,uint> &fix); 35 36 static int calc_eit_utc_offset(void); 36 37 … … 405 406 video_props, 406 407 seriesId, programId); 407 408 db_events.enqueue(event); 409 410 uint mapped_chanid = GetMappedChanID(eit->ServiceID()); 411 412 if (mapped_chanid > 0) 413 { 414 DBEvent *event = new DBEvent(mapped_chanid, 415 title, subtitle, description, 416 category, category_type, 417 starttime, endtime, fix, 418 subtitle_type, 419 audio_props, 420 video_props, 421 seriesId, programId); 422 db_events.enqueue(event); 423 } 408 424 } 409 425 } 410 426 … … 603 619 604 620 uint chanid = get_chan_id_from_db(sourceid, serviceid, networkid, tsid); 605 621 if (chanid) 622 { 606 623 srv_to_chanid[key] = chanid; 624 625 uint mapped_chanid = get_mapped_chan_id_from_db(serviceid); 626 if(mapped_chanid) 627 serviceid_to_mapped_chanid[serviceid] = mapped_chanid; 628 } 607 629 608 630 return chanid; 609 631 } 610 632 633 uint EITHelper::GetMappedChanID(uint serviceid) 634 { 635 ServiceIDToMappedChanID::const_iterator it = serviceid_to_mapped_chanid.find(serviceid); 636 if (it != serviceid_to_mapped_chanid.end()) 637 return max(*it, 0); 638 return 0; 639 } 640 611 641 static uint get_chan_id_from_db(uint sourceid, 612 642 uint atsc_major, uint atsc_minor) 613 643 { … … 671 701 return 0; 672 702 } 673 703 704 static uint get_mapped_chan_id_from_db(uint serviceid) 705 { 706 MSqlQuery query(MSqlQuery::InitCon()); 707 708 QString qstr = 709 "SELECT mapped_chanid " 710 "FROM eit_mapping " 711 "WHERE serviceid = :SERVICEID"; 712 713 query.prepare(qstr); 714 query.bindValue(":SERVICEID", serviceid); 715 if (!query.exec() || !query.isActive()) 716 MythContext::DBError("Looking up mapped chanID", query); 717 718 if (query.next()) 719 { 720 return query.value(0).toUInt(); 721 } 722 723 return 0; 724 } 725 674 726 static void init_fixup(QMap<uint64_t,uint> &fix) 675 727 { 676 728 /////////////////////////////////////////////////////////////////////////// -
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; … … 86 87 private: 87 88 uint GetChanID(uint atsc_major, uint atsc_minor); 88 89 uint GetChanID(uint serviceid, uint networkid, uint transportid); 90 uint GetMappedChanID(uint serviceid); 89 91 90 92 void CompleteEvent(uint atsc_major, uint atsc_minor, 91 93 const ATSCEvent &event, … … 94 96 //QListList_Events eitList; ///< Event Information Tables List 95 97 mutable QMutex eitList_lock; ///< EIT List lock 96 98 mutable ServiceToChanID srv_to_chanid; 99 mutable ServiceIDToMappedChanID serviceid_to_mapped_chanid; 97 100 98 101 EITFixUp *eitfixup; 99 102 static EITCache *eitcache;