Ticket #13014: 20190319-delsys-v1.patch

File 20190319-delsys-v1.patch, 30.9 KB (added by Klaas de Waal, 5 years ago)

Second implementation of support for multiple delivery systems.

  • mythtv/libs/libmythtv/cardutil.cpp

    diff --git a/mythtv/libs/libmythtv/cardutil.cpp b/mythtv/libs/libmythtv/cardutil.cpp
    index 41224166d9..76fdf521e9 100644
    a b QStringList CardUtil::ProbeVideoDevices(const QString &rawtype) 
    574574    return devs;
    575575}
    576576
    577 QString CardUtil::ProbeDVBType(const QString &device)
     577// Get the list of delivery systems from the card
     578QStringList CardUtil::ProbeDeliverySystems(const QString &device)
    578579{
    579     QString ret = "ERROR_UNKNOWN";
     580    QStringList delsys;
    580581
    581582    if (device.isEmpty())
    582         return ret;
     583        return delsys;
    583584
    584585#ifdef USING_DVB
    585586    QString dvbdev = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, device);
    QString CardUtil::ProbeDVBType(const QString &device) 
    588589    int fd_frontend = open(dev.constData(), O_RDWR | O_NONBLOCK);
    589590    if (fd_frontend < 0)
    590591    {
    591         LOG(VB_GENERAL, LOG_ERR, QString("Can't open DVB frontend (%1) for %2.")
     592        LOG(VB_GENERAL, LOG_ERR, LOC +
     593            QString("Can't open DVB frontend (%1) for %2.")
    592594                .arg(dvbdev).arg(device) + ENO);
    593         return ret;
    594     }
    595 
    596     struct dvb_frontend_info info;
    597     memset(&info, 0, sizeof(info));
    598     int err = ioctl(fd_frontend, FE_GET_INFO, &info);
    599     if (err < 0)
    600     {
    601         close(fd_frontend);
    602         LOG(VB_GENERAL, LOG_ERR, QString("FE_GET_INFO ioctl failed (%1)")
    603                                          .arg(dvbdev) + ENO);
    604         return ret;
    605     }
    606 
    607     DTVTunerType type(info.type);
    608 #if HAVE_FE_CAN_2G_MODULATION
    609     if (info.caps & FE_CAN_2G_MODULATION)
    610     {
    611         if (type == DTVTunerType::kTunerTypeDVBS1)
    612             type = DTVTunerType::kTunerTypeDVBS2;
    613         else if (type == DTVTunerType::kTunerTypeDVBT)
    614             type = DTVTunerType::kTunerTypeDVBT2;
     595        return delsys;
    615596    }
    616 #endif // HAVE_FE_CAN_2G_MODULATION
    617597
    618598#if DVB_API_VERSION >=5
    619599    unsigned int i;
    QString CardUtil::ProbeDVBType(const QString &device) 
    621601    struct dtv_properties cmd;
    622602
    623603    memset(&prop, 0, sizeof(prop));
    624     prop.cmd = DTV_ENUM_DELSYS;
     604    prop.cmd = DTV_API_VERSION;
    625605    cmd.num = 1;
    626606    cmd.props = &prop;
     607    if (ioctl(fd_frontend, FE_GET_PROPERTY, &cmd) == 0)
     608    {
     609        LOG(VB_GENERAL, LOG_INFO, LOC +
     610            QString("(%1) ").arg(dvbdev) +
     611            QString("dvb api version %1.%2").arg((prop.u.data>>8)&0xff).arg((prop.u.data)&0xff));
     612    }
     613    else
     614    {
     615        LOG(VB_GENERAL, LOG_ERR, LOC + QString("(%1) FE_GET_PROPERTY ioctl failed")
     616            .arg(dvbdev) + ENO);
     617        close(fd_frontend);
     618        return delsys;
     619    }
    627620
     621    memset(&prop, 0, sizeof(prop));
     622    prop.cmd = DTV_ENUM_DELSYS;
     623    cmd.num = 1;
     624    cmd.props = &prop;
    628625    if (ioctl(fd_frontend, FE_GET_PROPERTY, &cmd) == 0)
    629626    {
    630627        for (i = 0; i < prop.u.buffer.len; i++)
    631628        {
    632             switch (prop.u.buffer.data[i])
    633             {
    634                 // TODO: not supported. you can have DVBC and DVBT on the same card
    635                 // The following are backwards compatible so its ok
    636                 case SYS_DVBS2:
    637                     type = DTVTunerType::kTunerTypeDVBS2;
    638                     break;
    639                 case SYS_DVBT2:
    640                     type = DTVTunerType::kTunerTypeDVBT2;
    641                     break;
    642                 default:
    643                     break;
    644             }
     629            delsys.push_back(DTVModulationSystem::toString(prop.u.buffer.data[i]));
    645630        }
     631        QStringList::iterator it = delsys.begin();
     632        QString msg = "Delivery systems:";
     633        for (; it != delsys.end(); it++)
     634        {
     635            msg += " ";
     636            msg += *it;
     637        }
     638        LOG(VB_GENERAL, LOG_INFO, QString("CardUtil: (%1) num props:%2 ")
     639            .arg(dvbdev).arg(prop.u.buffer.len) + msg);
    646640    }
    647 #endif
     641    else
     642    {
     643        LOG(VB_GENERAL, LOG_ERR, LOC + QString("FE_GET_PROPERTY ioctl failed (%1)")
     644            .arg(dvbdev) + ENO);
     645    }
     646#endif  // DVB_API_VERSION >= 5
    648647    close(fd_frontend);
     648#endif  // USING_DVB
    649649
     650    return delsys;
     651}
     652
     653QString CardUtil::ProbeDVBType(const QString &device)
     654{
     655    QString ret = "ERROR_UNKNOWN";
     656
     657    if (device.isEmpty())
     658        return ret;
     659
     660#ifdef USING_DVB
     661    DTVTunerType type = ProbeTunerType(device);
    650662    ret = (type.toString() != "UNKNOWN") ? type.toString().toUpper() : ret;
     663
     664    LOG(VB_GENERAL, LOG_INFO, LOC + QString("(%1) tuner type:%2")
     665        .arg(device).arg(ret));
    651666#endif // USING_DVB
    652667
    653668    return ret;
    uint CardUtil::GetMinSignalMonitoringDelay(const QString &device) 
    719734    return 25;
    720735}
    721736
     737
     738DTVTunerType CardUtil::ConvertToTunerType(DTVModulationSystem delsys)
     739{
     740    DTVTunerType tunertype;
     741
     742    switch (delsys)
     743    {
     744        case DTVModulationSystem::kModulationSystem_DVBS:
     745            tunertype = DTVTunerType::kTunerTypeDVBS1;
     746            break;
     747        case DTVModulationSystem::kModulationSystem_DVBS2:
     748            tunertype = DTVTunerType::kTunerTypeDVBS2;
     749            break;
     750        case DTVModulationSystem::kModulationSystem_DVBC_ANNEX_A:
     751            tunertype = DTVTunerType::kTunerTypeDVBC;
     752            break;
     753        case DTVModulationSystem::kModulationSystem_DVBT:
     754            tunertype = DTVTunerType::kTunerTypeDVBT;
     755            break;
     756        case DTVModulationSystem::kModulationSystem_DVBT2:
     757            tunertype = DTVTunerType::kTunerTypeDVBT2;
     758            break;
     759        case DTVModulationSystem::kModulationSystem_ATSC:
     760            tunertype = DTVTunerType::kTunerTypeATSC;
     761            break;
     762        default:
     763            LOG(VB_GENERAL, LOG_ERR, LOC +
     764                QString("TODO Add to switch case delivery system:%2 %3")
     765                    .arg(delsys).arg(delsys.toString()));
     766            break;
     767    }
     768
     769    return tunertype;
     770}
     771
     772// Get the currently configured delivery system from the database
     773DTVModulationSystem CardUtil::GetDeliverySystem(uint inputid)
     774{
     775    QString delsys_db = GetDeliverySystemFromDB(inputid);
     776    DTVModulationSystem delsys;
     777    delsys.Parse(delsys_db);
     778    return delsys;
     779}
     780
     781// Get the currently configured tuner type from the database
     782DTVTunerType CardUtil::GetTunerType(uint inputid)
     783{
     784    DTVModulationSystem delsys = GetDeliverySystem(inputid);
     785    DTVTunerType tunertype = ConvertToTunerType(delsys);
     786    return tunertype;
     787}
     788
     789// Get the currently configured delivery system from the device
     790DTVModulationSystem CardUtil::ProbeDeliverySystem(const QString &device)
     791{
     792    DTVModulationSystem delsys;
     793
     794    QByteArray dev = device.toLatin1();
     795    int fd_frontend = open(dev.constData(), O_RDWR | O_NONBLOCK);
     796    if (fd_frontend < 0)
     797    {
     798        LOG(VB_GENERAL, LOG_ERR, LOC +
     799            QString("open failed (%1)")
     800                .arg(device) + ENO);
     801        return delsys;
     802    }
     803
     804#ifdef USING_DVB
     805#if DVB_API_VERSION >=5
     806    struct dtv_property prop;
     807    struct dtv_properties cmd;
     808
     809    memset(&prop, 0, sizeof(prop));
     810    prop.cmd = DTV_DELIVERY_SYSTEM;
     811    // prop.u.data = delsys;
     812    cmd.num = 1;
     813    cmd.props = &prop;
     814
     815    int ret = ioctl(fd_frontend, FE_GET_PROPERTY, &cmd);
     816    if (ret < 0)
     817    {
     818        LOG(VB_GENERAL, LOG_ERR, LOC +
     819            QString("FE_GET_PROPERTY ioctl failed (%1)")
     820                .arg(device) + ENO);
     821        return delsys;
     822        }
     823
     824    delsys.Parse(DTVModulationSystem::toString(prop.u.data));
     825
     826    LOG(VB_GENERAL, LOG_INFO, LOC + QString("(%1) delsys:%2 %3")
     827        .arg(device).arg(delsys).arg(delsys.toString()));
     828
     829#endif // DVB_API_VERSION >=5
     830#endif // USING_DVB
     831
     832    close(fd_frontend);
     833    return delsys;
     834}
     835
     836// Get the currently configured tuner type from the device
     837DTVTunerType CardUtil::ProbeTunerType(const QString &device)
     838{
     839    DTVModulationSystem delsys = ProbeDeliverySystem(device);
     840    DTVTunerType tunertype = ConvertToTunerType(delsys);
     841    return tunertype;
     842}
     843
     844// Get the delivery system from database table capturecard
     845// and configure the tuner accordingly.
     846// Return the tuner type corresponding with the modulation system.
    722847QString CardUtil::ProbeSubTypeName(uint inputid)
    723848{
    724849    QString type = GetRawInputType(inputid);
    QString CardUtil::ProbeSubTypeName(uint inputid) 
    730855    if (device.isEmpty())
    731856        return "ERROR_OPEN";
    732857
    733     return ProbeDVBType(device);
     858    DTVModulationSystem delsys = GetDeliverySystem(inputid);
     859    DTVTunerType tunertype = ConvertToTunerType(delsys);
     860    if (DTVTunerType::kTunerTypeUnknown != tunertype)
     861    {
     862        SetDeliverySystem(inputid, delsys);
     863    }
     864
     865    QString subtype = "ERROR_UNKNOWN";
     866    if (DTVTunerType::kTunerTypeUnknown != tunertype)
     867    {
     868        subtype = tunertype.toString();
     869    }
     870
     871    LOG(VB_GENERAL, LOG_INFO, LOC + QString("[%1]: delsys:%2 %3 tunertype:%4 %5 subtype:%6")
     872        .arg(inputid).arg(delsys).arg(delsys.toString())
     873        .arg(tunertype).arg(tunertype.toString()).arg(subtype));
     874
     875    return subtype;
    734876}
    735877
    736878/// \brief Returns true iff the input_type is one of the DVB types.
    bool CardUtil::IsDVBInputType(const QString &inputType) 
    741883        (t == "OFDM") || (t == "ATSC") || (t == "DVB_S2");
    742884}
    743885
     886int CardUtil::SetDeliverySystem(uint inputid)
     887{
     888    int ret = -1;
     889
     890#ifdef USING_DVB
     891#if DVB_API_VERSION >=5
     892    DTVModulationSystem delsys = GetDeliverySystem(inputid);
     893    ret = SetDeliverySystem(inputid, delsys);
     894#endif // DVB_API_VERSION >=5
     895#endif // USING_DVB
     896
     897    return ret;
     898}
     899
     900int CardUtil::SetDeliverySystem(uint inputid, DTVModulationSystem delsys)
     901{
     902    int ret = -1;
     903
     904#ifdef USING_DVB
     905#if DVB_API_VERSION >=5
     906    QString device = GetVideoDevice(inputid);
     907
     908    if (device.isEmpty())
     909        return ret;
     910
     911    QString dvbdev = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, device);
     912    QByteArray dev = dvbdev.toLatin1();
     913    int fd_frontend = open(dev.constData(), O_RDWR | O_NONBLOCK);
     914    if (fd_frontend < 0)
     915    {
     916        LOG(VB_GENERAL, LOG_ERR, LOC +
     917            QString("open failed (%1)")
     918                .arg(dvbdev) + ENO);
     919        return errno;
     920    }
     921    ret = SetDeliverySystem(inputid, delsys, fd_frontend);
     922
     923    close(fd_frontend);
     924#endif // DVB_API_VERSION >=5
     925#endif // USING_DVB
     926
     927    return ret;
     928}
     929
     930// Get delivery system from the database and write it to the card
     931int CardUtil::SetDeliverySystem(uint inputid, int fd)
     932{
     933    int ret = -1;
     934
     935#ifdef USING_DVB
     936#if DVB_API_VERSION >=5
     937    DTVModulationSystem delsys = GetDeliverySystem(inputid);
     938    ret = SetDeliverySystem(inputid, delsys, fd);
     939#endif // DVB_API_VERSION >=5
     940#endif // USING_DVB
     941
     942    return ret;
     943}
     944
     945// Write the delivery system to the card
     946int CardUtil::SetDeliverySystem(uint inputid, DTVModulationSystem delsys, int fd)
     947{
     948    int ret = -1;
     949
     950#ifdef USING_DVB
     951#if DVB_API_VERSION >=5
     952    LOG(VB_GENERAL, LOG_INFO, LOC + QString("[%1] fd:%2 delsys:%3 %4")
     953        .arg(inputid).arg(fd).arg(delsys).arg(delsys.toString()));
     954
     955    struct dtv_property prop;
     956    struct dtv_properties cmd;
     957
     958    memset(&prop, 0, sizeof(prop));
     959    prop.cmd = DTV_DELIVERY_SYSTEM;
     960    prop.u.data = delsys;
     961    cmd.num = 1;
     962    cmd.props = &prop;
     963
     964    ret = ioctl(fd, FE_SET_PROPERTY, &cmd);
     965    if (ret < 0)
     966    {
     967        LOG(VB_GENERAL, LOG_ERR, LOC +
     968            QString("[%1] FE_SET_PROPERTY ioctl failed")
     969                .arg(inputid) + ENO);
     970        return ret;
     971        }
     972#endif // DVB_API_VERSION >=5
     973#endif // USING_DVB
     974
     975    return ret;
     976}
     977
    744978QString get_on_input(const QString &to_get, uint inputid)
    745979{
    746980    MSqlQuery query(MSqlQuery::InitCon());
  • mythtv/libs/libmythtv/cardutil.h

    diff --git a/mythtv/libs/libmythtv/cardutil.h b/mythtv/libs/libmythtv/cardutil.h
    index 1de3a3ac48..e5c207ab16 100644
    a b using namespace std; 
    1414
    1515// MythTV headers
    1616#include "mythtvexp.h"
     17#include "dtvconfparserhelpers.h"
    1718
    1819class InputInfo;
    1920class CardInput;
    class MTV_PUBLIC CardUtil 
    275276        { return get_on_input("audiodevice", inputid); }
    276277    static QString      GetVBIDevice(uint inputid)
    277278        { return get_on_input("vbidevice", inputid); }
     279    static QString      GetDeliverySystemFromDB(uint inputid)
     280        { return get_on_input("inputname", inputid); }          // use capturecard/inputname for now
    278281
    279282    static QString      GetHostname(uint inputid)
    280283        { return get_on_input("hostname", inputid); }
    class MTV_PUBLIC CardUtil 
    372375        { return "DVB" == GetRawInputType(inputid); }
    373376    static bool         IsDVBInputType(const QString &input_type);
    374377    static QString      ProbeDVBFrontendName(const QString &device);
     378    static QStringList  ProbeDeliverySystems(const QString &device);
     379    static DTVModulationSystem ProbeDeliverySystem(const QString &device);
     380    static DTVTunerType ProbeTunerType(const QString &device);
     381    static DTVTunerType ConvertToTunerType(DTVModulationSystem delsys);
     382    static DTVTunerType GetTunerType(uint inputid);
     383    static DTVModulationSystem GetDeliverySystem(uint inputid);
    375384    static QString      ProbeDVBType(const QString &device);
    376385    static bool         HasDVBCRCBug(const QString &device);
    377386    static uint         GetMinSignalMonitoringDelay(const QString &device);
    378387    static QString      GetDeviceName(dvb_dev_type_t, const QString &device);
    379388    static InputNames   GetConfiguredDVBInputs(const QString &device);
     389    static int          SetDeliverySystem(uint inputid);
     390    static int          SetDeliverySystem(uint inputid, DTVModulationSystem delsys);
     391    static int          SetDeliverySystem(uint inputid, int fd);
     392    static int          SetDeliverySystem(uint inputid, DTVModulationSystem delsys, int fd);
    380393
    381394    // V4L info
    382395    static bool         hasV4L2(int videofd);
  • 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 6b2942250e..69be48c8e4 100644
    a b bool ChannelScanSM::AddToList(uint mplexid) 
    21762176
    21772177    TransportScanItem item(sourceid, sistandard, fn, mplexid, m_signalTimeout);
    21782178
     2179    // KdW
     2180    LOG(VB_CHANSCAN, LOG_INFO, LOC +
     2181        QString("tt:%1 %2 sourceid:%3 sistandard:%4 fn:'%5' mplexid:%6")
     2182            .arg(tt).arg(tt.toString()).arg(sourceid).arg(sistandard).arg(fn).arg(mplexid));
     2183
    21792184    if (item.m_tuning.FillFromDB(tt, mplexid))
    21802185    {
    21812186        LOG(VB_CHANSCAN, LOG_INFO, LOC + "Adding " + fn);
  • mythtv/libs/libmythtv/dtvconfparserhelpers.cpp

    diff --git a/mythtv/libs/libmythtv/dtvconfparserhelpers.cpp b/mythtv/libs/libmythtv/dtvconfparserhelpers.cpp
    index 55af025dac..a0101c8395 100644
    a b const char *DTVPolarity::s_dbStr[DTVPolarity::kDBStrCnt] = 
    448448const DTVParamHelperStruct DTVModulationSystem::s_confTable[] =
    449449{
    450450    { "SYS_UNDEFINED",     kModulationSystem_UNDEFINED     },
    451     { "SYS_DVBC_ANNEX_AC", kModulationSystem_DVBC_ANNEX_AC },
     451    { "SYS_DVBC_ANNEX_A",  kModulationSystem_DVBC_ANNEX_A },
    452452    { "SYS_DVBC_ANNEX_B",  kModulationSystem_DVBC_ANNEX_B  },
    453453    { "SYS_DVBT",          kModulationSystem_DVBT          },
    454454    { "SYS_DVBT2",         kModulationSystem_DVBT2         },
    const DTVParamHelperStruct DTVModulationSystem::s_vdrTable[] = 
    478478
    479479const DTVParamHelperStruct DTVModulationSystem::s_parseTable[] =
    480480{
    481     { "UNDEFINED", kModulationSystem_UNDEFINED     },
    482     { "DVBC_AC",   kModulationSystem_DVBC_ANNEX_AC },
    483     { "DVBC_B",    kModulationSystem_DVBC_ANNEX_B  },
    484     { "DVB-T",     kModulationSystem_DVBT          },
    485     { "DVB-T2",    kModulationSystem_DVBT2         },
    486     { "DSS",       kModulationSystem_DSS           },
    487     { "DVB-S",     kModulationSystem_DVBS          },
    488     { "DVB-S2",    kModulationSystem_DVBS2         },
    489     { "DVBH",      kModulationSystem_DVBH          },
    490     { "ISDBT",     kModulationSystem_ISDBT         },
    491     { "ISDBS",     kModulationSystem_ISDBS         },
    492     { "ISDBC",     kModulationSystem_ISDBC         },
    493     { "ATSC",      kModulationSystem_ATSC          },
    494     { "ATSCMH",    kModulationSystem_ATSCMH        },
    495     { "DMBTH",     kModulationSystem_DMBTH         },
    496     { "CMMB",      kModulationSystem_CMMB          },
    497     { "DAB",       kModulationSystem_DAB           },
    498     { "TURBO",     kModulationSystem_TURBO         },
    499     { "DVBC_C",    kModulationSystem_DVBC_ANNEX_C  },
    500     { nullptr,     kModulationSystem_UNDEFINED     },
     481    { "UNDEFINED",    kModulationSystem_UNDEFINED     },
     482    { "DVB-C/A",      kModulationSystem_DVBC_ANNEX_A },
     483    { "DVB-C/B",      kModulationSystem_DVBC_ANNEX_B  },
     484    { "DVB-T",        kModulationSystem_DVBT          },
     485    { "DSS",          kModulationSystem_DSS           },
     486    { "DVB-S",        kModulationSystem_DVBS          },
     487    { "DVB-S2",       kModulationSystem_DVBS2         },
     488    { "DVBH",         kModulationSystem_DVBH          },
     489    { "ISDBT",        kModulationSystem_ISDBT         },
     490    { "ISDBS",        kModulationSystem_ISDBS         },
     491    { "ISDBC",        kModulationSystem_ISDBC         },
     492    { "ATSC",         kModulationSystem_ATSC          },
     493    { "ATSCMH",       kModulationSystem_ATSCMH        },
     494    { "DMBTH",        kModulationSystem_DMBTH         },
     495    { "CMMB",         kModulationSystem_CMMB          },
     496    { "DAB",          kModulationSystem_DAB           },
     497    { "DVB-T2",       kModulationSystem_DVBT2         },
     498    { "TURBO",        kModulationSystem_TURBO         },
     499    { "DVB-C/C",      kModulationSystem_DVBC_ANNEX_C  },
     500    { nullptr,        kModulationSystem_UNDEFINED     },
    501501};
    502502
    503503const char *DTVModulationSystem::s_dbStr[DTVModulationSystem::kDBStrCnt] =
    504504{
    505     "UNDEFINED", ///< kModulationSystem_UNDEFINED
    506     "DVBCAC",    ///< kModulationSystem_DVBC_ANNEX_AC
    507     "DVBC_B",    ///< kModulationSystem_DVBC_ANNEX_B
    508     "DVB-T",     ///< kModulationSystem_DVBT
    509     "DSS",       ///< kModulationSystem_DSS
    510     "DVB-S",     ///< kModulationSystem_DVBS
    511     "DVB-S2",    ///< kModulationSystem_DVBS2
    512     "DVBH",      ///< kModulationSystem_DVBH
    513     "ISDBT",     ///< kModulationSystem_ISDBT
    514     "ISDBS",     ///< kModulationSystem_ISDBS
    515     "ISDBC",     ///< kModulationSystem_ISDBC
    516     "ATSC",      ///< kModulationSystem_ATSC
    517     "ATSCMH",    ///< kModulationSystem_ATSCMH
    518     "DMBTH",     ///< kModulationSystem_DMBTH
    519     "CMMB",      ///< kModulationSystem_CMMB
    520     "DAB",       ///< kModulationSystem_DAB
    521     "DVB-T2",    ///< kModulationSystem_DVBT2
    522     "TURBO",     ///< kModulationSystem_TURBO
    523     "DVBC-C",    ///< kModulationSystem_DVBC_ANNEX_C
     505    "UNDEFINED",     ///< kModulationSystem_UNDEFINED
     506    "DVB-C/A",       ///< kModulationSystem_DVBC_ANNEX_A
     507    "DVB-C/B",       ///< kModulationSystem_DVBC_ANNEX_B
     508    "DVB-T",         ///< kModulationSystem_DVBT
     509    "DSS",           ///< kModulationSystem_DSS
     510    "DVB-S",         ///< kModulationSystem_DVBS
     511    "DVB-S2",        ///< kModulationSystem_DVBS2
     512    "DVBH",          ///< kModulationSystem_DVBH
     513    "ISDBT",         ///< kModulationSystem_ISDBT
     514    "ISDBS",         ///< kModulationSystem_ISDBS
     515    "ISDBC",         ///< kModulationSystem_ISDBC
     516    "ATSC",          ///< kModulationSystem_ATSC
     517    "ATSCMH",        ///< kModulationSystem_ATSCMH
     518    "DMBTH",         ///< kModulationSystem_DMBTH
     519    "CMMB",          ///< kModulationSystem_CMMB
     520    "DAB",           ///< kModulationSystem_DAB
     521    "DVB-T2",        ///< kModulationSystem_DVBT2
     522    "TURBO",         ///< kModulationSystem_TURBO
     523    "DVB-C/C",       ///< kModulationSystem_DVBC_ANNEX_C
    524524};
    525525
    526526const DTVParamHelperStruct DTVRollOff::s_confTable[] =
  • mythtv/libs/libmythtv/dtvconfparserhelpers.h

    diff --git a/mythtv/libs/libmythtv/dtvconfparserhelpers.h b/mythtv/libs/libmythtv/dtvconfparserhelpers.h
    index 69111b98de..dd172f1a6c 100644
    a b class DTVModulationSystem : public DTVParamHelper 
    593593    {
    594594        // see fe_delivery_system in frontend.h
    595595        kModulationSystem_UNDEFINED,
    596         kModulationSystem_DVBC_ANNEX_AC,
     596        kModulationSystem_DVBC_ANNEX_A,
    597597        kModulationSystem_DVBC_ANNEX_B,
    598598        kModulationSystem_DVBT,
    599599        kModulationSystem_DSS,
  • mythtv/libs/libmythtv/dtvmultiplex.cpp

    diff --git a/mythtv/libs/libmythtv/dtvmultiplex.cpp b/mythtv/libs/libmythtv/dtvmultiplex.cpp
    index cb1aeb0396..4ae52d4430 100644
    a b bool DTVMultiplex::ParseDVB_T2( 
    270270    QString l_mod_sys = _mod_sys;
    271271    if (_mod_sys == "1")
    272272    {
    273         LOG(VB_GENERAL, LOG_WARNING, LOC + "Invalid T2 modulation system " +
     273        LOG(VB_GENERAL, LOG_WARNING, LOC + "Invalid DVB-T2 modulation system " +
    274274                QString("parameter '%1', using DVB-T2.").arg(_mod_sys));
    275         l_mod_sys = "DVB-T";
     275        l_mod_sys = "DVB-T2";
    276276    }
    277277    else if (_mod_sys == "0")
    278278    {
    279         LOG(VB_GENERAL, LOG_WARNING, LOC + "Invalid T2 modulation system " +
     279        LOG(VB_GENERAL, LOG_WARNING, LOC + "Invalid DVB-T modulation system " +
    280280                QString("parameter '%1', using DVB-T.").arg(_mod_sys));
    281281        l_mod_sys = "DVB-T";
    282282    }
    283283    if (!m_mod_sys.Parse(l_mod_sys))
    284284    {
    285         LOG(VB_GENERAL, LOG_WARNING, LOC + "Invalid T2 modulation system " +
     285        LOG(VB_GENERAL, LOG_WARNING, LOC + "Invalid DVB-T/T2 modulation system " +
    286286                QString("parameter '%1', aborting.").arg(l_mod_sys));
    287287        return false;
    288288    }
    bool DTVMultiplex::ParseTuningParams( 
    343343    }
    344344
    345345    if (DTVTunerType::kTunerTypeATSC == type)
     346    {
    346347        return ParseATSC(_frequency, _modulation);
     348    }
    347349
    348350    LOG(VB_GENERAL, LOG_ERR, LOC +
    349351        QString("ParseTuningParams -- Unknown tuner type = 0x%1")
  • mythtv/libs/libmythtv/recorders/channelbase.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/channelbase.cpp b/mythtv/libs/libmythtv/recorders/channelbase.cpp
    index 882931f3ae..adf08e94d2 100644
    a b bool ChannelBase::InitializeInput(void) 
    562562
    563563    if (!query.exec() || !query.isActive())
    564564    {
    565         MythDB::DBError("InitializeInputs", query);
     565        MythDB::DBError("ChannelBase::InitializeInput", query);
    566566        return false;
    567567    }
    568568    else if (!query.size())
    569569    {
    570         LOG(VB_GENERAL, LOG_ERR, "InitializeInputs(): "
    571             "\n\t\t\tCould not get inputs for the capturecard."
    572             "\n\t\t\tPerhaps you have forgotten to bind video"
    573             "\n\t\t\tsources to your card's inputs?");
     570        LOG(VB_GENERAL, LOG_ERR, LOC +
     571            QString("No capturecard record in database for input %1")
     572            .arg(m_inputid));
    574573        return false;
    575574    }
    576575
    bool ChannelBase::InitializeInput(void) 
    582581    m_externalChanger = query.value(3).toString();
    583582    m_tuneToChannel = query.value(4).toString();
    584583
     584    if (0 == m_sourceid)
     585    {
     586        LOG(VB_GENERAL, LOG_ERR, LOC +
     587            QString("No video source defined for input %1")
     588            .arg(m_inputid));
     589            return false;
     590    }
     591
    585592    m_channels = ChannelUtil::GetChannels(m_sourceid, false);
    586593    QString order = gCoreContext->GetSetting("ChannelOrdering", "channum");
    587594    ChannelUtil::SortChannels(m_channels, order);
  • mythtv/libs/libmythtv/recorders/dtvchannel.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/dtvchannel.cpp b/mythtv/libs/libmythtv/recorders/dtvchannel.cpp
    index 9721a97ca8..92f2f8927c 100644
    a b bool DTVChannel::SetChannelByString(const QString &channum) 
    283283            }
    284284            else
    285285            {
     286                // KdW
     287                LOG(VB_GENERAL, LOG_ERR, loc +
     288                    QString("Initialize multiplex options m_tunerType:%1 mplexid:%2")
     289                        .arg(m_tunerType).arg(mplexid));
     290
    286291                // Try to fix any problems with the multiplex
    287292                CheckOptions(tuning);
    288293
  • mythtv/libs/libmythtv/recorders/dvbchannel.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/dvbchannel.cpp b/mythtv/libs/libmythtv/recorders/dvbchannel.cpp
    index 4cb8bed226..8dcc69c72d 100644
    a b bool DVBChannel::Open(DVBChannel *who) 
    260260        return false;
    261261    }
    262262
    263     m_frontend_name     = info.name;
    264     m_tunerType         = info.type;
    265 #if HAVE_FE_CAN_2G_MODULATION
    266     if (info.caps & FE_CAN_2G_MODULATION)
    267     {
    268         if (m_tunerType == DTVTunerType::kTunerTypeDVBS1)
    269             m_tunerType = DTVTunerType::kTunerTypeDVBS2;
    270         else if (m_tunerType == DTVTunerType::kTunerTypeDVBT)
    271             m_tunerType = DTVTunerType::kTunerTypeDVBT2;
    272     }
    273 #endif // HAVE_FE_CAN_2G_MODULATION
     263    m_frontend_name       = info.name;
    274264    m_capabilities        = info.caps;
    275265    m_frequency_minimum   = info.frequency_min;
    276266    m_frequency_maximum   = info.frequency_max;
    277267    m_symbol_rate_minimum = info.symbol_rate_min;
    278268    m_symbol_rate_maximum = info.symbol_rate_max;
    279269
    280 #if DVB_API_VERSION >=5
    281     unsigned int i;
    282     struct dtv_property prop;
    283     struct dtv_properties cmd;
    284 
    285     memset(&prop, 0, sizeof(prop));
    286     prop.cmd = DTV_API_VERSION;
    287     cmd.num = 1;
    288     cmd.props = &prop;
    289     if (ioctl(m_fd_frontend, FE_GET_PROPERTY, &cmd) == 0)
    290     {
    291         LOG(VB_RECORD, LOG_INFO, LOC +
    292             QString("dvb api version %1.%2").arg((prop.u.data>>8)&0xff).arg((prop.u.data)&0xff));
    293     }
    294 
    295     memset(&prop, 0, sizeof(prop));
    296     prop.cmd = DTV_ENUM_DELSYS;
    297     cmd.num = 1;
    298     cmd.props = &prop;
    299 
    300     if (ioctl(m_fd_frontend, FE_GET_PROPERTY, &cmd) == 0)
    301     {
    302         LOG(VB_RECORD, LOG_DEBUG, LOC +
    303             QString("num props %1").arg(prop.u.buffer.len));
    304         for (i = 0; i < prop.u.buffer.len; i++)
    305         {
    306             LOG(VB_RECORD, LOG_INFO, LOC +
    307                 QString("delsys %1: %2 %3")
    308                     .arg(i).arg(prop.u.buffer.data[i])
    309                     .arg(DTVModulationSystem::toString(prop.u.buffer.data[i])));
    310             switch (prop.u.buffer.data[i])
    311             {
    312                 // TODO: not supported. you can have DVBC and DVBT on the same card
    313                 // The following are backwards compatible so its ok
    314                 case SYS_DVBS2:
    315                     m_tunerType = DTVTunerType::kTunerTypeDVBS2;
    316                     break;
    317                 case SYS_DVBT2:
    318                     m_tunerType = DTVTunerType::kTunerTypeDVBT2;
    319                     break;
    320                 default:
    321                     break;
    322             }
    323         }
    324     }
    325 #endif
     270    CardUtil::SetDeliverySystem(m_inputid, m_fd_frontend);
     271    m_tunerType = CardUtil::GetTunerType(m_inputid);
    326272
    327273    LOG(VB_RECORD, LOG_INFO, LOC +
    328         QString("Using DVB card %1, with frontend '%2'.")
    329             .arg(m_device).arg(m_frontend_name));
     274        QString("Frontend '%2' tunertype:%3 %4")
     275            .arg(m_frontend_name).arg(m_tunerType).arg(m_tunerType.toString()));
    330276
    331277    // Turn on the power to the LNB
    332278    if (m_tunerType.IsDiSEqCSupported())
    bool DVBChannel::Open(DVBChannel *who) 
    366312
    367313bool DVBChannel::IsOpen(void) const
    368314{
    369     //Have to acquire the hw lock to prevent is_open being modified whilst we're searching it
     315    // Have to acquire the hw lock to prevent is_open being modified whilst we're searching it
    370316    QMutexLocker locker(&m_hw_lock);
    371317    IsOpenMap::const_iterator it = m_is_open.find(this);
    372318    return it != m_is_open.end();
    bool DVBChannel::HasLock(bool *ok) const 
    10781024    fe_status_t status;
    10791025    memset(&status, 0, sizeof(status));
    10801026
     1027    // KdW test
     1028    {
     1029        struct dvb_frontend_info info;
     1030        memset(&info, 0, sizeof(info));
     1031        int err = ioctl(m_fd_frontend, FE_GET_INFO, &info);
     1032        if (err < 0)
     1033        {
     1034            LOG(VB_GENERAL, LOG_ERR, LOC +
     1035                QString("FE_GET_INFO failed fd:%1")
     1036                    .arg(m_fd_frontend) + ENO);
     1037        }
     1038    }
     1039
    10811040    int ret = ioctl(m_fd_frontend, FE_READ_STATUS, &status);
    10821041    if (ret < 0)
    10831042    {
    10841043        LOG(VB_GENERAL, LOG_ERR, LOC +
    1085             "Getting Frontend status failed." + ENO);
     1044            "FE_READ_STATUS failed" + ENO);
    10861045    }
    10871046
    10881047    if (ok)
  • mythtv/libs/libmythtv/transporteditor.cpp

    diff --git a/mythtv/libs/libmythtv/transporteditor.cpp b/mythtv/libs/libmythtv/transporteditor.cpp
    index 56b21e046f..4ce6f938d5 100644
    a b void TransportListEditor::Load() 
    263263                type = "(DVB-S)";
    264264            if (CardUtil::QAM == m_cardtype)
    265265                type = "(DVB-C)";
     266            if (CardUtil::DVBS2 == m_cardtype)
     267                type = "(DVB-S2)";
    266268
    267269            QString txt = QString("%1 %2 %3 %4 %5 %6 %7")
    268270                .arg(mod).arg(query.value(2).toString())
  • mythtv/libs/libmythtv/videosource.cpp

    diff --git a/mythtv/libs/libmythtv/videosource.cpp b/mythtv/libs/libmythtv/videosource.cpp
    index 826bd657cf..af6b459ba2 100644
    a b class DVBCardNum : public CaptureCardComboBoxSetting 
    10311031    }
    10321032};
    10331033
    1034 class DVBCardType : public GroupSetting
     1034// KdW change DVBCardType from subtype to delivery system
     1035//
     1036// NOTE: use column capturecard/inputname to store the delivery system selection in the database
     1037// If this does conflict with other use of this field then a new column, e.g. "deliverysystem",
     1038// must be added to table capturecard
     1039// Changed GroupSetting into CaptureCardComboBoxSetting
     1040//
     1041class DVBCardType : public CaptureCardComboBoxSetting                   // KdW was: public GroupSetting
    10351042{
    10361043  public:
    1037     DVBCardType()
     1044    explicit DVBCardType(const CaptureCard &parent) :
     1045        CaptureCardComboBoxSetting(parent, false, "inputname")          // KdW false means no "New entry"
    10381046    {
    1039         setLabel(QObject::tr("Subtype"));
    1040         setEnabled(false);
     1047        setLabel(QObject::tr("Delivery system"));                       // KdW was: Subtype
     1048        setHelpText(
     1049            QObject::tr("If your card supports more than one delivery system "
     1050                        "then you can select here the one that you want to use."));
     1051
     1052        // setEnabled(false);
    10411053    };
    10421054};
    10431055
    void DVBConfigurationGroup::probeCard(const QString &videodevice) 
    37103722        default:
    37113723            break;
    37123724    }
     3725
     3726    // Create selection list of all delivery systems of this card
     3727    {
     3728        m_cardType->clearSelections();
     3729        QStringList delsys = CardUtil::ProbeDeliverySystems(videodevice);
     3730        QStringList::iterator it = delsys.begin();
     3731        if (it != delsys.end())
     3732        {
     3733            m_cardType->setValue(*it);
     3734        }
     3735        for (; it != delsys.end(); it++)
     3736        {
     3737            LOG(VB_GENERAL, LOG_INFO, QString("DVBCardType: add deliverysystem:%1")
     3738                .arg(*it));
     3739
     3740            m_cardType->addSelection(*it, *it);
     3741        }
     3742    }
     3743#
    37133744#else
    37143745    m_cardType->setValue(QString("Recompile with DVB-Support!"));
    37153746#endif
    DVBConfigurationGroup::DVBConfigurationGroup(CaptureCard& a_parent, 
    37593790
    37603791    m_cardNum  = new DVBCardNum(m_parent);
    37613792    m_cardName = new DVBCardName();
    3762     m_cardType = new DVBCardType();
     3793    m_cardType = new DVBCardType(m_parent);
    37633794
    37643795    m_signalTimeout = new SignalTimeout(m_parent, 500, 250);
    37653796    m_channelTimeout = new ChannelTimeout(m_parent, 3000, 1750);