Ticket #7003: 7003-v2.patch

File 7003-v2.patch, 39.6 KB (added by danielk, 15 years ago)
  • libs/libmythtv/dtvconfparserhelpers.h

     
    7272    static const DTVParamHelperStruct parseTable[];
    7373
    7474  public:
    75     enum
     75    typedef enum
    7676    {
    77         kTunerTypeQPSK    = 0,
    78         kTunerTypeQAM     = 1,
    79         kTunerTypeOFDM    = 2,
    80         kTunerTypeATSC    = 3,
    81         kTunerTypeDVB_S2  = (1 << 5),
    82         kTunerTypeUnknown = (1 << 31),
    83     };
     77        //                           Modulations which may be supported
     78        kTunerTypeDVBS1   = 0x00, // QPSK
     79        kTunerTypeDVBS2   = 0x20, // QPSK, 8PSK, 16APSK, 32APSK
     80        kTunerTypeDVBC    = 0x01, // QAM-64, QAM-256
     81        kTunerTypeDVBT    = 0x02, // OFDM
     82        kTunerTypeATSC    = 0x03, // 8-VSB, 16-VSB, QAM-16, QAM-64, QAM-256, QPSK
     83        kTunerTypeUnknown = 0x80000000,
    8484
     85        // Note: Just because some cards sold in different regions support the same
     86        // modulation scheme does not mean that they decode the same signals, there
     87        // are also region specific FEC algorithms and the tuner which precedes the
     88        // demodulator may be limited to frequencies used in that specific market.
     89        // The tuner may also be bandwidth limited to 6 or 7 Mhz, so it could not
     90        // support the 8 Mhz channels used in some contries, and/or the ADC which
     91        // sits between the tuner and the demodulator may be bandwidth limited.
     92        // While often the same hardware could physically support more than it
     93        // is designed for the card/device maker does not write the firmware
     94        // but licenses blocks of it and so only selects the pieces absolutely
     95        // necessary for their market segment. Some ATSC cards only supported
     96        // 8-VSB, newer cards don't support the unpopular 16-VSB, no consumer
     97        // card supports the QAM-16 or QPSK used for USA Cable PSIP, etc.
     98        // DVB-S cards also generally support DiSEqC signaling, and future
     99        // ATSC cards may support similar but incompatible signalling for
     100        // pointable antennas.
     101        //
     102        // Note 2: These values are keyed to the Linux DVB driver values, in
     103        // reality some hardware does support multiple formats and this should
     104        // be a mask. Also the transmission schemes used in Asia and South
     105        // America are not represented here.
     106    } my_enum;
     107
     108    bool operator==(const my_enum& v) const { return value == (int) v; }
     109
    85110    DTVTunerType(int _default = kTunerTypeUnknown)
    86111        : DTVParamHelper(_default) { initStr(); }
    87112
     
    90115
    91116    bool IsFECVariable(void) const
    92117    {
    93         return ((kTunerTypeQPSK   == value) ||
    94                 (kTunerTypeQAM    == value) ||
    95                 (kTunerTypeDVB_S2 == value));
     118        return ((kTunerTypeDVBC  == value) ||
     119                (kTunerTypeDVBS1 == value) ||
     120                (kTunerTypeDVBS2 == value));
    96121    }
    97122
    98123    bool IsModulationVariable(void) const
    99124    {
    100         return ((DTVTunerType::kTunerTypeQAM    == value) ||
    101                 (DTVTunerType::kTunerTypeATSC   == value) ||
    102                 (DTVTunerType::kTunerTypeDVB_S2 == value));
     125        return ((kTunerTypeDVBC  == value) ||
     126                (kTunerTypeATSC  == value) ||
     127                (kTunerTypeDVBS2 == value));
    103128    }
    104129
     130    bool IsDiSEqCSupported(void) const
     131    {
     132        return ((kTunerTypeDVBS1 == value) ||
     133                (kTunerTypeDVBS2 == value));
     134    }
     135
    105136    QString toString() const { return toString(value); }
    106137
    107138    static void initStr(void);
  • libs/libmythtv/channelscan/channelscan_sm.h

     
    4646#include "streamlisteners.h"
    4747#include "scanmonitor.h"
    4848#include "signalmonitorlistener.h"
     49#include "dtvconfparserhelpers.h" // for DTVTunerType
    4950
    5051class MSqlQuery;
    5152
     
    114115    void SetSourceID(int _SourceID)   { sourceID                = _SourceID; }
    115116    void SetSignalTimeout(uint val)    { signalTimeout = val; }
    116117    void SetChannelTimeout(uint val)   { channelTimeout = val; }
     118    void SetScanDTVTunerType(DTVTunerType t) { scanDTVTunerType = t; }
    117119
    118120    uint GetSignalTimeout(void)  const { return signalTimeout; }
    119121    uint GetChannelTimeout(void) const { return channelTimeout; }
     
    147149  private:
    148150    // some useful gets
    149151    DTVChannel       *GetDTVChannel(void);
     152    const DTVChannel *GetDTVChannel(void) const;
    150153    V4LChannel       *GetV4LChannel(void);
    151154    HDHRChannel      *GetHDHRChannel(void);
    152155    DVBChannel       *GetDVBChannel(void);
     
    162165    bool Tune(const transport_scan_items_it_t transport);
    163166    uint InsertMultiplex(const transport_scan_items_it_t transport);
    164167    void ScanTransport(const transport_scan_items_it_t transport);
     168    DTVTunerType GuessDTVTunerType(DTVTunerType) const;
    165169
    166170    /// \brief Updates Transport Scan progress bar
    167171    inline void UpdateScanPercentCompleted(void);
     
    203207    bool              m_test_decryption;
    204208    bool              extend_scan_list;
    205209
     210    // Optional info
     211    DTVTunerType      scanDTVTunerType;
     212
    206213    // State
    207214    bool              scanning;
    208215    bool              threadExit;
  • libs/libmythtv/channelscan/channelimporter.cpp

     
    667667    if (!transports.empty())
    668668        tuner_type = transports[0].tuner_type;
    669669
    670     bool is_dvbs =
    671         (DTVTunerType::kTunerTypeQPSK   == tuner_type) ||
    672         (DTVTunerType::kTunerTypeDVB_S2 == tuner_type);
     670    bool is_dvbs = ((DTVTunerType::kTunerTypeDVBS1 == tuner_type) ||
     671                    (DTVTunerType::kTunerTypeDVBS2 == tuner_type));
    673672
    674673    uint freq_mult = (is_dvbs) ? 1 : 1000;
    675674
     
    761760        tuner_type = transports[0].tuner_type;
    762761
    763762    bool is_dvbs =
    764         (DTVTunerType::kTunerTypeQPSK  == tuner_type) ||
    765         (DTVTunerType::kTunerTypeDVB_S2 == tuner_type);
     763        (DTVTunerType::kTunerTypeDVBS1 == tuner_type) ||
     764        (DTVTunerType::kTunerTypeDVBS2 == tuner_type);
    766765
    767766    uint freq_mult = (is_dvbs) ? 1 : 1000;
    768767
  • libs/libmythtv/channelscan/channelscan_sm.cpp

     
    3131#include <pthread.h>
    3232#include <unistd.h>
    3333
     34// C++ includes
     35#include <algorithm>
     36using namespace std;
     37
    3438// Qt includes
    3539#include <QMutex>
    3640
     
    145149      inputname(_inputname),
    146150      m_test_decryption(test_decryption),
    147151      extend_scan_list(false),
     152      // Optional state
     153      scanDTVTunerType(DTVTunerType::kTunerTypeUnknown),
    148154      // State
    149155      scanning(false),
    150156      threadExit(false),
     
    487493    return false;
    488494}
    489495
     496DTVTunerType ChannelScanSM::GuessDTVTunerType(DTVTunerType type) const
     497{
     498    if (scanDTVTunerType != DTVTunerType::kTunerTypeUnknown)
     499        type = scanDTVTunerType;
     500
     501    const DTVChannel *chan = GetDTVChannel();
     502
     503    if (!chan)
     504        return type;
     505
     506    vector<DTVTunerType> tts = chan->GetTunerTypes();
     507
     508    for (uint i = 0; i < tts.size(); ++i)
     509    {
     510        if (tts[i] == type)
     511            return type;
     512    }
     513
     514    if (tts.size() > 0)
     515        return tts[0];
     516
     517    return type;
     518}
     519
    490520void ChannelScanSM::UpdateScanTransports(const NetworkInformationTable *nit)
    491521{
    492522    for (uint i = 0; i < nit->TransportStreamCount(); ++i)
     
    508538            uint64_t frequency = 0;
    509539            const MPEGDescriptor desc(list[j]);
    510540            uint tag = desc.DescriptorTag();
     541            DTVTunerType tt = DTVTunerType::kTunerTypeUnknown;
    511542
    512543            switch (tag)
    513544            {
    514             case DescriptorID::terrestrial_delivery_system:
    515             {
    516                 const TerrestrialDeliverySystemDescriptor cd(desc);
    517                 frequency = cd.FrequencyHz();
    518                 break;
     545                case DescriptorID::terrestrial_delivery_system:
     546                {
     547                    const TerrestrialDeliverySystemDescriptor cd(desc);
     548                    frequency = cd.FrequencyHz();
     549                    tt = DTVTunerType::kTunerTypeDVBT;
     550                    break;
     551                }
     552                case DescriptorID::satellite_delivery_system:
     553                {
     554                    const SatelliteDeliverySystemDescriptor cd(desc);
     555                    frequency = cd.FrequencyHz()/1000;
     556                    tt = DTVTunerType::kTunerTypeDVBS1;
     557                    break;
     558                }
     559                case DescriptorID::cable_delivery_system:
     560                {
     561                    const CableDeliverySystemDescriptor cd(desc);
     562                    frequency = cd.FrequencyHz();
     563                    tt = DTVTunerType::kTunerTypeDVBC;
     564                    break;
     565                }
     566                default:
     567                    VERBOSE(VB_CHANSCAN, LOC +
     568                            "unknown delivery system descriptor");
     569                    continue;
    519570            }
    520             case DescriptorID::satellite_delivery_system:
    521             {
    522                 const SatelliteDeliverySystemDescriptor cd(desc);
    523                 frequency = cd.FrequencyHz()/1000;
    524                 break;
    525             }
    526             case DescriptorID::cable_delivery_system:
    527             {
    528                 const CableDeliverySystemDescriptor cd(desc);
    529                 frequency = cd.FrequencyHz();
    530                 break;
    531             }
    532             default:
    533                 VERBOSE(VB_CHANSCAN, LOC + "unknown delivery system descriptor");
    534                 continue;
    535             }
    536571
    537572            mplexid = ChannelUtil::GetMplexID(sourceID, frequency, tsid, netid);
     573            mplexid = max(0, mplexid);
    538574
     575            tt = GuessDTVTunerType(tt);
     576
    539577            DTVMultiplex tuning;
    540             if (mplexid > 0)
     578            if (mplexid)
    541579            {
    542                 if (!tuning.FillFromDB(GetDVBChannel()->GetCardType(), mplexid))
     580                if (!tuning.FillFromDB(tt, mplexid))
    543581                    continue;
    544582            }
    545             else if (!tuning.FillFromDeliverySystemDesc(GetDVBChannel()->GetCardType(), desc))
     583            else if (!tuning.FillFromDeliverySystemDesc(tt, desc))
     584            {
    546585                continue;
     586            }
    547587
    548588            extend_transports[id] = tuning;
    549589            break;
     
    11261166
    11271167    uint cardid = channel->GetCardID();
    11281168
    1129     DTVTunerType tuner_type = DTVTunerType::kTunerTypeATSC;
    1130     if (GetDVBChannel())
    1131         tuner_type = GetDVBChannel()->GetCardType();
     1169    DTVTunerType tuner_type = GuessDTVTunerType(DTVTunerType::kTunerTypeATSC);
    11321170
    11331171    ChannelList::const_iterator it = channelList.begin();
    11341172    for (; it != channelList.end(); ++it)
    11351173    {
    1136         QMap<uint,ChannelInsertInfo> pnum_to_dbchan = GetChannelList(it->first, it->second);
     1174        QMap<uint,ChannelInsertInfo> pnum_to_dbchan =
     1175            GetChannelList(it->first, it->second);
    11371176
    1138         // Insert channels into DB
    11391177        ScanDTVTransport item((*it->first).tuning, tuner_type, cardid);
    11401178
    11411179        QMap<uint,ChannelInsertInfo>::iterator dbchan_it;
     
    11711209    return dynamic_cast<DTVChannel*>(channel);
    11721210}
    11731211
     1212const DTVChannel *ChannelScanSM::GetDTVChannel(void) const
     1213{
     1214    return dynamic_cast<const DTVChannel*>(channel);
     1215}
     1216
    11741217HDHRChannel *ChannelScanSM::GetHDHRChannel(void)
    11751218{
    11761219#ifdef USING_HDHOMERUN
     
    16931736    uint    sourceid   = query.value(0).toUInt();
    16941737    QString sistandard = query.value(1).toString();
    16951738    uint    tsid       = query.value(2).toUInt();
     1739    DTVTunerType tt = DTVTunerType::kTunerTypeUnknown;
    16961740
    16971741    QString fn = (tsid) ? QString("Transport ID %1").arg(tsid) :
    16981742        QString("Multiplex #%1").arg(mplexid);
     1743
    16991744    if (query.value(4).toString() == "8vsb")
    17001745    {
    17011746        QString chan = QString("%1 Hz").arg(query.value(3).toInt());
     
    17111756            }
    17121757        }
    17131758        fn = QObject::tr("ATSC Channel %1").arg(chan);
     1759        tt = DTVTunerType::kTunerTypeATSC;
    17141760    }
    17151761
     1762    tt = GuessDTVTunerType(tt);
     1763
    17161764    TransportScanItem item(sourceid, sistandard, fn, mplexid, signalTimeout);
    17171765
    1718     bool ok = false;
    1719     if (GetDVBChannel())
    1720         ok = item.tuning.FillFromDB(GetDVBChannel()->GetCardType(), mplexid);
    1721     else if (GetHDHRChannel())
    1722         ok = item.tuning.FillFromDB(DTVTunerType::kTunerTypeATSC, mplexid);
    1723 
    1724     if (ok)
     1766    if (item.tuning.FillFromDB(tt, mplexid))
    17251767    {
    17261768        VERBOSE(VB_CHANSCAN, LOC + "Adding " + fn);
    17271769        scanTransports.push_back(item);
     1770        return true;
    17281771    }
    1729     else
    1730     {
    1731         VERBOSE(VB_CHANSCAN, LOC + "Not adding incomplete transport " + fn);
    1732     }
    17331772
    1734     return ok;
     1773    VERBOSE(VB_CHANSCAN, LOC + "Not adding incomplete transport " + fn);
     1774    return false;
    17351775}
    17361776
    17371777bool ChannelScanSM::ScanTransport(uint mplexid, bool follow_nit)
  • libs/libmythtv/channelscan/channelscanner.cpp

     
    376376        signal_timeout, channel_timeout, inputname,
    377377        do_test_decryption);
    378378
     379    // If we know the channel types we can give the signal montior a hint.
     380    // Since we unfortunately do not record this info in the DB, we can not
     381    // do this for the other scan types and have to guess later on...
     382    switch (scantype)
     383    {
     384        case ScanTypeSetting::FullScan_ATSC:
     385            sigmonScanner->SetScanDTVTunerType(DTVTunerType::kTunerTypeATSC);
     386            break;
     387        case ScanTypeSetting::FullScan_DVBC:
     388            sigmonScanner->SetScanDTVTunerType(DTVTunerType::kTunerTypeDVBC);
     389            break;
     390        case ScanTypeSetting::FullScan_DVBT:
     391            sigmonScanner->SetScanDTVTunerType(DTVTunerType::kTunerTypeDVBT);
     392            break;
     393        case ScanTypeSetting::NITAddScan_DVBT:
     394            sigmonScanner->SetScanDTVTunerType(DTVTunerType::kTunerTypeDVBT);
     395            break;
     396        case ScanTypeSetting::NITAddScan_DVBS:
     397            sigmonScanner->SetScanDTVTunerType(DTVTunerType::kTunerTypeDVBS1);
     398            break;
     399        case ScanTypeSetting::NITAddScan_DVBS2:
     400            sigmonScanner->SetScanDTVTunerType(DTVTunerType::kTunerTypeDVBS2);
     401            break;
     402        case ScanTypeSetting::NITAddScan_DVBC:
     403            sigmonScanner->SetScanDTVTunerType(DTVTunerType::kTunerTypeDVBC);
     404            break;
     405        default:
     406            break;
     407    }
     408
    379409    // Signal Meters are connected here
    380410    SignalMonitor *mon = sigmonScanner->GetSignalMonitor();
    381411    if (mon)
  • libs/libmythtv/dtvconfparserhelpers.cpp

     
    4343void DTVTunerType::initStr(void)
    4444{
    4545    QMutexLocker locker(&dtv_tt_canonical_str_lock);
    46     dtv_tt_canonical_str[kTunerTypeQPSK]    = "QPSK";
    47     dtv_tt_canonical_str[kTunerTypeQAM]     = "QAM";
    48     dtv_tt_canonical_str[kTunerTypeOFDM]    = "OFDM";
    4946    dtv_tt_canonical_str[kTunerTypeATSC]    = "ATSC";
    50     dtv_tt_canonical_str[kTunerTypeDVB_S2]  = "DVB_S2";
     47    dtv_tt_canonical_str[kTunerTypeDVBT]    = "QPSK";
     48    dtv_tt_canonical_str[kTunerTypeDVBC]    = "QAM";
     49    dtv_tt_canonical_str[kTunerTypeDVBS1]   = "DVBS";
     50    dtv_tt_canonical_str[kTunerTypeDVBS2]   = "DVB_S2";
    5151    dtv_tt_canonical_str[kTunerTypeUnknown] = "UNKNOWN";
    5252}
    5353
     
    6262
    6363const DTVParamHelperStruct DTVTunerType::parseTable[] =
    6464{
    65     { "QPSK",    kTunerTypeQPSK    },
    66     { "QAM",     kTunerTypeQAM     },
    67     { "OFDM",    kTunerTypeOFDM    },
     65    { "QPSK",    kTunerTypeDVBS1   },
     66    { "QAM",     kTunerTypeDVBC    },
     67    { "OFDM",    kTunerTypeDVBT    },
    6868    { "ATSC",    kTunerTypeATSC    },
    69     { "DVB_S2",  kTunerTypeDVB_S2  },
     69    { "DVB_S2",  kTunerTypeDVBS2   },
    7070    { "UNKNOWN", kTunerTypeUnknown },
    7171    { NULL,      kTunerTypeUnknown },
    7272};
  • libs/libmythtv/dtvmultiplex.h

     
    7878    DTVBandwidth     bandwidth;
    7979    DTVCodeRate      hp_code_rate;  ///< High Priority FEC rate
    8080    DTVCodeRate      lp_code_rate;  ///< Low Priority FEC rate
    81     //DTVModulation    constellation; ///< Modulation for OFDM, TODO Remove
    8281    DTVModulation    modulation;
    8382    DTVTransmitMode  trans_mode;
    8483    DTVGuardInterval guard_interval;
  • libs/libmythtv/hdhrstreamhandler.cpp

     
    562562
    563563bool HDHRStreamHandler::Open(void)
    564564{
    565     return Connect();
     565    if (Connect())
     566    {
     567        const char *model = hdhomerun_device_get_model_str(_hdhomerun_device);
     568        _tuner_types.clear();
     569        if (QString(model).toLower().contains("dvb"))
     570        {
     571            _tuner_types.push_back(DTVTunerType::kTunerTypeDVBT);
     572            _tuner_types.push_back(DTVTunerType::kTunerTypeDVBC);
     573        }
     574        else
     575        {
     576            _tuner_types.push_back(DTVTunerType::kTunerTypeATSC);
     577        }
     578
     579        return true;
     580    }
     581    return false;
    566582}
    567583
    568584void HDHRStreamHandler::Close(void)
  • libs/libmythtv/hdhrchannel.cpp

     
    3535#define LOC_ERR QString("HDHRChan(%1), Error: ").arg(GetDevice())
    3636
    3737HDHRChannel::HDHRChannel(TVRec *parent, const QString &device)
    38     : DTVChannel(parent),       _stream_handler(NULL),
    39       _device_id(device),       _lock(QMutex::Recursive),
    40       tune_lock(QMutex::Recursive),
    41       hw_lock(QMutex::Recursive)
     38    : DTVChannel(parent),
     39      _device_id(device),           _stream_handler(NULL),
     40      _lock(QMutex::Recursive),
     41      tune_lock(QMutex::Recursive), hw_lock(QMutex::Recursive)
    4242{
    4343}
    4444
     
    5858
    5959    _stream_handler = HDHRStreamHandler::Get(_device_id);
    6060
     61    _tuner_types = _stream_handler->GetTunerTypes();
     62    tunerType = (_tuner_types.empty()) ?
     63        DTVTunerType::kTunerTypeUnknown : _tuner_types[0];
     64
    6165    if (!InitializeInputs())
    6266    {
    6367        Close();
  • libs/libmythtv/dvbchannel.h

     
    88#ifndef DVBCHANNEL_H
    99#define DVBCHANNEL_H
    1010
    11 #include <qobject.h>
    12 #include <qstring.h>
    13 #include <qmap.h>
     11#include <QObject>
     12#include <QString>
     13#include <QMap>
    1414
    1515#include "mythcontext.h"
    1616#include "mythdbcon.h"
    1717#include "dtvchannel.h"
     18#include "dtvconfparserhelpers.h" // for DTVTunerType
    1819#include "streamlisteners.h"
    1920#include "diseqc.h"
    2021
     
    5253    QString GetCardNum(void)            const { return device; };
    5354    /// Returns frontend name as reported by driver
    5455    QString GetFrontendName(void)       const;
    55     DTVTunerType GetCardType(void)      const { return card_type; }
    5656    bool IsMaster(void)                 const { return master == NULL; }
    5757    /// Returns true iff we have a faulty DVB driver that munges PMT
    5858    bool HasCRCBug(void)                const { return has_crc_bug; }
     
    115115
    116116    // Device info
    117117    QString           frontend_name;
    118     DTVTunerType      card_type;
    119118    uint64_t          capabilities;
    120119    uint64_t          ext_modulations;
    121120    uint64_t          frequency_minimum;
  • libs/libmythtv/dtvchannel.h

     
    2020
    2121// MythTV headers
    2222#include "channelbase.h"
     23#include "dtvconfparserhelpers.h" // for DTVTunerType
    2324
    2425typedef pair<uint,uint> pid_cache_item_t;
    2526typedef vector<pid_cache_item_t> pid_cache_t;
     
    7576    /// \brief Returns tuning mode last set by SetTuningMode().
    7677    QString GetTuningMode(void) const;
    7778
     79    /// \brief Returns a vector of supported tuning types.
     80    virtual vector<DTVTunerType> GetTunerTypes(void) const;
     81
    7882    /** \brief Returns cached MPEG PIDs for last tuned channel.
    7983     *  \param pid_cache List of PIDs with their TableID
    8084     *                   types is returned in pid_cache.
     
    110114  protected:
    111115    mutable QMutex dtvinfo_lock;
    112116
     117    DTVTunerType tunerType;
    113118    QString sistandard; ///< PSIP table standard: MPEG, DVB, ATSC, OpenCable
    114119    QString tuningMode;
    115120    int     currentProgramNum;
  • libs/libmythtv/dvbchannel.cpp

     
    7070      // Helper classes
    7171      diseqc_tree(NULL),            dvbcam(NULL),
    7272      // Device info
    73       frontend_name(QString::null), card_type(DTVTunerType::kTunerTypeUnknown),
     73      frontend_name(QString::null),
    7474      // Tuning
    7575      tune_lock(),                  hw_lock(),
    7676      last_lnb_dev_id(-1),
     
    166166
    167167        fd_frontend         = master->fd_frontend;
    168168        frontend_name       = master->frontend_name;
    169         card_type           = master->card_type;
     169        tunerType           = master->tunerType;
    170170        capabilities        = master->capabilities;
    171171        ext_modulations     = master->ext_modulations;
    172172        frequency_minimum   = master->frequency_minimum;
     
    212212    }
    213213
    214214    frontend_name       = info.name;
    215     card_type           = info.type;
     215    tunerType           = info.type;
    216216#if HAVE_FE_CAN_2G_MODULATION
    217     if (card_type == DTVTunerType::kTunerTypeQPSK &&
     217    if (tunerType == DTVTunerType::kTunerTypeDVBS1 &&
    218218        (info.caps & FE_CAN_2G_MODULATION))
    219         card_type = DTVTunerType::kTunerTypeDVB_S2;
     219        tunerType = DTVTunerType::kTunerTypeDVBS2;
    220220#endif // HAVE_FE_CAN_2G_MODULATION
    221221    capabilities        = info.caps;
    222222    frequency_minimum   = info.frequency_min;
     
    228228            .arg(device).arg(frontend_name));
    229229
    230230    // Turn on the power to the LNB
    231     if (card_type == DTVTunerType::kTunerTypeQPSK ||
    232         card_type == DTVTunerType::kTunerTypeDVB_S2)
     231    if (tunerType.IsDiSEqCSupported())
    233232    {
    234233        diseqc_tree = diseqc_dev.FindTree(GetCardID());
    235234        if (diseqc_tree)
     
    272271bool DVBChannel::TuneMultiplex(uint mplexid, QString inputname)
    273272{
    274273    DTVMultiplex tuning;
    275     if (!tuning.FillFromDB(card_type, mplexid))
     274    if (!tuning.FillFromDB(tunerType, mplexid))
    276275        return false;
    277276
    278277    CheckOptions(tuning);
     
    354353
    355354    // Initialize basic the tuning parameters
    356355    DTVMultiplex tuning;
    357     if (!mplexid || !tuning.FillFromDB(card_type, mplexid))
     356    if (!mplexid || !tuning.FillFromDB(tunerType, mplexid))
    358357    {
    359358        VERBOSE(VB_IMPORTANT, loc_err +
    360359                "Failed to initialize multiplex options");
     
    457456                .arg(frequency_minimum).arg(frequency_maximum));
    458457    }
    459458
    460     if (card_type.IsFECVariable() &&
     459    if (tunerType.IsFECVariable() &&
    461460        symbol_rate_minimum && symbol_rate_maximum &&
    462461        (symbol_rate_minimum <= symbol_rate_maximum) &&
    463462        (tuning.symbolrate < symbol_rate_minimum ||
     
    470469                .arg(symbol_rate_minimum).arg(symbol_rate_maximum));
    471470    }
    472471
    473     if (card_type.IsFECVariable() && !CheckCodeRate(tuning.fec))
     472    if (tunerType.IsFECVariable() && !CheckCodeRate(tuning.fec))
    474473    {
    475474        VERBOSE(VB_GENERAL, LOC_WARN + "Unsupported fec_inner parameter.");
    476475    }
    477476
    478     if (card_type.IsModulationVariable() && !CheckModulation(tuning.modulation))
     477    if (tunerType.IsModulationVariable() && !CheckModulation(tuning.modulation))
    479478    {
    480479        VERBOSE(VB_GENERAL, LOC_WARN + "Unsupported modulation parameter.");
    481480    }
    482481
    483     if (DTVTunerType::kTunerTypeOFDM != card_type)
     482    if (DTVTunerType::kTunerTypeDVBT != tunerType)
    484483    {
    485484        VERBOSE(VB_CHANNEL, LOC + tuning.toString());
    486485        return;
     
    614613    uint c = 0;
    615614    struct dtv_properties *cmdseq;
    616615
    617     if (tuner_type != DTVTunerType::kTunerTypeDVB_S2 &&
    618         tuner_type != DTVTunerType::kTunerTypeOFDM   &&
    619         tuner_type != DTVTunerType::kTunerTypeQAM    &&
    620         tuner_type != DTVTunerType::kTunerTypeQPSK)
     616    if (tuner_type != DTVTunerType::kTunerTypeDVBT &&
     617        tuner_type != DTVTunerType::kTunerTypeDVBC  &&
     618        tuner_type != DTVTunerType::kTunerTypeDVBS1 &&
     619        tuner_type != DTVTunerType::kTunerTypeDVBS2)
    621620    {
    622621        VERBOSE(VB_IMPORTANT, "Unsupported tuner type " + tuner_type.toString());
    623622        return NULL;
     
    639638    if (tuning.mod_sys == DTVModulationSystem::kModulationSystem_DVBS2)
    640639        can_fec_auto = false;
    641640
    642     if (tuner_type == DTVTunerType::kTunerTypeDVB_S2)
     641    if (tuner_type == DTVTunerType::kTunerTypeDVBS2)
    643642    {
    644643        cmdseq->props[c].cmd      = DTV_DELIVERY_SYSTEM;
    645644        cmdseq->props[c++].u.data = tuning.mod_sys;
     
    652651    cmdseq->props[c].cmd      = DTV_INVERSION;
    653652    cmdseq->props[c++].u.data = tuning.inversion;
    654653
    655     if (tuner_type == DTVTunerType::kTunerTypeQPSK  ||
    656         tuner_type == DTVTunerType::kTunerTypeDVB_S2 ||
    657         tuner_type == DTVTunerType::kTunerTypeQAM)
     654    if (tuner_type == DTVTunerType::kTunerTypeDVBS1 ||
     655        tuner_type == DTVTunerType::kTunerTypeDVBS2 ||
     656        tuner_type == DTVTunerType::kTunerTypeDVBC)
    658657    {
    659658        cmdseq->props[c].cmd      = DTV_SYMBOL_RATE;
    660659        cmdseq->props[c++].u.data = tuning.symbolrate;
     
    666665        cmdseq->props[c++].u.data = can_fec_auto ? FEC_AUTO : tuning.fec;
    667666    }
    668667
    669     if (tuner_type == DTVTunerType::kTunerTypeOFDM)
     668    if (tuner_type == DTVTunerType::kTunerTypeDVBT)
    670669    {
    671670        cmdseq->props[c].cmd      = DTV_BANDWIDTH_HZ;
    672671        cmdseq->props[c++].u.data = (8-tuning.bandwidth) * 1000000;
     
    706705
    707706
    708707/*****************************************************************************
    709            Tuning functions for each of the four types of cards.
     708           Tuning functions for each of the five types of cards.
    710709 *****************************************************************************/
    711710
    712711/**
     
    739738    bool can_fec_auto = false;
    740739    bool reset = (force_reset || first_tune);
    741740
    742     bool is_dvbs = (DTVTunerType::kTunerTypeQPSK   == card_type ||
    743                     DTVTunerType::kTunerTypeDVB_S2 == card_type);
    744 
    745     bool has_diseqc = (diseqc_tree != NULL);
    746     if (is_dvbs && !has_diseqc)
     741    if (tunerType.IsDiSEqCSupported() && !diseqc_tree)
    747742    {
    748743        VERBOSE(VB_IMPORTANT, LOC_ERR +
    749744                "DVB-S needs device tree for LNB handling");
     
    765760    drain_dvb_events(fd_frontend);
    766761
    767762    // send DVB-S setup
    768     if (is_dvbs)
     763    if (diseqc_tree)
    769764    {
    770765        // configure for new input
    771766        if (!same_input)
     
    809804            tuning.toString());
    810805
    811806    // DVB-S is in kHz, other DVB is in Hz
     807    bool is_dvbs = ((DTVTunerType::kTunerTypeDVBS1 == tunerType) ||
     808                    (DTVTunerType::kTunerTypeDVBS2 == tunerType));
    812809    int     freq_mult = (is_dvbs) ? 1 : 1000;
    813810    QString suffix    = (is_dvbs) ? "kHz" : "Hz";
    814811
    815     if (reset || !prev_tuning.IsEqual(card_type, tuning, 500 * freq_mult))
     812    if (reset || !prev_tuning.IsEqual(tunerType, tuning, 500 * freq_mult))
    816813    {
    817814        VERBOSE(VB_CHANNEL, LOC + QString("Tune(): Tuning to %1%2")
    818815                .arg(intermediate_freq ? intermediate_freq : tuning.frequency)
    819816                .arg(suffix));
    820817
    821818#if DVB_API_VERSION >=5
    822         if (DTVTunerType::kTunerTypeDVB_S2 == card_type)
     819        if (DTVTunerType::kTunerTypeDVBS2 == tunerType)
    823820        {
    824821            struct dtv_property p_clear;
    825822            struct dtv_properties cmdseq_clear;
     
    836833            }
    837834
    838835            struct dtv_properties *cmds = dtvmultiplex_to_dtvproperties(
    839                 card_type, tuning, intermediate_freq, can_fec_auto);
     836                tunerType, tuning, intermediate_freq, can_fec_auto);
    840837
    841838            if (!cmds) {
    842839                VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to convert "
     
    869866        else
    870867#endif
    871868        {
    872             struct dvb_frontend_parameters params = dtvmultiplex_to_dvbparams(card_type, tuning,
    873                                                                               intermediate_freq,
    874                                                                               can_fec_auto);
     869            struct dvb_frontend_parameters params = dtvmultiplex_to_dvbparams(
     870                tunerType, tuning, intermediate_freq, can_fec_auto);
    875871
    876872            if (ioctl(fd_frontend, FE_SET_FRONTEND, &params) < 0)
    877873            {
     
    968964        return false;
    969965    }
    970966
    971     if (card_type == DTVTunerType::kTunerTypeDVB_S2)
     967    if (tunerType == DTVTunerType::kTunerTypeDVBS2)
    972968    {
    973969        // TODO implement probing of tuning parameters with FE_GET_PROPERTY
    974970        return false;
     
    986982    uint    mplex      = tuning.mplex;
    987983    QString sistandard = tuning.sistandard; sistandard.detach();
    988984
    989     tuning = dvbparams_to_dtvmultiplex(card_type, params);
     985    tuning = dvbparams_to_dtvmultiplex(tunerType, params);
    990986
    991987    tuning.mplex       = mplex;
    992988    tuning.sistandard  = sistandard;
     
    12101206    params.frequency = tuning.frequency;
    12111207    params.inversion = (fe_spectral_inversion_t) (int) tuning.inversion;
    12121208
    1213     if (DTVTunerType::kTunerTypeQPSK == tuner_type)
     1209    if (DTVTunerType::kTunerTypeDVBS1 == tuner_type)
    12141210    {
    12151211        if (tuning.mod_sys == DTVModulationSystem::kModulationSystem_DVBS2)
    12161212            VERBOSE(VB_IMPORTANT, "DVBChan Error, Tuning of a DVB-S2 transport "
     
    12221218            : (fe_code_rate_t) (int) tuning.fec;
    12231219    }
    12241220
    1225     if (DTVTunerType::kTunerTypeDVB_S2 == tuner_type)
     1221    if (DTVTunerType::kTunerTypeDVBS2 == tuner_type)
    12261222    {
    12271223        VERBOSE(VB_IMPORTANT, "DVBChan Error, MythTV was compiled without "
    12281224                "DVB-S2 headers being present so DVB-S2 tuning will fail.");
    12291225    }
    12301226
    1231     if (DTVTunerType::kTunerTypeQAM == tuner_type)
     1227    if (DTVTunerType::kTunerTypeDVBC == tuner_type)
    12321228    {
    12331229        params.u.qam.symbol_rate  = tuning.symbolrate;
    12341230        params.u.qam.fec_inner    = (fe_code_rate_t) (int) tuning.fec;
    12351231        params.u.qam.modulation   = (fe_modulation_t) (int) tuning.modulation;
    12361232    }
    12371233
    1238     if (DTVTunerType::kTunerTypeOFDM == tuner_type)
     1234    if (DTVTunerType::kTunerTypeDVBT == tuner_type)
    12391235    {
    12401236        params.u.ofdm.bandwidth             =
    12411237            (fe_bandwidth_t) (int) tuning.bandwidth;
     
    12701266    tuning.frequency = params.frequency;
    12711267    tuning.inversion = params.inversion;
    12721268
    1273     if ((DTVTunerType::kTunerTypeQPSK  == tuner_type) ||
    1274         (DTVTunerType::kTunerTypeDVB_S2 == tuner_type))
     1269    if ((DTVTunerType::kTunerTypeDVBS1 == tuner_type) ||
     1270        (DTVTunerType::kTunerTypeDVBS2 == tuner_type))
    12751271    {
    12761272        tuning.symbolrate     = params.u.qpsk.symbol_rate;
    12771273        tuning.fec            = params.u.qpsk.fec_inner;
    12781274    }
    12791275
    1280     if (DTVTunerType::kTunerTypeQAM  == tuner_type)
     1276    if (DTVTunerType::kTunerTypeDVBC   == tuner_type)
    12811277    {
    12821278        tuning.symbolrate     = params.u.qam.symbol_rate;
    12831279        tuning.fec            = params.u.qam.fec_inner;
    12841280        tuning.modulation     = params.u.qam.modulation;
    12851281    }
    12861282
    1287     if (DTVTunerType::kTunerTypeOFDM == tuner_type)
     1283    if (DTVTunerType::kTunerTypeDVBT  == tuner_type)
    12881284    {
    12891285        tuning.bandwidth      = params.u.ofdm.bandwidth;
    12901286        tuning.hp_code_rate   = params.u.ofdm.code_rate_HP;
     
    12951291        tuning.hierarchy      = params.u.ofdm.hierarchy_information;
    12961292    }
    12971293
    1298     if (DTVTunerType::kTunerTypeATSC == tuner_type)
     1294    if (DTVTunerType::kTunerTypeATSC    == tuner_type)
    12991295    {
    13001296        tuning.modulation     = params.u.vsb.modulation;
    13011297    }
  • libs/libmythtv/hdhrstreamhandler.h

     
    1212#include "util.h"
    1313#include "DeviceReadBuffer.h"
    1414#include "mpegstreamdata.h"
     15#include "dtvconfparserhelpers.h"
    1516
    1617class QString;
    1718class HDHRStreamHandler;
     
    4445    bool IsRunning(void) const { return _running; }
    4546    void GetTunerStatus(struct hdhomerun_tuner_status_t *status);
    4647    bool IsConnected(void) const;
     48    vector<DTVTunerType> GetTunerTypes(void) const { return _tuner_types; }
    4749
    4850    // Commands
    4951    bool TuneChannel(const QString &chanid);
     
    9193    hdhomerun_device_t *_hdhomerun_device;
    9294    uint                _tuner;
    9395    QString             _devicename;
     96    vector<DTVTunerType> _tuner_types;
    9497
    9598    mutable QMutex    _start_stop_lock;
    9699    bool              _running;
  • libs/libmythtv/scanwizard.cpp

     
    9393    else if (scantype == ScanTypeSetting::NITAddScan_DVBT)
    9494    {
    9595        start_chan = configPane->GetStartChan();
    96         parse_type = DTVTunerType::kTunerTypeOFDM;
     96        parse_type = DTVTunerType::kTunerTypeDVBT;
    9797    }
    9898    else if (scantype == ScanTypeSetting::NITAddScan_DVBS)
    9999    {
    100100        start_chan = configPane->GetStartChan();
    101         parse_type = DTVTunerType::kTunerTypeQPSK;
     101        parse_type = DTVTunerType::kTunerTypeDVBS1;
    102102    }
    103103    else if (scantype == ScanTypeSetting::NITAddScan_DVBS2)
    104104    {
    105105        start_chan = configPane->GetStartChan();
    106         parse_type = DTVTunerType::kTunerTypeDVB_S2;
     106        parse_type = DTVTunerType::kTunerTypeDVBS2;
    107107    }
    108108    else if (scantype == ScanTypeSetting::NITAddScan_DVBC)
    109109    {
    110110        start_chan = configPane->GetStartChan();
    111         parse_type = DTVTunerType::kTunerTypeQAM;
     111        parse_type = DTVTunerType::kTunerTypeDVBC;
    112112    }
    113113    else if (scantype == ScanTypeSetting::IPTVImport)
    114114    {
  • libs/libmythtv/dtvmultiplex.cpp

     
    7676        return false;
    7777    }
    7878
    79     if (DTVTunerType::kTunerTypeQAM == type)
     79    if (DTVTunerType::kTunerTypeDVBC == type)
    8080    {
    8181        if (fuzzy)
    8282            return
     
    9191            (modulation == other.modulation);
    9292    }
    9393
    94     if (DTVTunerType::kTunerTypeOFDM == type)
     94    if (DTVTunerType::kTunerTypeDVBT == type)
    9595    {
    9696        if (fuzzy)
    9797            return
     
    121121        return (modulation == other.modulation);
    122122    }
    123123
    124     if ((DTVTunerType::kTunerTypeDVB_S2 == type) ||
    125         (DTVTunerType::kTunerTypeQPSK  == type))
     124    if ((DTVTunerType::kTunerTypeDVBS1 == type) ||
     125        (DTVTunerType::kTunerTypeDVBS2 == type))
    126126    {
    127127        bool ret =
    128128            (symbolrate == other.symbolrate)        &&
     
    261261    QString _modulation,   QString _bandwidth,
    262262    QString _mod_sys,      QString _rolloff)
    263263{
    264     if (DTVTunerType::kTunerTypeOFDM == type)
     264    if (DTVTunerType::kTunerTypeDVBT == type)
    265265    {
    266266        return ParseDVB_T(
    267267            _frequency,       _inversion,       _bandwidth,    _hp_code_rate,
     
    269269            _hierarchy);
    270270    }
    271271
    272     if ((DTVTunerType::kTunerTypeQPSK  == type) ||
    273         (DTVTunerType::kTunerTypeQAM    == type))
     272    if ((DTVTunerType::kTunerTypeDVBS1 == type) ||
     273        (DTVTunerType::kTunerTypeDVBC  == type))
    274274    {
    275275        return ParseDVB_S_and_C(
    276276            _frequency,       _inversion,     _symbolrate,
    277277            _fec,             _modulation,    _polarity);
    278278    }
    279279
    280     if (DTVTunerType::kTunerTypeDVB_S2 == type)
     280    if (DTVTunerType::kTunerTypeDVBS2 == type)
     281    {
    281282        return ParseDVB_S2(
    282283            _frequency,       _inversion,     _symbolrate,
    283284            _fec,             _modulation,    _polarity,
    284285            _mod_sys,         _rolloff);
     286    }
    285287
    286288    if (DTVTunerType::kTunerTypeATSC == type)
    287289        return ParseATSC(_frequency, _modulation);
     
    350352    {
    351353        case DescriptorID::terrestrial_delivery_system:
    352354        {
    353             if (type != DTVTunerType::kTunerTypeOFDM)
     355            if (type != DTVTunerType::kTunerTypeDVBT)
    354356                break;
    355357
    356358            const TerrestrialDeliverySystemDescriptor cd(desc);
     
    366368        {
    367369            const SatelliteDeliverySystemDescriptor cd(desc);
    368370
    369             if (type == DTVTunerType::kTunerTypeQPSK)
     371            if (type == DTVTunerType::kTunerTypeDVBS1)
    370372            {
    371373                if (cd.ModulationSystem())
    372374                {
     
    374376                            "Ignoring DVB-S2 transponder with DVB-S card");
    375377                    return false;
    376378                }
     379
    377380                return ParseDVB_S_and_C(
    378381                    QString().number(cd.FrequencyHz()),  "auto",
    379382                    QString().number(cd.SymbolRateHz()), cd.FECInnerString(),
    380383                    cd.ModulationString(),
    381384                    cd.PolarizationString());
    382385            }
    383             if (type == DTVTunerType::kTunerTypeDVB_S2)
     386
     387            if (type == DTVTunerType::kTunerTypeDVBS2)
    384388            {
    385389                return ParseDVB_S2(
    386390                    QString().number(cd.FrequencyHz()),  "auto",
     
    389393                    cd.PolarizationString(),
    390394                    cd.ModulationSystemString(),         cd.RollOffString());
    391395            }
     396
    392397            break;
    393398        }
    394399        case DescriptorID::cable_delivery_system:
    395400        {
    396             if (type != DTVTunerType::kTunerTypeQAM)
     401            if (type != DTVTunerType::kTunerTypeDVBC)
    397402                break;
    398403
    399404            const CableDeliverySystemDescriptor cd(desc);
  • libs/libmythtv/hdhrchannel.h

     
    3838    // Gets
    3939    bool IsOpen(void) const;
    4040    QString GetDevice(void) const { return _device_id; }
     41    virtual vector<DTVTunerType> GetTunerTypes(void) const { return _tuner_types; }
    4142
    4243    // ATSC/DVB scanning/tuning stuff
    4344    bool TuneMultiplex(uint mplexid, QString inputname);
     
    4849              QString modulation, QString si_std);
    4950
    5051  private:
    51     HDHRStreamHandler *_stream_handler;
     52    QString               _device_id;
     53    HDHRStreamHandler    *_stream_handler;
     54    vector<DTVTunerType>  _tuner_types;
    5255
    53     QString         _device_id;
    54 
    5556    mutable QMutex  _lock;
    5657    mutable QMutex  tune_lock;
    5758    mutable QMutex  hw_lock;
  • libs/libmythtv/dtvchannel.cpp

     
    1313
    1414DTVChannel::DTVChannel(TVRec *parent)
    1515    : ChannelBase(parent),
     16      tunerType(DTVTunerType::kTunerTypeUnknown),
    1617      sistandard("mpeg"),         tuningMode(QString::null),
    1718      currentProgramNum(-1),
    1819      currentATSCMajorChannel(0), currentATSCMinorChannel(0),
     
    154155    return tmp;
    155156}
    156157
     158vector<DTVTunerType> DTVChannel::GetTunerTypes(void) const
     159{
     160    vector<DTVTunerType> tts;
     161    if (tunerType != DTVTunerType::kTunerTypeUnknown)
     162        tts.push_back(tunerType);
     163    return tts;
     164}
     165
    157166void DTVChannel::SetTuningMode(const QString &tuning_mode)
    158167{
    159168    QMutexLocker locker(&dtvinfo_lock);