diff -Naur mythtv-0.24-20110321-old/mythtv/libs/libmythtv/eithelper.cpp mythtv-0.24-20110321-new/mythtv/libs/libmythtv/eithelper.cpp
|
old
|
new
|
|
| 34 | 34 | uint atscmajor, uint atscminor); |
| 35 | 35 | static uint get_chan_id_from_db(uint sourceid, uint serviceid, |
| 36 | 36 | uint networkid, uint transportid); |
| | 37 | static uint get_mapped_chan_id_from_db(uint serviceid); |
| 37 | 38 | static void init_fixup(QMap<uint64_t,uint> &fix); |
| 38 | 39 | static int calc_eit_utc_offset(void); |
| 39 | 40 | |
| … |
… |
|
| 485 | 486 | seriesId, programId); |
| 486 | 487 | |
| 487 | 488 | db_events.enqueue(event); |
| | 489 | |
| | 490 | uint mapped_chanid = GetMappedChanID(eit->ServiceID()); |
| | 491 | |
| | 492 | if (mapped_chanid > 0) |
| | 493 | { |
| | 494 | DBEventEIT *event = new DBEventEIT(mapped_chanid, |
| | 495 | title, subtitle, description, |
| | 496 | category, category_type, |
| | 497 | starttime, endtime, fix, |
| | 498 | subtitle_type, |
| | 499 | audio_props, |
| | 500 | video_props, stars, |
| | 501 | seriesId, programId); |
| | 502 | db_events.enqueue(event); |
| | 503 | } |
| 488 | 504 | } |
| 489 | 505 | } |
| 490 | 506 | |
| … |
… |
|
| 692 | 708 | |
| 693 | 709 | uint chanid = get_chan_id_from_db(sourceid, serviceid, networkid, tsid); |
| 694 | 710 | if (chanid) |
| | 711 | { |
| 695 | 712 | srv_to_chanid[key] = chanid; |
| 696 | 713 | |
| | 714 | uint mapped_chanid = get_mapped_chan_id_from_db(serviceid); |
| | 715 | if(mapped_chanid) |
| | 716 | serviceid_to_mapped_chanid[serviceid] = mapped_chanid; |
| | 717 | } |
| | 718 | |
| 697 | 719 | return chanid; |
| 698 | 720 | } |
| 699 | 721 | |
| | 722 | uint EITHelper::GetMappedChanID(uint serviceid) |
| | 723 | { |
| | 724 | ServiceIDToMappedChanID::const_iterator it = serviceid_to_mapped_chanid.find(serviceid); |
| | 725 | if (it != serviceid_to_mapped_chanid.end()) |
| | 726 | return max(*it, 0); |
| | 727 | return 0; |
| | 728 | } |
| | 729 | |
| 700 | 730 | static uint get_chan_id_from_db(uint sourceid, |
| 701 | 731 | uint atsc_major, uint atsc_minor) |
| 702 | 732 | { |
| … |
… |
|
| 767 | 797 | return useOnAirGuide ? chanid : 0; |
| 768 | 798 | } |
| 769 | 799 | |
| | 800 | static uint get_mapped_chan_id_from_db(uint serviceid) |
| | 801 | { |
| | 802 | MSqlQuery query(MSqlQuery::InitCon()); |
| | 803 | |
| | 804 | QString qstr = |
| | 805 | "SELECT mapped_chanid " |
| | 806 | "FROM eit_mapping " |
| | 807 | "WHERE serviceid = :SERVICEID"; |
| | 808 | |
| | 809 | query.prepare(qstr); |
| | 810 | query.bindValue(":SERVICEID", serviceid); |
| | 811 | if (!query.exec() || !query.isActive()) |
| | 812 | MythDB::DBError("Looking up mapped chanID", query); |
| | 813 | |
| | 814 | if (query.next()) |
| | 815 | { |
| | 816 | return query.value(0).toUInt(); |
| | 817 | } |
| | 818 | |
| | 819 | return 0; |
| | 820 | } |
| | 821 | |
| 770 | 822 | static void init_fixup(QMap<uint64_t,uint> &fix) |
| 771 | 823 | { |
| 772 | 824 | /////////////////////////////////////////////////////////////////////////// |
diff -Naur mythtv-0.24-20110321-old/mythtv/libs/libmythtv/eithelper.h mythtv-0.24-20110321-new/mythtv/libs/libmythtv/eithelper.h
|
old
|
new
|
|
| 45 | 45 | typedef QMap<uint,EventIDToATSCEvent> ATSCSRCToEvents; |
| 46 | 46 | typedef QMap<uint,EventIDToETT> ATSCSRCToETTs; |
| 47 | 47 | typedef QMap<unsigned long long,int> ServiceToChanID; |
| | 48 | typedef QMap<int,int> ServiceIDToMappedChanID; |
| 48 | 49 | |
| 49 | 50 | class DBEventEIT; |
| 50 | 51 | class EITFixUp; |
| … |
… |
|
| 92 | 93 | private: |
| 93 | 94 | uint GetChanID(uint atsc_major, uint atsc_minor); |
| 94 | 95 | uint GetChanID(uint serviceid, uint networkid, uint transportid); |
| | 96 | uint GetMappedChanID(uint serviceid); |
| 95 | 97 | |
| 96 | 98 | void CompleteEvent(uint atsc_major, uint atsc_minor, |
| 97 | 99 | const ATSCEvent &event, |
| … |
… |
|
| 100 | 102 | //QListList_Events eitList; ///< Event Information Tables List |
| 101 | 103 | mutable QMutex eitList_lock; ///< EIT List lock |
| 102 | 104 | mutable ServiceToChanID srv_to_chanid; |
| | 105 | mutable ServiceIDToMappedChanID serviceid_to_mapped_chanid; |
| 103 | 106 | |
| 104 | 107 | EITFixUp *eitfixup; |
| 105 | 108 | static EITCache *eitcache; |