Ticket #7486: mythtv_fix_broken_providers_with_gui.2.diff

File mythtv_fix_broken_providers_with_gui.2.diff, 6.9 KB (added by cg@…, 13 years ago)

Updated patch for current fixes/0.24

  • mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp

    diff --git a/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp b/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp
    index 832d0a8..379313b 100644
    a b ChannelScanSM::ChannelScanSM( 
    177177    {
    178178        VERBOSE(VB_CHANSCAN, LOC + "Connecting up DTVSignalMonitor");
    179179        ScanStreamData *data = new ScanStreamData();
     180       
     181        MSqlQuery query(MSqlQuery::InitCon());
     182        query.prepare(
     183                "SELECT dvb_nit_id "
     184                "FROM videosource "
     185                "WHERE videosource.sourceid = :SOURCEID");
     186        query.bindValue(":SOURCEID", _sourceID);
     187        if (!query.exec() || !query.isActive())
     188        {
     189            MythDB::DBError("ChannelScanSM", query);
     190        }
     191        else if (query.next())
     192        {
     193            uint nitid = query.value(0).toInt();
     194            data->SetRealNetworkID(nitid);
     195            VERBOSE(VB_CHANSCAN, LOC + QString("Setting NIT-ID to %1").arg(nitid));
     196        }
    180197
    181198        dtvSigMon->SetStreamData(data);
    182199        dtvSigMon->AddFlags(SignalMonitor::kDTVSigMon_WaitForMGT |
  • mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp

    diff --git a/mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp b/mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp
    index d12f177..255acfd 100644
    a b bool DVBStreamData::HandleTables(uint pid, const PSIPTable &psip) 
    234234    {
    235235        case TableID::NIT:
    236236        {
     237            if (_dvb_real_network_id >= 0 && psip.TableIDExtension() != (uint)_dvb_real_network_id)
     238            {
     239                NetworkInformationTable *nit = new NetworkInformationTable(psip);
     240                if (!nit->Mutate())
     241                {
     242                    delete nit;
     243                    return true;
     244                }
     245                bool retval = HandleTables(pid, *nit);
     246                delete nit;
     247                return retval;
     248            }
     249
    237250            SetVersionNIT(psip.Version(), psip.LastSection());
    238251            SetNITSectionSeen(psip.Section());
    239252
    bool DVBStreamData::HandleTables(uint pid, const PSIPTable &psip) 
    291304        }
    292305        case TableID::NITo:
    293306        {
     307            if (_dvb_real_network_id >= 0 && psip.TableIDExtension() == (uint)_dvb_real_network_id)
     308            {
     309                NetworkInformationTable *nit = new NetworkInformationTable(psip);
     310                if (!nit->Mutate())
     311                {
     312                    delete nit;
     313                    return true;
     314                }
     315                bool retval = HandleTables(pid, *nit);
     316                delete nit;
     317                return retval;
     318            }
     319
    294320            SetVersionNITo(psip.Version(), psip.LastSection());
    295321            SetNIToSectionSeen(psip.Section());
    296322            NetworkInformationTable nit(psip);
  • mythtv/libs/libmythtv/mpeg/dvbstreamdata.h

    diff --git a/mythtv/libs/libmythtv/mpeg/dvbstreamdata.h b/mythtv/libs/libmythtv/mpeg/dvbstreamdata.h
    index 3df7ac9..8c1eff9 100644
    a b class DVBStreamData : virtual public MPEGStreamData 
    4040    bool IsRedundant(uint pid, const PSIPTable&) const;
    4141    void ProcessSDT(uint tsid, const ServiceDescriptionTable*);
    4242
     43    // NIT for broken providers
     44    inline void SetRealNetworkID(int);
     45
    4346    // EIT info/processing
    4447    inline void SetDishNetEIT(bool);
    4548    inline bool HasAnyEIT(void) const;
    class DVBStreamData : virtual public MPEGStreamData 
    212215    uint                      _desired_netid;
    213216    uint                      _desired_tsid;
    214217
     218    // Real network ID for broken providers
     219    int                       _dvb_real_network_id;
     220
    215221    /// Decode DishNet's long-term DVB EIT
    216222    bool                      _dvb_eit_dishnet_long;
    217223    /// Tell us if the DVB service has EIT
    inline void DVBStreamData::SetDishNetEIT(bool use_dishnet_eit) 
    251257    _dvb_eit_dishnet_long = use_dishnet_eit;
    252258}
    253259
     260inline void DVBStreamData::SetRealNetworkID(int real_network_id)
     261{
     262    QMutexLocker locker(&_listener_lock);
     263    _dvb_real_network_id = real_network_id;
     264}
     265
    254266inline bool DVBStreamData::HasAnyEIT(void) const
    255267{
    256268    QMutexLocker locker(&_listener_lock);
  • mythtv/libs/libmythtv/mpeg/dvbtables.cpp

    diff --git a/mythtv/libs/libmythtv/mpeg/dvbtables.cpp b/mythtv/libs/libmythtv/mpeg/dvbtables.cpp
    index 4b3d0a8..dbfaf05 100644
    a b QString NetworkInformationTable::NetworkName() const 
    7878    return _cached_network_name;
    7979}
    8080
     81bool NetworkInformationTable::Mutate(void)
     82{
     83    if (VerifyCRC())
     84    {
     85        SetTableID((TableID() == TableID::NITo) ? TableID::NIT : TableID::NITo);
     86        SetCRC(CalcCRC());
     87        return true;
     88    }
     89    else
     90        return false;
     91}
    8192
    8293void ServiceDescriptionTable::Parse(void) const
    8394{
  • mythtv/libs/libmythtv/mpeg/dvbtables.h

    diff --git a/mythtv/libs/libmythtv/mpeg/dvbtables.h b/mythtv/libs/libmythtv/mpeg/dvbtables.h
    index 8d1228a..8aba9db 100644
    a b class NetworkInformationTable : public PSIPTable 
    7979        { return _ptrs[i]+6; }
    8080    // }
    8181
     82    /// mutates a NITo into a NITa (vice versa) and recalculates the CRC
     83    bool Mutate(void);
     84
    8285    void Parse(void) const;
    8386    QString toString(void) const;
    8487    QString NetworkName(void) const;
    class ServiceDescriptionTable : public PSIPTable 
    154157    // }
    155158    ServiceDescriptor *GetServiceDescriptor(uint i) const;
    156159
    157     /// mutates a SDTo into a SDTa and recalculates the CRC
     160    /// mutates a SDTo into a SDTa (vice versa) and recalculates the CRC
    158161    bool Mutate(void);
    159162
    160163    void Parse(void) const;
  • mythtv/libs/libmythtv/videosource.cpp

    diff --git a/mythtv/libs/libmythtv/videosource.cpp b/mythtv/libs/libmythtv/videosource.cpp
    index ed216df..eff8061 100644
    a b class XMLTVGrabber : public ComboBoxSetting, public VideoSourceDBStorage 
    198198    };
    199199};
    200200
     201class DVBNetID : public SpinBoxSetting, public VideoSourceDBStorage
     202{
     203  public:
     204    DVBNetID(const VideoSource &parent, uint value, signed int min_val) :
     205        SpinBoxSetting(this, min_val, 100000, 1),
     206        VideoSourceDBStorage(this, parent, "dvb_nit_id")
     207    {
     208        setLabel(QObject::tr("Network ID"));
     209        setHelpText(QObject::tr("Set this to the actual network ID at your "
     210                 "location, if you have a provider that broadcasts a broken "
     211                 "NIT. Leave at -1 if everything works out of the box."));
     212    };
     213};
     214
    201215FreqTableSelector::FreqTableSelector(const VideoSource &parent) :
    202216    ComboBoxSetting(this), VideoSourceDBStorage(this, parent, "freqtable")
    203217{
    VideoSource::VideoSource() 
    669683    group->addChild(name = new Name(*this));
    670684    group->addChild(xmltv = new XMLTVConfig(*this));
    671685    group->addChild(new FreqTableSelector(*this));
     686    group->addChild(new DVBNetID(*this, -1, -1));
    672687    addChild(group);
    673688}
    674689