Ticket #5882: inappropriate_mux.diff

File inappropriate_mux.diff, 4.7 KB (added by mnix <mythtv-acct@…>, 3 years ago)

Prevent inappropriate mux creation (eg DVB-T mux created when scanning Optus D1 with DVB-S tuner)

  • channelutil.cpp

    old new  
    130130            .arg(db_source_id).arg(sistandard) 
    131131            .arg(frequency).arg(modulation)); 
    132132 
     133    // some tables have extra blank entries 
     134    if (frequency == 0) 
     135    { 
     136       VERBOSE(VB_IMPORTANT, "insert_dtv_multiplex: will not create a multiplex with a zero frequency"); 
     137       return 0; 
     138    } 
     139 
    133140    // If transport is already present, skip insert 
    134141    int mplex = get_dtv_multiplex( 
    135142        db_source_id,  sistandard,    frequency, 
     
    289296} 
    290297 
    291298void handle_transport_desc(vector<uint> &muxes, const MPEGDescriptor &desc, 
    292                            uint sourceid, uint tsid, uint netid) 
     299                           uint sourceid, uint tsid, uint netid, DTVTunerType tuner_type) 
    293300{ 
    294301    uint tag = desc.DescriptorTag(); 
    295302 
     
    298305        const TerrestrialDeliverySystemDescriptor cd(desc); 
    299306        uint64_t freq = cd.FrequencyHz(); 
    300307 
     308        // some tables have extra blank entries 
     309        if (cd.FrequencyHz() == 0) return; 
     310 
     311        if ((DTVTunerType::kTunerTypeDVB_T != tuner_type) && 
     312            (DTVTunerType::kTunerTypeOFDM  != tuner_type) 
     313           ) 
     314        { 
     315           VERBOSE(VB_IMPORTANT, QString("handle_transport_desc: DVB-T descriptor on %1 tuner"). 
     316                                         arg(tuner_type.toString())); 
     317           return; 
     318        } 
     319 
    301320        // Use the frequency we already have for this mplex 
    302321        // as it may be one of the other_frequencies for this mplex 
    303322        int mux = ChannelUtil::GetMplexID(sourceid, tsid, netid); 
     
    342361    { 
    343362        const SatelliteDeliverySystemDescriptor cd(desc); 
    344363 
     364        // some tables have extra blank entries 
     365        if (cd.FrequencyHz() == 0) return; 
     366 
     367        if ((DTVTunerType::kTunerTypeDVB_S  != tuner_type) && 
     368            (DTVTunerType::kTunerTypeDVB_S2 != tuner_type) && 
     369            (DTVTunerType::kTunerTypeQPSK   != tuner_type) 
     370           ) 
     371        { 
     372           VERBOSE(VB_IMPORTANT, QString("handle_transport_desc: DVB-S descriptor on %1 tuner"). 
     373                                         arg(tuner_type.toString())); 
     374           return; 
     375        } 
     376 
    345377        uint mux = ChannelUtil::CreateMultiplex( 
    346378            sourceid,             "dvb", 
    347379            cd.FrequencyHz(),     cd.ModulationString(), 
     
    366398    { 
    367399        const CableDeliverySystemDescriptor cd(desc); 
    368400 
     401        // some tables have extra blank entries 
     402        if (cd.FrequencyHz() == 0) return; 
     403 
     404        if ((DTVTunerType::kTunerTypeDVB_C != tuner_type) && 
     405            (DTVTunerType::kTunerTypeQAM   != tuner_type) 
     406           ) 
     407        { 
     408           VERBOSE(VB_IMPORTANT, QString("handle_transport_desc: DVB-C descriptor on %1 tuner"). 
     409                                         arg(tuner_type.toString())); 
     410           return; 
     411        } 
     412 
    369413        uint mux = ChannelUtil::CreateMultiplex( 
    370414            sourceid,             "dvb", 
    371415            cd.FrequencyHz(),     cd.ModulationString(), 
     
    450494 * 
    451495 */ 
    452496vector<uint> ChannelUtil::CreateMultiplexes( 
    453     int sourceid, const NetworkInformationTable *nit) 
     497    DTVTunerType tuner_type, int sourceid, const NetworkInformationTable *nit) 
    454498{ 
    455499    vector<uint> muxes; 
    456500 
     
    468512        for (uint j = 0; j < list.size(); ++j) 
    469513        { 
    470514            const MPEGDescriptor desc(list[j]); 
    471             handle_transport_desc(muxes, desc, sourceid, tsid, netid); 
     515 
     516            handle_transport_desc(muxes, desc, sourceid, tsid, netid, tuner_type); 
    472517        } 
    473518    } 
    474519    return muxes; 
  • libmythtv/siscan.cpp

     
    330330            tr("Network %1 Processing").arg(nit->NetworkName())); 
    331331 
    332332        vector<uint> mp; 
    333         mp = ChannelUtil::CreateMultiplexes(sourceID, nit); 
     333        mp = ChannelUtil::CreateMultiplexes(GetDVBChannel()->GetCardType(), sourceID, nit); 
    334334        VERBOSE(VB_SIPARSER, QString("Created %1 multiplexes from NIT") 
    335335                .arg(mp.size())); 
    336336 
  • channelutil.h

    old new  
    7474                                   int transport_id, int network_id); 
    7575 
    7676    static vector<uint> CreateMultiplexes( 
    77         int sourceid, const NetworkInformationTable *nit); 
     77        DTVTunerType tuner_type, int sourceid, const NetworkInformationTable *nit); 
    7878 
    7979    static uint    GetMplexID(uint sourceid, const QString &channum); 
    8080    static int     GetMplexID(uint sourceid,     uint frequency);