Ticket #3640: dvb_broken_nit_providers1.diff

File dvb_broken_nit_providers1.diff, 3.2 KB (added by janne, 5 years ago)
  • libs/libmythtv/mpeg/dvbtables.cpp

     
    7777    return _cached_network_name; 
    7878} 
    7979 
     80bool NetworkInformationTable::Mutate(void) 
     81{ 
     82    if (VerifyCRC()) 
     83    { 
     84        SetTableID((TableID() == TableID::NITo) ? TableID::NIT : TableID::NITo); 
     85        SetCRC(CalcCRC()); 
     86        return true; 
     87    } 
     88    else 
     89        return false; 
     90} 
    8091 
    8192void ServiceDescriptionTable::Parse(void) const 
    8293{ 
  • libs/libmythtv/mpeg/dvbstreamdata.cpp

     
    1010 
    1111#define PREMIERE_ONID 133 
    1212 
     13/* change to the "correct" network ID for broken dvb providers 
     14 * which transmit the real NIT as NIT other 
     15 */ 
     16static const int real_network_id = -1; 
     17 
    1318// service_id is synonymous with the MPEG program number in the PMT. 
    1419DVBStreamData::DVBStreamData(uint desired_netid,  uint desired_tsid, 
    1520                             int desired_program, bool cacheTables) 
     
    220225    { 
    221226        case TableID::NIT: 
    222227        { 
     228            if (real_network_id >= 0 && psip.TableIDExtension() != (uint)real_network_id) 
     229            { 
     230                NetworkInformationTable *nit = new NetworkInformationTable(psip); 
     231                if (!nit->Mutate()) 
     232                { 
     233                    delete nit; 
     234                    return true; 
     235                } 
     236                bool retval = HandleTables(pid, *nit); 
     237                delete nit; 
     238                return retval; 
     239            } 
     240 
    223241            SetVersionNIT(psip.Version(), psip.LastSection()); 
    224242            SetNITSectionSeen(psip.Section()); 
    225243 
     
    277295        } 
    278296        case TableID::NITo: 
    279297        { 
     298            if (real_network_id >= 0 && psip.TableIDExtension() == (uint)real_network_id) 
     299            { 
     300                NetworkInformationTable *nit = new NetworkInformationTable(psip); 
     301                if (!nit->Mutate()) 
     302                { 
     303                    delete nit; 
     304                    return true; 
     305                } 
     306                bool retval = HandleTables(pid, *nit); 
     307                delete nit; 
     308                return retval; 
     309            } 
     310 
    280311            SetVersionNITo(psip.Version(), psip.LastSection()); 
    281312            SetNIToSectionSeen(psip.Section()); 
    282313            NetworkInformationTable nit(psip); 
  • libs/libmythtv/mpeg/dvbtables.h

     
    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; 
     
    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;