Ticket #3031: 3031-dbg-2.patch

File 3031-dbg-2.patch, 30.5 KB (added by danielk, 13 years ago)

Debugging patch 2

  • libs/libmythtv/firewirechannel.cpp

     
    6565
    6666    bool ok = false;
    6767    if (!(*it)->externalChanger.isEmpty())
    68     {
    6968        ok = ChangeExternalChannel(freqid);
    70         SetSIStandard("mpeg");
    71         SetDTVInfo(0,0,0,0,1);
    72     }
    7369    else
    7470    {
    7571        uint ichan = freqid.toUInt(&ok);
     
    206202                "STB is turned off, must be on to set channel.");
    207203
    208204        SetSIStandard("mpeg");
    209         SetDTVInfo(0,0,0,0,1);
     205        SetCachedATSCInfo(QString("%1-1").arg(channel));
    210206
    211207        return true; // signal monitor will call retune later...
    212208    }
     
    215211        return false;
    216212
    217213    SetSIStandard("mpeg");
    218     SetDTVInfo(0,0,0,0,1);
     214    SetCachedATSCInfo(QString("%1-1").arg(channel));
    219215
    220216    return true;
    221217}
  • libs/libmythtv/cardutil.h

     
    160160    static bool         IgnoreEncrypted(uint cardid, const QString &inputname);
    161161    static bool         TVOnly(uint cardid, const QString &inputname);
    162162    static bool         IsInNeedOfExternalInputConf(uint cardid);
    163     static uint         GetQuickTuning(uint cardid, const QString &inputname);
    164163
    165164    // DVB info
    166165    static bool         IsDVB(uint cardid, const QString &_inputname);
  • libs/libmythtv/hdhrsignalmonitor.cpp

     
    9898    if (!GetStreamData())
    9999        return false;
    100100
    101     UpdateListeningForEIT();
    102 
    103101    const QMap<uint, bool> &listening = GetStreamData()->ListeningPIDs();
    104102
    105103    // PIDs that need to be added..
  • libs/libmythtv/hdhrchannel.cpp

     
    2626#include "channelutil.h"
    2727#include "frequencytables.h"
    2828
    29 #define DEBUG_PID_FILTERS
    30 
    3129#define LOC QString("HDHRChan(%1): ").arg(GetDevice())
    3230#define LOC_ERR QString("HDHRChan(%1), Error: ").arg(GetDevice())
    3331
     
    8583    }
    8684}
    8785
    88 bool HDHRChannel::EnterPowerSavingMode(void)
    89 {
    90     return QString::null != TunerSet("channel", "none", false);
    91 }
    92 
    9386bool HDHRChannel::FindDevice(void)
    9487{
    9588    if (!_device_id)
     
    141134    return true;
    142135}
    143136
    144 QString HDHRChannel::DeviceGet(const QString &name, bool report_error_return)
     137QString HDHRChannel::DeviceGet(const QString &name)
    145138{
    146139    QMutexLocker locker(&_lock);
    147140
     
    159152        return QString::null;
    160153    }
    161154
    162     if (report_error_return && error)
    163     {
    164         VERBOSE(VB_IMPORTANT, LOC_ERR +
    165                 QString("DeviceGet(%1): %2").arg(name).arg(error));
    166 
     155    if (error) {
     156        VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DeviceGet(%1): %2").arg(name).arg(error));
    167157        return QString::null;
    168158    }
    169159
    170160    return QString(value);
    171161}
    172162
    173 QString HDHRChannel::DeviceSet(const QString &name, const QString &val,
    174                                bool report_error_return)
     163QString HDHRChannel::DeviceSet(const QString &name, const QString &val)
    175164{
    176165    QMutexLocker locker(&_lock);
    177166
     
    186175    if (hdhomerun_control_set(_control_socket, name, val, &value, &error) < 0)
    187176    {
    188177        VERBOSE(VB_IMPORTANT, LOC_ERR + "Set request failed" + ENO);
    189 
    190178        return QString::null;
    191179    }
    192180
    193     if (report_error_return && error)
    194     {
    195         VERBOSE(VB_IMPORTANT, LOC_ERR +
    196                 QString("DeviceSet(%1 %2): %3").arg(name).arg(val).arg(error));
    197 
     181    if (error) {
     182        VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DeviceSet(%1 %2): %3").arg(name).arg(val).arg(error));
    198183        return QString::null;
    199184    }
    200185
    201186    return QString(value);
    202187}
    203188
    204 QString HDHRChannel::TunerGet(const QString &name, bool report_error_return)
     189QString HDHRChannel::TunerGet(const QString &name)
    205190{
    206     return DeviceGet(QString("/tuner%1/%2").arg(_tuner).arg(name),
    207                      report_error_return);
     191    return DeviceGet(QString("/tuner%1/%2").arg(_tuner).arg(name));
    208192}
    209193
    210 QString HDHRChannel::TunerSet(const QString &name, const QString &value,
    211                               bool report_error_return)
     194QString HDHRChannel::TunerSet(const QString &name, const QString &value)
    212195{
    213     return DeviceSet(QString("/tuner%1/%2").arg(_tuner).arg(name), value,
    214                      report_error_return);
     196    return DeviceSet(QString("/tuner%1/%2").arg(_tuner).arg(name), value);
    215197}
    216198
    217199bool HDHRChannel::DeviceSetTarget(unsigned short localPort)
     
    275257    if (!inputName.isEmpty())
    276258        return SwitchToInput(inputName, channum);
    277259
    278     ClearDTVInfo();
    279     _ignore_filters = false;
     260    SetCachedATSCInfo("");
    280261
    281262    InputMap::const_iterator it = inputs.find(currentInputID);
    282263    if (it == inputs.end())
     
    331312    curchannelname = QDeepCopy<QString>(channum);
    332313
    333314    // Set the major and minor channel for any additional multiplex tuning
    334     SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);
     315    if (atsc_major || atsc_minor)
     316        SetCachedATSCInfo(QString("%1_%2").arg(atsc_major).arg(atsc_minor));
     317    else if (mpeg_prog_num >= 0)
     318        SetCachedATSCInfo(QString("0-%1").arg(mpeg_prog_num));
     319    else
     320        SetCachedATSCInfo(QString("%1_0").arg(channum));
    335321
    336322    // Set this as the future start channel for this source
    337     inputs[currentInputID]->startChanNum = QDeepCopy<QString>(curchannelname);
     323    inputs[currentInputID]->startChanNum = curchannelname;
    338324
    339     // Turn on the HDHomeRun program filtering if it is supported
    340     // and we are tuning to an MPEG program number.
    341     if (mpeg_prog_num && (GetTuningMode() == "mpeg"))
    342     {
    343         QString pnum = QString::number(mpeg_prog_num);
    344         _ignore_filters = QString::null != TunerSet("program", pnum, false);
    345     }
    346 
    347325    return true;
    348326}
    349327
     
    445423    it = lower_bound(_pids.begin(), _pids.end(), pid);
    446424    if (it != _pids.end() && *it == pid)
    447425    {
    448 #ifdef DEBUG_PID_FILTERS
    449426        VERBOSE(VB_CHANNEL, "AddPID(0x"<<hex<<pid<<dec<<") NOOP");
    450 #endif // DEBUG_PID_FILTERS
    451427        return true;
    452428    }
    453429
    454430    _pids.insert(it, pid);
    455431
    456 #ifdef DEBUG_PID_FILTERS
    457432    VERBOSE(VB_CHANNEL, "AddPID(0x"<<hex<<pid<<dec<<")");
    458 #endif // DEBUG_PID_FILTERS
    459433
    460434    if (do_update)
    461435        return UpdateFilters();
     
    470444    it = lower_bound(_pids.begin(), _pids.end(), pid);
    471445    if (it == _pids.end())
    472446    {
    473 #ifdef DEBUG_PID_FILTERS
    474447        VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") NOOP");
    475 #endif // DEBUG_PID_FILTERS
    476 
    477        return true;
     448        return true;
    478449    }
    479450
    480451    if (*it == pid)
    481452    {
    482 #ifdef DEBUG_PID_FILTERS
    483453        VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") -- found");
    484 #endif // DEBUG_PID_FILTERS
    485454        _pids.erase(it);
    486455    }
    487456    else
    488457    {
    489 #ifdef DEBUG_PID_FILTERS
    490458        VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") -- failed");
    491 #endif // DEBUG_PID_FILTERS
    492459    }
    493460
    494461    if (do_update)
     
    500467{
    501468    QMutexLocker locker(&_lock);
    502469
    503 #ifdef DEBUG_PID_FILTERS
    504470    VERBOSE(VB_CHANNEL, "DelAllPID()");
    505 #endif // DEBUG_PID_FILTERS
    506 
    507471    _pids.clear();
    508472
    509473    return UpdateFilters();
     
    529493    vector<uint> range_min;
    530494    vector<uint> range_max;
    531495
    532     if (_ignore_filters)
    533         return true;
    534 
    535496    for (uint i = 0; i < _pids.size(); i++)
    536497    {
    537498        uint pid_min = _pids[i];
     
    567528
    568529    QString new_filter = TunerSet("filter", filter);
    569530
    570 #ifdef DEBUG_PID_FILTERS
    571531    QString msg = QString("Filter: '%1'").arg(filter);
    572532    if (filter != new_filter)
    573533        msg += QString("\n\t\t\t\t'%2'").arg(new_filter);
    574534
    575535    VERBOSE(VB_CHANNEL, msg);
    576 #endif // DEBUG_PID_FILTERS
    577536
    578537    return filter == new_filter;
    579538}
  • libs/libmythtv/dvbchannel.h

     
    7272
    7373  private:
    7474    int  GetChanID(void) const;
     75    bool InitChannelParams(DTVMultiplex &t,
     76                           uint sourceid, const QString &channum);
    7577
    7678    void CheckOptions(DTVMultiplex &t) const;
    7779    bool CheckModulation(DTVModulation modulation) const;
  • libs/libmythtv/dtvchannel.h

     
    4141    virtual bool TuneMultiplex(uint mplexid, QString inputname) = 0;
    4242    /// \brief To be used by the channel scanner and possibly the EIT scanner.
    4343    virtual bool Tune(const DTVMultiplex &tuning, QString inputname) = 0;
    44     /// \brief Enters power saving mode if the card supports it
    45     virtual bool EnterPowerSavingMode(void) { return true; }
    4644
    4745    // Gets
    4846
     
    6967    /// \brief Returns PSIP table standard: MPEG, DVB, ATSC, or OpenCable
    7068    QString GetSIStandard(void) const;
    7169
    72     /// \brief Returns suggested tuning mode: "mpeg", "dvb", or "atsc"
    73     QString GetSuggestedTuningMode(bool is_live_tv) const;
    74 
    75     /// \brief Returns tuning mode last set by SetTuningMode().
    76     QString GetTuningMode(void) const;
    77 
    7870    /** \brief Returns cached MPEG PIDs for last tuned channel.
    7971     *  \param pid_cache List of PIDs with their TableID
    8072     *                   types is returned in pid_cache.
     
    8476
    8577    // Sets
    8678
    87     /// \brief Sets tuning mode: "mpeg", "dvb", "atsc", etc.
    88     void SetTuningMode(const QString &tuningmode);
    89 
    9079    /** \brief Saves MPEG PIDs to cache to database
    9180     * \param pid_cache List of PIDs with their TableID types to be saved.
    9281     */
     
    9685  protected:
    9786    /// \brief Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable
    9887    void SetSIStandard(const QString&);
    99     void SetDTVInfo(uint atsc_major, uint atsc_minor,
    100                     uint dvb_orig_netid,
    101                     uint mpeg_tsid, int mpeg_pnum);
    102     void ClearDTVInfo(void) { SetDTVInfo(0, 0, 0, 0, -1); }
     88    void SetCachedATSCInfo(const QString &chan);
    10389
    10490    static void GetCachedPids(int chanid, pid_cache_t&);
    10591    static void SaveCachedPids(int chanid, const pid_cache_t&);
     
    10894    mutable QMutex dtvinfo_lock;
    10995
    11096    QString sistandard; ///< PSIP table standard: MPEG, DVB, ATSC, OpenCable
    111     QString tuningMode;
    11297    int     currentProgramNum;
    11398    uint    currentATSCMajorChannel;
    11499    uint    currentATSCMinorChannel;
  • libs/libmythtv/mpeg/atscstreamdata.cpp

     
    107107
    108108void ATSCStreamData::Reset(int desiredProgram)
    109109{
    110     Reset(-1,-1);
    111110    MPEGStreamData::Reset(desiredProgram);
    112111    AddListeningPID(ATSC_PSIP_PID);
    113112}
  • libs/libmythtv/dvbchannel.cpp

     
    238238    QString loc_err = LOC_ERR + tmp;
    239239
    240240    VERBOSE(VB_CHANNEL, loc);
    241 
    242241    if (fd_frontend < 0)
    243242    {
    244243        VERBOSE(VB_IMPORTANT, loc_err + "Channel object "
    245244                "will not open, can not change channels.");
    246245
    247         ClearDTVInfo();
    248246        return false;
    249247    }
    250248
     
    254252        return true;
    255253    }
    256254
    257     ClearDTVInfo();
    258 
    259255    QString inputName;
    260256    if (!CheckChannel(channum, inputName))
    261257    {
     
    276272    if (it == inputs.end())
    277273        return false;
    278274
    279     // Get the input data for the channel
    280     QString tvformat, modulation, freqtable, freqid, si_std;
    281     int finetune;
    282     uint64_t frequency;
    283     int mpeg_prog_num;
    284     uint atsc_major, atsc_minor, mplexid, tsid, netid;
    285 
    286     if (!ChannelUtil::GetChannelData(
    287         (*it)->sourceid, channum,
    288         tvformat, modulation, freqtable, freqid,
    289         finetune, frequency,
    290         si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
    291         mplexid, commfree))
    292     {
    293         VERBOSE(VB_IMPORTANT, loc_err +
    294                 "Unable to find channel in database.");
    295 
    296         return false;
    297     }
    298 
    299     // Initialize basic the tuning parameters
     275    // Initialize all the tuning parameters
    300276    DTVMultiplex tuning;
    301     if (!mplexid || !tuning.FillFromDB(card_type, mplexid))
     277    if (!InitChannelParams(tuning, (*it)->sourceid, channum))
    302278    {
    303279        VERBOSE(VB_IMPORTANT, loc_err +
    304                 "Failed to initialize multiplex options");
     280                "Failed to initialize channel options");
    305281
    306282        return false;
    307283    }
    308284
    309     SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);
    310 
    311     // Try to fix any problems with the multiplex
    312285    CheckOptions(tuning);
    313286
    314287    if (!Tune(tuning, ""))
    315288    {
    316289        VERBOSE(VB_IMPORTANT, loc_err + "Tuning to frequency.");
    317290
    318         ClearDTVInfo();
    319291        return false;
    320292    }
    321293
     
    360332    return SetChannelByString((*it)->startChanNum);
    361333}
    362334
     335/** \fn DVBChannel::InitChannelParams(DTVMultiplex&,uint,const QString&)
     336 *  \brief Initializes all variables pertaining to a channel.
     337 *
     338 *  \return true on success and false on failure
     339 */
     340bool DVBChannel::InitChannelParams(DTVMultiplex  &tuning,
     341                                   uint           sourceid,
     342                                   const QString &channum)
     343{
     344    QString tvformat, modulation, freqtable, freqid, si_std;
     345    int finetune;
     346    uint64_t frequency;
     347    uint mplexid;
     348
     349    if (!ChannelUtil::GetChannelData(
     350            sourceid,   channum,
     351            tvformat,   modulation,   freqtable,   freqid,
     352            finetune,   frequency,
     353            si_std,                   currentProgramNum,
     354            currentATSCMajorChannel,  currentATSCMinorChannel,
     355            currentTransportID,       currentOriginalNetworkID,
     356            mplexid,    commfree))
     357    {
     358        return false;
     359    }
     360
     361    if (currentATSCMinorChannel)
     362        currentProgramNum = -1;
     363
     364    if (mplexid)
     365        return tuning.FillFromDB(card_type, mplexid);
     366
     367    VERBOSE(VB_IMPORTANT, LOC_ERR + "Unable to find channel in database.");
     368    return false;
     369}
     370
    363371/** \fn DVBChannel::CheckOptions(DTVMultiplex&) const
    364372 *  \brief Checks tuning for problems, and tries to fix them.
    365373 */
  • libs/libmythtv/cardutil.cpp

     
    448448    return needsConf;
    449449}
    450450
    451 uint CardUtil::GetQuickTuning(uint cardid, const QString &input_name)
    452 {
    453     uint quicktune = 0;
    454 
    455     MSqlQuery query(MSqlQuery::InitCon());
    456     query.prepare(
    457         "SELECT quicktune "
    458         "FROM cardinput "
    459         "WHERE cardid    = :CARDID AND "
    460         "      inputname = :INPUTNAME");
    461     query.bindValue(":CARDID",    cardid);
    462     query.bindValue(":INPUTNAME", input_name);
    463 
    464     if (!query.exec() || !query.isActive())
    465         MythContext::DBError("CardUtil::GetQuickTuning()", query);
    466     else if (query.next())
    467         quicktune = query.value(0).toUInt();
    468 
    469     return quicktune;
    470 }
    471 
    472451bool CardUtil::hasV4L2(int videofd)
    473452{
    474453    (void) videofd;
  • libs/libmythtv/videosource.cpp

     
    16131613    };
    16141614};
    16151615
    1616 class QuickTune : public ComboBoxSetting, public CardInputDBStorage
    1617 {
    1618   public:
    1619     QuickTune(const CardInput &parent) :
    1620         ComboBoxSetting(this), CardInputDBStorage(this, parent, "quicktune")
    1621     {
    1622         setLabel(QObject::tr("Use quick tuning"));
    1623         addSelection(QObject::tr("Never"),        "0", true);
    1624         //addSelection(QObject::tr("Live TV only"), "1", true);
    1625         addSelection(QObject::tr("Always"),       "2", false);
    1626         setHelpText(QObject::tr(
    1627                         "If enabled MythTV will tune using only the "
    1628                         "MPEG program number. The program numbers "
    1629                         "change more often than DVB or ATSC tuning "
    1630                         "parameters, so this is slightly less reliable."));
    1631     };
    1632 };
    1633 
    16341616class ExternalChannelCommand :
    16351617    public LineEditSetting, public CardInputDBStorage
    16361618{
     
    17701752    group->addChild(ci);
    17711753    group->addChild(new InputDisplayName(*this));
    17721754    group->addChild(sourceid);
    1773 
    1774     if (!isDTVcard)
     1755    if (!isDVBcard)
    17751756    {
    17761757        group->addChild(new ExternalChannelCommand(*this));
    17771758        group->addChild(new PresetTuner(*this));
     
    17811762    {
    17821763        // we place this in a group just so the margins match the DVB ones.
    17831764        ConfigurationGroup *chgroup =
    1784             new VerticalConfigurationGroup(false, false, true, true);
    1785         chgroup->addChild(new QuickTune(*this));
     1765            new HorizontalConfigurationGroup(false, false, true, true);
    17861766        chgroup->addChild(new FreeToAir(*this));
    17871767        group->addChild(chgroup);
    17881768    }
  • libs/libmythtv/iptvchannel.cpp

     
    129129        return false;
    130130    }
    131131
    132     // Set the current channum to the new channel's channum
    133     curchannelname = QDeepCopy<QString>(channum);
     132    // Set the channel..
     133    curchannelname = channum;
     134    currentProgramNum = 1;
    134135
    135     // Set the dtv channel info for any additional multiplex tuning
    136     SetDTVInfo(/*atsc_major*/ 0, /*atsc_minor*/ 0,
    137                /*netid*/ 0,
    138                /*tsid*/ 0, /*mpeg_prog_num*/ 1);
    139 
    140136    VERBOSE(VB_CHANNEL, LOC + "SetChannelByString() -- end");
    141137    return true;
    142138}
  • libs/libmythtv/tv_rec.cpp

     
    765765    changeState = false;
    766766
    767767    eitScanStartTime = QDateTime::currentDateTime();   
    768     if ((internalState == kState_None) &&
    769         CardUtil::IsEITCapable(genOpt.cardtype))
     768    if ((internalState == kState_None) && (genOpt.cardtype == "DVB"))
    770769    {
    771770        // Add some randomness to avoid all cards starting
    772771        // EIT scanning at nearly the same time.
     
    981980    MythEvent me("RECORDING_LIST_CHANGE");
    982981    gContext->dispatch(me);
    983982    pauseNotify = true;
     983}   
    984984
    985     if (GetDTVChannel())
    986         GetDTVChannel()->EnterPowerSavingMode();
    987 }
    988 
    989985DVBRecorder *TVRec::GetDVBRecorder(void)
    990986{
    991987#ifdef USING_DVB
     
    10571053        }
    10581054        VERBOSE(VB_IMPORTANT, LOC_ERR + msg1 + "\n\t\t\t" + msg2);
    10591055    }
    1060 
    1061     if (GetDTVChannel())
    1062         GetDTVChannel()->EnterPowerSavingMode();
    10631056}
    10641057
    10651058void TVRec::CloseChannel(void)
     
    16561649        sd->SetCaching(true);
    16571650    }
    16581651
    1659     uint neededVideo = 0;
    1660     uint neededAudio = 0;
     1652    QString sistandard = dtvchan->GetSIStandard();
    16611653
    1662     ProgramInfo *rec = lastTuningRequest.program;
    1663     RecordingProfile profile;
    1664     load_profile(genOpt.cardtype, tvchain, rec, profile);
    1665     const Setting *setting = profile.byName("recordingtype");
    1666     if (setting)
    1667     {
    1668         neededVideo = (setting->getValue() == "tv") ? 1 : 0;
    1669         neededAudio = (setting->getValue() == "audio") ? 1 : 0;
    1670     }
    1671 
    1672     const QString tuningmode = dtvchan->GetTuningMode();
    1673 
    16741654    // Check if this is an ATSC Channel
    16751655    int major = dtvchan->GetMajorChannel();
    16761656    int minor = dtvchan->GetMinorChannel();
    1677     if ((minor > 0) && (tuningmode == "atsc"))
     1657    if ((minor > 0) && (sistandard == "atsc"))
    16781658    {
    16791659        QString msg = QString("ATSC channel: %1_%2").arg(major).arg(minor);
    16801660        VERBOSE(VB_RECORD, LOC + msg);
     
    16911671        asd->Reset(major, minor);
    16921672        sm->SetStreamData(sd);
    16931673        sm->SetChannel(major, minor);
    1694         sd->SetVideoStreamsRequired(neededVideo);
    1695         sd->SetAudioStreamsRequired(neededAudio);
     1674        sd->SetVideoStreamsRequired(1);
    16961675
    16971676        // Try to get pid of VCT from cache and
    16981677        // require MGT if we don't have VCT pid.
     
    17061685    // Check if this is an DVB channel
    17071686    int progNum = dtvchan->GetProgramNumber();
    17081687#ifdef USING_DVB
    1709     if ((progNum >= 0) && (tuningmode == "dvb"))
     1688    if ((progNum >= 0) && (sistandard == "dvb"))
    17101689    {
    17111690        int netid   = dtvchan->GetOriginalNetworkID();
    17121691        int tsid    = dtvchan->GetTransportID();
    17131692
     1693        uint neededVideo = 0;
     1694        uint neededAudio = 0;
     1695
    17141696        DVBStreamData *dsd = dynamic_cast<DVBStreamData*>(sd);
    17151697        if (!dsd)
    17161698        {
     
    17201702                GetDTVRecorder()->SetStreamData(dsd);
    17211703        }
    17221704
     1705        ProgramInfo *rec = lastTuningRequest.program;
     1706        RecordingProfile profile;
     1707        load_profile(genOpt.cardtype, tvchain, rec, profile);
     1708        const Setting *setting = profile.byName("recordingtype");
     1709        if (setting)
     1710        {
     1711            neededVideo = (setting->getValue() == "tv") ? 1 : 0;
     1712            neededAudio = (setting->getValue() == "audio") ? 1 : 0;
     1713        }
     1714
    17231715        VERBOSE(VB_RECORD, LOC +
    17241716                QString("DVB service_id %1 on net_id %2 tsid %3")
    17251717                .arg(progNum).arg(netid).arg(tsid));
     
    17711763        sd->Reset(progNum);
    17721764        sm->SetStreamData(sd);
    17731765        sm->SetProgramNumber(progNum);
    1774         sd->SetVideoStreamsRequired(neededVideo);
    1775         sd->SetAudioStreamsRequired(neededAudio);
    1776 
     1766        sd->SetVideoStreamsRequired(1);
    17771767        sm->AddFlags(SignalMonitor::kDTVSigMon_WaitForPAT |
    17781768                     SignalMonitor::kDTVSigMon_WaitForPMT |
    17791769                     SignalMonitor::kDVBSigMon_WaitForPos);
     
    17841774    }
    17851775
    17861776    QString msg = "No valid DTV info, ATSC maj(%1) min(%2), MPEG pn(%3)";
    1787     VERBOSE(VB_IMPORTANT, LOC_ERR + msg.arg(major).arg(minor).arg(progNum));
     1777    VERBOSE(VB_RECORD, LOC_ERR + msg.arg(major).arg(minor).arg(progNum));
    17881778    return false;
    17891779}
    17901780
     
    23122302    long long bitrate;
    23132303    if (genOpt.cardtype == "MPEG")
    23142304        bitrate = 10080000LL; // use DVD max bit rate
    2315     else if (genOpt.cardtype == "DBOX2")
    2316         bitrate = 10080000LL; // use DVD max bit rate
    2317     else if (!CardUtil::IsEncoder(genOpt.cardtype))
     2305    else if (genOpt.cardtype == "HDTV")
    23182306        bitrate = 19400000LL; // 1080i
     2307    else if (genOpt.cardtype == "FIREWIRE")
     2308        bitrate = 19400000LL; // 1080i
     2309    else if (genOpt.cardtype == "DVB")
     2310        bitrate = 19400000LL; // 1080i
    23192311    else // frame grabber
    23202312        bitrate = 10080000LL; // use DVD max bit rate, probably too big
    23212313
     
    33903382 */
    33913383void TVRec::TuningFrequency(const TuningRequest &request)
    33923384{
    3393     DTVChannel *dtvchan = GetDTVChannel();
    3394     if (dtvchan)
     3385    if (request.minorChan)
    33953386    {
    3396         MPEGStreamData *mpeg = NULL;
    3397 
    3398         if (GetDTVRecorder())
    3399             mpeg = GetDTVRecorder()->GetStreamData();
    3400 
    3401         const QString tuningmode = (HasFlags(kFlagEITScannerRunning)) ?
    3402             dtvchan->GetSIStandard() :
    3403             dtvchan->GetSuggestedTuningMode(
    3404                 kState_WatchingLiveTV == internalState);
    3405 
    3406         dtvchan->SetTuningMode(tuningmode);
    3407 
    3408         if (request.minorChan && (tuningmode == "atsc"))
    3409         {
    3410             channel->SetChannelByString(request.channel);
    3411 
    3412             ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg);
    3413             if (atsc)
    3414                 atsc->SetDesiredChannel(request.majorChan, request.minorChan);
    3415         }
    3416         else if (request.progNum >= 0)
    3417         {
    3418             channel->SetChannelByString(request.channel);
    3419 
    3420             if (mpeg)
    3421                 mpeg->SetDesiredProgram(request.progNum);
    3422         }
     3387        MPEGStreamData *mpeg = GetDTVRecorder()->GetStreamData();
     3388        ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg);
     3389        channel->SetChannelByString(request.channel);
     3390        atsc->SetDesiredChannel(request.majorChan, request.minorChan);
    34233391    }
    3424 
     3392    else if (request.progNum >= 0)
     3393    {
     3394        MPEGStreamData *mpeg = GetDTVRecorder()->GetStreamData();
     3395        channel->SetChannelByString(request.channel);
     3396        mpeg->SetDesiredProgram(request.progNum);
     3397    }
    34253398    if (request.IsOnSameMultiplex())
    34263399    {
    34273400        QStringList slist;
  • libs/libmythtv/channel.cpp

     
    441441    if (!inputName.isEmpty())
    442442        return ChannelBase::SwitchToInput(inputName, channum);
    443443
    444     ClearDTVInfo();
     444    SetCachedATSCInfo("");
    445445
    446446    InputMap::const_iterator it = inputs.find(currentInputID);
    447447    if (it == inputs.end())
     
    516516    InitPictureAttributes();
    517517
    518518    // Set the major and minor channel for any additional multiplex tuning
    519     SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);
     519    if (atsc_major || atsc_minor)
     520        SetCachedATSCInfo(QString("%1_%2").arg(atsc_major).arg(atsc_minor));
     521    else
     522        SetCachedATSCInfo(QString("%1_0").arg(channum));
    520523
    521524    // Set this as the future start channel for this source
    522     inputs[currentInputID]->startChanNum = QDeepCopy<QString>(curchannelname);
     525    inputs[currentInputID]->startChanNum = curchannelname;
    523526
    524527    return true;
    525528}
  • libs/libmythtv/hdhrchannel.h

     
    2929
    3030    bool Open(void);
    3131    void Close(void);
    32     bool EnterPowerSavingMode(void);
    3332
    3433    // Sets
    3534    bool SetChannelByString(const QString &chan);
     
    6362    bool DeviceSetTarget(unsigned short localPort);
    6463    bool DeviceClearTarget(void);
    6564
    66     QString DeviceGet(const QString &name, bool report_error_return = true);
    67     QString DeviceSet(const QString &name, const QString &value,
    68                       bool report_error_return = true);
     65    QString DeviceGet(const QString &name);
     66    QString DeviceSet(const QString &name, const QString &value);
    6967
    70     QString TunerGet(const QString &name, bool report_error_return = true);
    71     QString TunerSet(const QString &name, const QString &value,
    72                      bool report_error_return = true);
     68    QString TunerGet(const QString &name);
     69    QString TunerSet(const QString &name, const QString &value);
    7370
    7471  private:
    7572    hdhr_socket_t  *_control_socket;
    7673    uint            _device_id;
    7774    uint            _device_ip;
    7875    uint            _tuner;
    79     bool            _ignore_filters;
    8076    vector<uint>    _pids;
    8177    mutable QMutex  _lock;
    8278};
  • libs/libmythtv/dtvchannel.cpp

     
    88// MythTV headers
    99#include "mythcontext.h"
    1010#include "mythdbcon.h"
    11 #include "cardutil.h"
    1211
    1312#define LOC QString("DTVChan(%1): ").arg(GetDevice())
    1413#define LOC_WARN QString("DTVChan(%1) Warning: ").arg(GetDevice())
     
    1615
    1716DTVChannel::DTVChannel(TVRec *parent)
    1817    : ChannelBase(parent),
    19       sistandard("mpeg"),         tuningMode(QString::null),
    20       currentProgramNum(-1),
     18      sistandard("mpeg"),         currentProgramNum(-1),
    2119      currentATSCMajorChannel(0), currentATSCMinorChannel(0),
    2220      currentTransportID(0),      currentOriginalNetworkID(0)
    2321{
     
    8987    }
    9088}
    9189
    92 void DTVChannel::SetDTVInfo(uint atsc_major, uint atsc_minor,
    93                             uint dvb_orig_netid,
    94                             uint mpeg_tsid, int mpeg_pnum)
     90void DTVChannel::SetCachedATSCInfo(const QString &chan)
    9591{
    96     QMutexLocker locker(&dtvinfo_lock);
    97     currentProgramNum        = mpeg_pnum;
    98     currentATSCMajorChannel  = atsc_major;
    99     currentATSCMinorChannel  = atsc_minor;
    100     currentTransportID       = mpeg_tsid;
    101     currentOriginalNetworkID = dvb_orig_netid;
     92    int progsep = chan.find("-");
     93    int chansep = chan.find("_");
     94
     95    currentProgramNum        = -1;
     96    currentOriginalNetworkID = 0;
     97    currentTransportID       = 0;
     98    currentATSCMajorChannel  = 0;
     99    currentATSCMinorChannel  = 0;
     100
     101    if (progsep >= 0)
     102    {
     103        currentProgramNum = chan.right(chan.length() - progsep - 1).toInt();
     104        currentATSCMajorChannel = chan.left(progsep).toInt();
     105    }
     106    else if (chansep >= 0)
     107    {
     108        currentATSCMinorChannel =
     109            chan.right(chan.length() - chansep - 1).toInt();
     110        currentATSCMajorChannel = chan.left(chansep).toInt();
     111    }
     112    else
     113    {
     114        bool ok;
     115        int chanNum = chan.toInt(&ok);
     116        if (ok && chanNum >= 10)
     117        {
     118            currentATSCMinorChannel = chanNum % 10;
     119            currentATSCMajorChannel = chanNum / 10;
     120        }
     121    }
     122
     123    if (currentATSCMinorChannel > 0)
     124    {
     125        VERBOSE(VB_CHANNEL, LOC +
     126                QString("SetCachedATSCInfo(%2): %3_%4").arg(chan)
     127                .arg(currentATSCMajorChannel).arg(currentATSCMinorChannel));
     128    }
     129    else if ((0 == currentATSCMajorChannel) && (0 == currentProgramNum))
     130    {
     131        VERBOSE(VB_CHANNEL, LOC +
     132                QString("SetCachedATSCInfo(%2): RESET").arg(chan));
     133    }
     134    else
     135    {
     136        VERBOSE(VB_CHANNEL, LOC +
     137                QString("SetCachedATSCInfo(%2): %3-%4").arg(chan)
     138                .arg(currentATSCMajorChannel).arg(currentProgramNum));
     139    }
    102140}
    103141
    104142QString DTVChannel::GetSIStandard(void) const
     
    110148void DTVChannel::SetSIStandard(const QString &si_std)
    111149{
    112150    QMutexLocker locker(&dtvinfo_lock);
    113     sistandard = QDeepCopy<QString>(si_std.lower());
     151    sistandard = QDeepCopy<QString>(si_std);
    114152}
    115 
    116 QString DTVChannel::GetSuggestedTuningMode(bool is_live_tv) const
    117 {
    118     uint cardid = GetCardID();
    119     QString input = GetCurrentInput();
    120 
    121     uint quickTuning = 0;
    122     if (cardid && !input.isEmpty())
    123         quickTuning = CardUtil::GetQuickTuning(cardid, input);
    124 
    125     bool useQuickTuning = (quickTuning && is_live_tv) || (quickTuning > 1);
    126 
    127     QMutexLocker locker(&dtvinfo_lock);
    128     if (!useQuickTuning && ((sistandard == "atsc") || (sistandard == "dvb")))
    129         return QDeepCopy<QString>(sistandard);
    130 
    131     return "mpeg";
    132 }
    133 
    134 QString DTVChannel::GetTuningMode(void) const
    135 {
    136     QMutexLocker locker(&dtvinfo_lock);
    137     return QDeepCopy<QString>(tuningMode);
    138 }
    139 
    140 void DTVChannel::SetTuningMode(const QString &tuning_mode)
    141 {
    142     QMutexLocker locker(&dtvinfo_lock);
    143     tuningMode = QDeepCopy<QString>(tuning_mode.lower());
    144 }