Ticket #2695: 2695-uk-v1.patch

File 2695-uk-v1.patch, 10.8 KB (added by danielk, 17 years ago)

UK scanning patch

  • libs/libmythtv/channelscan/channelscan_sm.h

     
    182182
    183183    static QString loc(const ChannelScanSM*);
    184184
     185    static const uint kDVBTableTimeout;
     186    static const uint kATSCTableTimeout;
     187    static const uint kMPEGTableTimeout;
     188
    185189  private:
    186190    // Set in constructor
    187191    ScanMonitor      *scan_monitor;
  • libs/libmythtv/channelscan/channelimporter.cpp

     
    4545
    4646    ScanDTVTransportList transports = _transports;
    4747
     48    // Print out each channel
     49    cout << "Before processing: " << endl;
     50    ChannelImporterBasicStats infoA = CollectStats(transports);
     51    cout << FormatChannels(transports, infoA).toAscii().constData() << endl;
     52    cout << endl << endl;
     53
    4854    CleanupDuplicates(transports);
    4955
    5056    uint saved_scan = 0;
     
    6672        CollectUniquenessStats(transports, info);
    6773
    6874    // Print out each channel
     75    cout << "After processing: " << endl;
    6976    cout << FormatChannels(transports, info).toAscii().constData() << endl;
    7077
    7178    // Create summary
     
    745752                  .arg(chan.pat_tsid)
    746753                  .arg(si_standard)).toAscii().constData();
    747754    else if (si_standard == "dvb")
    748         ssMsg << (QString("%1:%2:%3:%4:%5:%6:%8")
     755        ssMsg << (QString("%1:%2:%3:%4:%5:%6=%7:%8")
    749756                  .arg(chan.service_name).arg(chan.chan_num)
    750757                  .arg(chan.netid).arg(chan.orig_netid)
     758                  .arg(chan.service_id)
    751759                  .arg(chan.sdt_tsid)
    752760                  .arg(chan.pat_tsid)
    753761                  .arg(si_standard)).toAscii().constData();
  • libs/libmythtv/channelscan/channelscan_sm.cpp

     
    5959#include "hdhrchannel.h"
    6060#include "v4lchannel.h"
    6161
     62/// SDT's should be sent every 2 seconds and NIT's every
     63/// 10 seconds, so lets wait at least 30 seconds, in
     64/// case of bad transmitter or lost packets.
     65const uint ChannelScanSM::kDVBTableTimeout  = 30 * 1000;
     66/// No logic here, lets just wait at least 10 seconds.
     67const uint ChannelScanSM::kATSCTableTimeout = 10 * 1000;
     68/// No logic here, lets just wait at least 15 seconds.
     69const uint ChannelScanSM::kMPEGTableTimeout = 15 * 1000;
     70
    6271QString ChannelScanSM::loc(const ChannelScanSM *siscan)
    6372{
    6473    if (siscan && siscan->channel)
     
    511520    }
    512521
    513522    // DVB
    514     if ((!wait_until_complete || sd->HasCachedAllNIT()) && info->nits.empty())
     523    if ((!wait_until_complete || sd->HasCachedAllNIT()) &&
     524        info->nits.empty())
     525    {
    515526        info->nits = sd->GetCachedNIT();
     527        VERBOSE(VB_IMPORTANT,
     528                QString("HERE -- Setting info->nits size() : %1, "
     529                        "wait_until_complete: %2")
     530                .arg(info->nits.size())
     531                .arg(wait_until_complete));
     532    }
    516533
    517534    sdt_vec_t sdttmp = sd->GetCachedSDTs();
    518535    tsid_checked.clear();
     
    536553        transport_tune_complete &= !info->pmts.empty();
    537554        if (sd->HasCachedMGT() || sd->HasCachedAnyVCTs())
    538555        {
     556            transport_tune_complete &= sd->HasCachedMGT();
    539557            transport_tune_complete &=
    540558                (!info->tvcts.empty() || !info->cvcts.empty());
    541559        }
     
    544562            transport_tune_complete &= !info->nits.empty();
    545563            transport_tune_complete &= !info->sdts.empty();
    546564        }
     565        if (transport_tune_complete)
     566        {
     567            VERBOSE(VB_CHANSCAN,
     568                    QString("transport_tune_complete: "
     569                            "\n\t\t\tinfo->pmts.empty():     %1"
     570                            "\n\t\t\tsd->HasCachedAnyNIT():  %2"
     571                            "\n\t\t\tsd->HasCachedAnySDTs(): %3"
     572                            "\n\t\t\tinfo->nits.empty():     %4"
     573                            "\n\t\t\tinfo->sdts.empty():     %5")
     574                    .arg(info->pmts.empty())
     575                    .arg(sd->HasCachedAnyNIT())
     576                    .arg(sd->HasCachedAnySDTs())
     577                    .arg(info->nits.empty())
     578                    .arg(info->sdts.empty()));
     579        }
    547580    }
    548581    transport_tune_complete |= !wait_until_complete;
     582    if (transport_tune_complete)
     583    {
     584        VERBOSE(VB_CHANSCAN,
     585                QString("transport_tune_complete: wait_until_complete %1")
     586                .arg(wait_until_complete));
     587    }
    549588
    550589    if (transport_tune_complete &&
    551590        /*!ignoreEncryptedServices &&*/ currentEncryptionStatus.size())
     
    11341173bool ChannelScanSM::HasTimedOut(void)
    11351174{
    11361175    if (currentTestingDecryption)
    1137         return (timer.elapsed() > (int)kDecryptionTimeout);
     1176    {
     1177        bool to = (timer.elapsed() > (int)kDecryptionTimeout);
     1178        if (to)
     1179            VERBOSE(VB_IMPORTANT, "HasTimedOut() decryption timeout reached");
     1180        return to;           
     1181    }
    11381182
    11391183    if (!waitingForTables)
     1184    {
     1185        VERBOSE(VB_IMPORTANT, "HasTimedOut() waitingForTables == false");
    11401186        return true;
     1187    }
    11411188
    11421189#ifdef USING_DVB
    11431190    // If the rotor is still moving, reset the timer and keep waiting
     
    11611208
    11621209    // have the tables have timed out?
    11631210    if (timer.elapsed() > (int)channelTimeout)
     1211    {
     1212        // the channelTimeout alone is only valid if we have seen no tables..
     1213        const ScanStreamData *sd = NULL;
     1214        if (GetDTVSignalMonitor())
     1215            sd = GetDTVSignalMonitor()->GetScanStreamData();
     1216
     1217        if (!sd)
     1218        {
     1219            VERBOSE(VB_IMPORTANT,
     1220                    "HasTimedOut() !ssd && channel timeout reached");
     1221            return true;
     1222        }
     1223
     1224        if (sd->HasCachedAnyNIT() || sd->HasCachedAnySDTs())
     1225        {
     1226            if (timer.elapsed() > (int) kDVBTableTimeout)
     1227            {
     1228                VERBOSE(VB_IMPORTANT,
     1229                        "HasTimedOut() DVB && DVB table timeout reached");
     1230                return true;
     1231            }
     1232            else
     1233                return false;
     1234        }
     1235        if (sd->HasCachedMGT() || sd->HasCachedAnyVCTs())
     1236        {
     1237            if (timer.elapsed() > (int) kATSCTableTimeout)
     1238            {
     1239                VERBOSE(VB_IMPORTANT,
     1240                        "HasTimedOut() ATSC && ATSC table timeout reached");
     1241                return true;
     1242            }
     1243            else
     1244                return false;
     1245        }
     1246        if (sd->HasCachedAnyPAT() || sd->HasCachedAnyPMTs())
     1247        {
     1248            if (timer.elapsed() > (int) kMPEGTableTimeout)
     1249            {
     1250                VERBOSE(VB_IMPORTANT,
     1251                        "HasTimedOut() MPEG && MPEG table timeout reached");
     1252                return true;
     1253            }
     1254            else
     1255                return false;
     1256        }
     1257
     1258        VERBOSE(VB_IMPORTANT,
     1259                "HasTimedOut() !tables && channel timeout reached");
    11641260        return true;
     1261    }
    11651262
    11661263    // ok the tables haven't timed out, but have we hit the signal timeout?
    11671264    SignalMonitor *sm = GetSignalMonitor();
    11681265    if ((timer.elapsed() > (int)(*current).timeoutTune) &&
    11691266        sm && !sm->HasSignalLock())
    11701267    {
    1171         return true;
     1268        const ScanStreamData *sd = NULL;
     1269        if (GetDTVSignalMonitor())
     1270            sd = GetDTVSignalMonitor()->GetScanStreamData();
     1271
     1272        if (!sd)
     1273        {
     1274            VERBOSE(VB_IMPORTANT,
     1275                    "HasTimedOut() signal timeout reached && !ssd");
     1276            return true;
     1277        }
     1278
     1279        // Just is case we temporarily lose the signal after we've seen
     1280        // tables...
     1281        if (!sd->HasCachedAnyPAT() && !sd->HasCachedAnyPMTs() &&
     1282            !sd->HasCachedMGT()    && !sd->HasCachedAnyVCTs() &&
     1283            !sd->HasCachedAnyNIT() && !sd->HasCachedAnySDTs())
     1284        {
     1285            VERBOSE(VB_IMPORTANT,
     1286                    "HasTimedOut() signal timeout reached && !tables");
     1287            return true;
     1288        }
    11721289    }
    11731290
    11741291    return false;
  • libs/libmythtv/mpeg/mpegstreamdata.cpp

     
    12631263    return true;
    12641264}
    12651265
     1266bool MPEGStreamData::HasCachedAnyPMTs(void) const
     1267{
     1268    QMutexLocker locker(&_cache_lock);
     1269    return _cached_pmts.size();
     1270}
     1271
    12661272const pat_ptr_t MPEGStreamData::GetCachedPAT(
    12671273    uint tsid, uint section_num) const
    12681274{
  • libs/libmythtv/mpeg/atscstreamdata.cpp

     
    617617    if (!current)
    618618        VERBOSE(VB_IMPORTANT, "Currently we ignore \'current\' param");
    619619
     620    QMutexLocker locker(&_cache_lock);
     621    return !_cached_tvcts.empty();
     622#if 0
    620623    if (!_cached_mgt)
    621624        return false;
    622625
     
    630633    _cache_lock.unlock();
    631634
    632635    return ret;
     636#endif
    633637}
    634638
    635639bool ATSCStreamData::HasCachedAnyCVCTs(bool current) const
     
    637641    if (!current)
    638642        VERBOSE(VB_IMPORTANT, "Currently we ignore \'current\' param");
    639643
     644    QMutexLocker locker(&_cache_lock);
     645    return !_cached_cvcts.empty();
     646#if 0
    640647    if (!_cached_mgt)
    641648        return false;
    642649
     
    650657    _cache_lock.unlock();
    651658
    652659    return ret;
     660#endif
    653661}
    654662
    655663const MasterGuideTable *ATSCStreamData::GetCachedMGT(bool current) const
  • libs/libmythtv/mpeg/dvbstreamdata.cpp

     
    738738bool DVBStreamData::HasCachedAnySDTs(bool current) const
    739739{
    740740    QMutexLocker locker(&_cache_lock);
    741 
     741    return !_cached_sdts.empty();
     742#if 0
    742743    if (_cached_nit.empty())
    743744        return false;
    744745
     
    753754    }
    754755
    755756    return false;
     757#endif
    756758}
    757759
    758760bool DVBStreamData::HasCachedAllSDTs(bool current) const
  • libs/libmythtv/mpeg/mpegstreamdata.h

     
    198198    bool HasCachedAllPMT(uint program_num) const;
    199199    bool HasCachedAnyPMT(uint program_num) const;
    200200    bool HasCachedAllPMTs(void) const;
     201    bool HasCachedAnyPMTs(void) const;
    201202
    202203    const pat_ptr_t GetCachedPAT(uint tsid, uint section_num) const;
    203204    pat_vec_t       GetCachedPATs(uint tsid) const;