Ticket #2944: 2944-v4.patch

File 2944-v4.patch, 30.8 KB (added by danielk, 14 years ago)
  • libs/libmythtv/cardutil.h

     
    164164    static bool         IgnoreEncrypted(uint cardid, const QString &inputname);
    165165    static bool         TVOnly(uint cardid, const QString &inputname);
    166166    static bool         IsInNeedOfExternalInputConf(uint cardid);
     167    static uint         GetQuickTuning(uint cardid, const QString &inputname);
    167168
    168169    // DVB info
    169170    static bool         IsDVB(uint cardid, const QString &_inputname);
  • libs/libmythtv/dbcheck.cpp

     
    1010#include "mythdbcon.h"
    1111
    1212/// This is the DB schema version expected by the running MythTV instance.
    13 const QString currentDatabaseVersion = "1175";
     13const QString currentDatabaseVersion = "1176";
    1414
    1515static bool UpdateDBVersionNumber(const QString &newnumber);
    1616static bool performActualUpdate(const QString updates[], QString version,
     
    28032803            return false;
    28042804    }
    28052805
     2806    if (dbver == "1175")
     2807    {
     2808        const QString updates[] = {
     2809"ALTER TABLE cardinput ADD COLUMN quicktune TINYINT NOT NULL default '0';",
     2810""
     2811};
     2812        if (!performActualUpdate(updates, "1176", dbver))
     2813            return false;
     2814    }
     2815
    28062816//"ALTER TABLE cardinput DROP COLUMN preference;" in 0.22
    28072817//"ALTER TABLE channel DROP COLUMN atscsrcid;" in 0.22
    28082818//"ALTER TABLE recordedmarkup DROP COLUMN offset;" in 0.22
  • libs/libmythtv/hdhrsignalmonitor.cpp

     
    9898    if (!GetStreamData())
    9999        return false;
    100100
     101    UpdateListeningForEIT();
     102
    101103    const QMap<uint, bool> &listening = GetStreamData()->ListeningPIDs();
    102104
    103105    // 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
    2931#define LOC QString("HDHRChan(%1): ").arg(GetDevice())
    3032#define LOC_ERR QString("HDHRChan(%1), Error: ").arg(GetDevice())
    3133
     
    8385    }
    8486}
    8587
     88bool HDHRChannel::EnterPowerSavingMode(void)
     89{
     90    return QString::null != TunerSet("channel", "none", false);
     91}
     92
    8693bool HDHRChannel::FindDevice(void)
    8794{
    8895    if (!_device_id)
     
    134141    return true;
    135142}
    136143
    137 QString HDHRChannel::DeviceGet(const QString &name)
     144QString HDHRChannel::DeviceGet(const QString &name, bool report_error_return)
    138145{
    139146    QMutexLocker locker(&_lock);
    140147
     
    152159        return QString::null;
    153160    }
    154161
    155     if (error) {
    156         VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DeviceGet(%1): %2").arg(name).arg(error));
     162    if (report_error_return && error)
     163    {
     164        VERBOSE(VB_IMPORTANT, LOC_ERR +
     165                QString("DeviceGet(%1): %2").arg(name).arg(error));
     166
    157167        return QString::null;
    158168    }
    159169
    160170    return QString(value);
    161171}
    162172
    163 QString HDHRChannel::DeviceSet(const QString &name, const QString &val)
     173QString HDHRChannel::DeviceSet(const QString &name, const QString &val,
     174                               bool report_error_return)
    164175{
    165176    QMutexLocker locker(&_lock);
    166177
     
    175186    if (hdhomerun_control_set(_control_socket, name, val, &value, &error) < 0)
    176187    {
    177188        VERBOSE(VB_IMPORTANT, LOC_ERR + "Set request failed" + ENO);
     189
    178190        return QString::null;
    179191    }
    180192
    181     if (error) {
    182         VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DeviceSet(%1 %2): %3").arg(name).arg(val).arg(error));
     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
    183198        return QString::null;
    184199    }
    185200
    186201    return QString(value);
    187202}
    188203
    189 QString HDHRChannel::TunerGet(const QString &name)
     204QString HDHRChannel::TunerGet(const QString &name, bool report_error_return)
    190205{
    191     return DeviceGet(QString("/tuner%1/%2").arg(_tuner).arg(name));
     206    return DeviceGet(QString("/tuner%1/%2").arg(_tuner).arg(name),
     207                     report_error_return);
    192208}
    193209
    194 QString HDHRChannel::TunerSet(const QString &name, const QString &value)
     210QString HDHRChannel::TunerSet(const QString &name, const QString &value,
     211                              bool report_error_return)
    195212{
    196     return DeviceSet(QString("/tuner%1/%2").arg(_tuner).arg(name), value);
     213    return DeviceSet(QString("/tuner%1/%2").arg(_tuner).arg(name), value,
     214                     report_error_return);
    197215}
    198216
    199217bool HDHRChannel::DeviceSetTarget(unsigned short localPort)
     
    257275    if (!inputName.isEmpty())
    258276        return SwitchToInput(inputName, channum);
    259277
    260     SetCachedATSCInfo("");
     278    ClearDTVInfo();
     279    _ignore_filters = false;
    261280
    262281    InputMap::const_iterator it = inputs.find(currentInputID);
    263282    if (it == inputs.end())
     
    312331    curchannelname = QDeepCopy<QString>(channum);
    313332
    314333    // Set the major and minor channel for any additional multiplex tuning
    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));
     334    SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);
    321335
    322336    // Set this as the future start channel for this source
    323     inputs[currentInputID]->startChanNum = curchannelname;
     337    inputs[currentInputID]->startChanNum = QDeepCopy<QString>(curchannelname);
    324338
     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
    325347    return true;
    326348}
    327349
     
    423445    it = lower_bound(_pids.begin(), _pids.end(), pid);
    424446    if (it != _pids.end() && *it == pid)
    425447    {
     448#ifdef DEBUG_PID_FILTERS
    426449        VERBOSE(VB_CHANNEL, "AddPID(0x"<<hex<<pid<<dec<<") NOOP");
     450#endif // DEBUG_PID_FILTERS
    427451        return true;
    428452    }
    429453
    430454    _pids.insert(it, pid);
    431455
     456#ifdef DEBUG_PID_FILTERS
    432457    VERBOSE(VB_CHANNEL, "AddPID(0x"<<hex<<pid<<dec<<")");
     458#endif // DEBUG_PID_FILTERS
    433459
    434460    if (do_update)
    435461        return UpdateFilters();
     
    444470    it = lower_bound(_pids.begin(), _pids.end(), pid);
    445471    if (it == _pids.end())
    446472    {
     473#ifdef DEBUG_PID_FILTERS
    447474        VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") NOOP");
    448         return true;
     475#endif // DEBUG_PID_FILTERS
     476
     477       return true;
    449478    }
    450479
    451480    if (*it == pid)
    452481    {
     482#ifdef DEBUG_PID_FILTERS
    453483        VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") -- found");
     484#endif // DEBUG_PID_FILTERS
    454485        _pids.erase(it);
    455486    }
    456487    else
    457488    {
     489#ifdef DEBUG_PID_FILTERS
    458490        VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") -- failed");
     491#endif // DEBUG_PID_FILTERS
    459492    }
    460493
    461494    if (do_update)
     
    467500{
    468501    QMutexLocker locker(&_lock);
    469502
     503#ifdef DEBUG_PID_FILTERS
    470504    VERBOSE(VB_CHANNEL, "DelAllPID()");
     505#endif // DEBUG_PID_FILTERS
     506
    471507    _pids.clear();
    472508
    473509    return UpdateFilters();
     
    493529    vector<uint> range_min;
    494530    vector<uint> range_max;
    495531
     532    if (_ignore_filters)
     533        return true;
     534
    496535    for (uint i = 0; i < _pids.size(); i++)
    497536    {
    498537        uint pid_min = _pids[i];
     
    528567
    529568    QString new_filter = TunerSet("filter", filter);
    530569
     570#ifdef DEBUG_PID_FILTERS
    531571    QString msg = QString("Filter: '%1'").arg(filter);
    532572    if (filter != new_filter)
    533573        msg += QString("\n\t\t\t\t'%2'").arg(new_filter);
    534574
    535575    VERBOSE(VB_CHANNEL, msg);
     576#endif // DEBUG_PID_FILTERS
    536577
    537578    return filter == new_filter;
    538579}
  • libs/libmythtv/dvbchannel.h

     
    7272
    7373  private:
    7474    int  GetChanID(void) const;
    75     bool InitChannelParams(DTVMultiplex &t,
    76                            uint sourceid, const QString &channum);
    7775
    7876    void CheckOptions(DTVMultiplex &t) const;
    7977    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; }
    4446
    4547    // Gets
    4648
     
    6769    /// \brief Returns PSIP table standard: MPEG, DVB, ATSC, or OpenCable
    6870    QString GetSIStandard(void) const;
    6971
     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
    7078    /** \brief Returns cached MPEG PIDs for last tuned channel.
    7179     *  \param pid_cache List of PIDs with their TableID
    7280     *                   types is returned in pid_cache.
     
    7684
    7785    // Sets
    7886
     87    /// \brief Sets tuning mode: "mpeg", "dvb", "atsc", etc.
     88    void SetTuningMode(const QString &tuningmode);
     89
    7990    /** \brief Saves MPEG PIDs to cache to database
    8091     * \param pid_cache List of PIDs with their TableID types to be saved.
    8192     */
     
    8596  protected:
    8697    /// \brief Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable
    8798    void SetSIStandard(const QString&);
    88     void SetCachedATSCInfo(const QString &chan);
     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); }
    89103
    90104    static void GetCachedPids(int chanid, pid_cache_t&);
    91105    static void SaveCachedPids(int chanid, const pid_cache_t&);
     
    94108    mutable QMutex dtvinfo_lock;
    95109
    96110    QString sistandard; ///< PSIP table standard: MPEG, DVB, ATSC, OpenCable
     111    QString tuningMode;
    97112    int     currentProgramNum;
    98113    uint    currentATSCMajorChannel;
    99114    uint    currentATSCMinorChannel;
  • libs/libmythtv/mpeg/atscstreamdata.cpp

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

     
    238238    QString loc_err = LOC_ERR + tmp;
    239239
    240240    VERBOSE(VB_CHANNEL, loc);
     241
     242    ClearDTVInfo();
     243
    241244    if (fd_frontend < 0)
    242245    {
    243246        VERBOSE(VB_IMPORTANT, loc_err + "Channel object "
     
    272275    if (it == inputs.end())
    273276        return false;
    274277
    275     // Initialize all the tuning parameters
     278    // Get the input data for the channel
     279    QString tvformat, modulation, freqtable, freqid, si_std;
     280    int finetune;
     281    uint64_t frequency;
     282    int mpeg_prog_num;
     283    uint atsc_major, atsc_minor, mplexid, tsid, netid;
     284
     285    if (!ChannelUtil::GetChannelData(
     286        (*it)->sourceid, channum,
     287        tvformat, modulation, freqtable, freqid,
     288        finetune, frequency,
     289        si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
     290        mplexid, commfree))
     291    {
     292        VERBOSE(VB_IMPORTANT, loc_err +
     293                "Unable to find channel in database.");
     294
     295        return false;
     296    }
     297
     298    // Initialize basic the tuning parameters
    276299    DTVMultiplex tuning;
    277     if (!InitChannelParams(tuning, (*it)->sourceid, channum))
     300    if (!mplexid || !tuning.FillFromDB(card_type, mplexid))
    278301    {
    279302        VERBOSE(VB_IMPORTANT, loc_err +
    280                 "Failed to initialize channel options");
     303                "Failed to initialize multiplex options");
    281304
    282305        return false;
    283306    }
    284307
     308    SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);
     309
     310    // Try to fix any problems with the multiplex
    285311    CheckOptions(tuning);
    286312
    287313    if (!Tune(tuning, ""))
    288314    {
    289315        VERBOSE(VB_IMPORTANT, loc_err + "Tuning to frequency.");
    290316
     317        ClearDTVInfo();
    291318        return false;
    292319    }
    293320
     
    332359    return SetChannelByString((*it)->startChanNum);
    333360}
    334361
    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  */
    340 bool 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 
    371362/** \fn DVBChannel::CheckOptions(DTVMultiplex&) const
    372363 *  \brief Checks tuning for problems, and tries to fix them.
    373364 */
  • libs/libmythtv/cardutil.cpp

     
    448448    return needsConf;
    449449}
    450450
     451uint 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
    451472bool CardUtil::hasV4L2(int videofd)
    452473{
    453474    (void) videofd;
  • libs/libmythtv/videosource.cpp

     
    15691569    };
    15701570};
    15711571
     1572class QuickTune : public ComboBoxSetting, public CardInputDBStorage
     1573{
     1574  public:
     1575    QuickTune(const CardInput &parent) :
     1576        ComboBoxSetting(this), CardInputDBStorage(this, parent, "quicktune")
     1577    {
     1578        setLabel(QObject::tr("Use quick tuning"));
     1579        addSelection(QObject::tr("Never"),        "0", true);
     1580        //addSelection(QObject::tr("Live TV only"), "1", true);
     1581        addSelection(QObject::tr("Always"),       "2", false);
     1582        setHelpText(QObject::tr(
     1583                        "If enabled MythTV will tune using only the "
     1584                        "MPEG program number. The program numbers "
     1585                        "change more often than DVB or ATSC tuning "
     1586                        "parameters, so this is slightly less reliable."));
     1587    };
     1588};
     1589
    15721590class ExternalChannelCommand :
    15731591    public LineEditSetting, public CardInputDBStorage
    15741592{
     
    17081726    group->addChild(ci);
    17091727    group->addChild(new InputDisplayName(*this));
    17101728    group->addChild(sourceid);
    1711     if (!isDVBcard)
     1729
     1730    if (!isDTVcard)
    17121731    {
    17131732        group->addChild(new ExternalChannelCommand(*this));
    17141733        group->addChild(new PresetTuner(*this));
     
    17181737    {
    17191738        // we place this in a group just so the margins match the DVB ones.
    17201739        ConfigurationGroup *chgroup =
    1721             new HorizontalConfigurationGroup(false, false, true, true);
     1740            new VerticalConfigurationGroup(false, false, true, true);
     1741        chgroup->addChild(new QuickTune(*this));
    17221742        chgroup->addChild(new FreeToAir(*this));
    17231743        group->addChild(chgroup);
    17241744    }
  • libs/libmythtv/iptvchannel.cpp

     
    129129        return false;
    130130    }
    131131
    132     // Set the channel..
    133     curchannelname = channum;
    134     currentProgramNum = 1;
     132    // Set the current channum to the new channel's channum
     133    curchannelname = QDeepCopy<QString>(channum);
    135134
     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
    136140    VERBOSE(VB_CHANNEL, LOC + "SetChannelByString() -- end");
    137141    return true;
    138142}
  • libs/libmythtv/tv_rec.cpp

     
    774774    changeState = false;
    775775
    776776    eitScanStartTime = QDateTime::currentDateTime();   
    777     if ((internalState == kState_None) && (genOpt.cardtype == "DVB"))
     777    if ((internalState == kState_None) &&
     778        CardUtil::IsEITCapable(genOpt.cardtype))
    778779    {
    779780        // Add some randomness to avoid all cards starting
    780781        // EIT scanning at nearly the same time.
     
    998999    MythEvent me("RECORDING_LIST_CHANGE");
    9991000    gContext->dispatch(me);
    10001001    pauseNotify = true;
    1001 }   
    10021002
     1003    if (GetDTVChannel())
     1004        GetDTVChannel()->EnterPowerSavingMode();
     1005}
     1006
    10031007DVBRecorder *TVRec::GetDVBRecorder(void)
    10041008{
    10051009#ifdef USING_DVB
     
    10711075        }
    10721076        VERBOSE(VB_IMPORTANT, LOC_ERR + msg1 + "\n\t\t\t" + msg2);
    10731077    }
     1078
     1079    if (GetDTVChannel())
     1080        GetDTVChannel()->EnterPowerSavingMode();
    10741081}
    10751082
    10761083void TVRec::CloseChannel(void)
     
    16681675        sd->SetCaching(true);
    16691676    }
    16701677
    1671     QString sistandard = dtvchan->GetSIStandard();
     1678    uint neededVideo = 0;
     1679    uint neededAudio = 0;
    16721680
     1681    ProgramInfo *rec = lastTuningRequest.program;
     1682    RecordingProfile profile;
     1683    load_profile(genOpt.cardtype, tvchain, rec, profile);
     1684    const Setting *setting = profile.byName("recordingtype");
     1685    if (setting)
     1686    {
     1687        neededVideo = (setting->getValue() == "tv") ? 1 : 0;
     1688        neededAudio = (setting->getValue() == "audio") ? 1 : 0;
     1689    }
     1690
     1691    const QString tuningmode = dtvchan->GetTuningMode();
     1692
    16731693    // Check if this is an ATSC Channel
    16741694    int major = dtvchan->GetMajorChannel();
    16751695    int minor = dtvchan->GetMinorChannel();
    1676     if ((minor > 0) && (sistandard == "atsc"))
     1696    if ((minor > 0) && (tuningmode == "atsc"))
    16771697    {
    16781698        QString msg = QString("ATSC channel: %1_%2").arg(major).arg(minor);
    16791699        VERBOSE(VB_RECORD, LOC + msg);
     
    16901710        asd->Reset(major, minor);
    16911711        sm->SetStreamData(sd);
    16921712        sm->SetChannel(major, minor);
    1693         sd->SetVideoStreamsRequired(1);
     1713        sd->SetVideoStreamsRequired(neededVideo);
     1714        sd->SetAudioStreamsRequired(neededAudio);
    16941715
    16951716        // Try to get pid of VCT from cache and
    16961717        // require MGT if we don't have VCT pid.
     
    17041725    // Check if this is an DVB channel
    17051726    int progNum = dtvchan->GetProgramNumber();
    17061727#ifdef USING_DVB
    1707     if ((progNum >= 0) && (sistandard == "dvb"))
     1728    if ((progNum >= 0) && (tuningmode == "dvb"))
    17081729    {
    17091730        int netid   = dtvchan->GetOriginalNetworkID();
    17101731        int tsid    = dtvchan->GetTransportID();
    17111732
    1712         uint neededVideo = 0;
    1713         uint neededAudio = 0;
    1714 
    17151733        DVBStreamData *dsd = dynamic_cast<DVBStreamData*>(sd);
    17161734        if (!dsd)
    17171735        {
     
    17211739                GetDTVRecorder()->SetStreamData(dsd);
    17221740        }
    17231741
    1724         ProgramInfo *rec = lastTuningRequest.program;
    1725         RecordingProfile profile;
    1726         load_profile(genOpt.cardtype, tvchain, rec, profile);
    1727         const Setting *setting = profile.byName("recordingtype");
    1728         if (setting)
    1729         {
    1730             neededVideo = (setting->getValue() == "tv") ? 1 : 0;
    1731             neededAudio = (setting->getValue() == "audio") ? 1 : 0;
    1732         }
    1733 
    17341742        VERBOSE(VB_RECORD, LOC +
    17351743                QString("DVB service_id %1 on net_id %2 tsid %3")
    17361744                .arg(progNum).arg(netid).arg(tsid));
     
    17821790        sd->Reset(progNum);
    17831791        sm->SetStreamData(sd);
    17841792        sm->SetProgramNumber(progNum);
    1785         sd->SetVideoStreamsRequired(1);
     1793        sd->SetVideoStreamsRequired(neededVideo);
     1794        sd->SetAudioStreamsRequired(neededAudio);
     1795
    17861796        sm->AddFlags(SignalMonitor::kDTVSigMon_WaitForPAT |
    17871797                     SignalMonitor::kDTVSigMon_WaitForPMT |
    17881798                     SignalMonitor::kDVBSigMon_WaitForPos);
     
    17931803    }
    17941804
    17951805    QString msg = "No valid DTV info, ATSC maj(%1) min(%2), MPEG pn(%3)";
    1796     VERBOSE(VB_RECORD, LOC_ERR + msg.arg(major).arg(minor).arg(progNum));
     1806    VERBOSE(VB_IMPORTANT, LOC_ERR + msg.arg(major).arg(minor).arg(progNum));
    17971807    return false;
    17981808}
    17991809
     
    23212331    long long bitrate;
    23222332    if (genOpt.cardtype == "MPEG")
    23232333        bitrate = 10080000LL; // use DVD max bit rate
    2324     else if (genOpt.cardtype == "HDTV")
     2334    else if (genOpt.cardtype == "DBOX2")
     2335        bitrate = 10080000LL; // use DVD max bit rate
     2336    else if (!CardUtil::IsEncoder(genOpt.cardtype))
    23252337        bitrate = 19400000LL; // 1080i
    2326     else if (genOpt.cardtype == "FIREWIRE")
    2327         bitrate = 19400000LL; // 1080i
    2328     else if (genOpt.cardtype == "DVB")
    2329         bitrate = 19400000LL; // 1080i
    23302338    else // frame grabber
    23312339        bitrate = 10080000LL; // use DVD max bit rate, probably too big
    23322340
     
    33923400 */
    33933401void TVRec::TuningFrequency(const TuningRequest &request)
    33943402{
    3395     if (request.minorChan)
     3403    DTVChannel *dtvchan = GetDTVChannel();
     3404    if (dtvchan)
    33963405    {
    3397         MPEGStreamData *mpeg = GetDTVRecorder()->GetStreamData();
    3398         ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg);
    3399         channel->SetChannelByString(request.channel);
    3400         atsc->SetDesiredChannel(request.majorChan, request.minorChan);
     3406        MPEGStreamData *mpeg = NULL;
     3407
     3408        if (GetDTVRecorder())
     3409            mpeg = GetDTVRecorder()->GetStreamData();
     3410
     3411        const QString tuningmode = (HasFlags(kFlagEITScannerRunning)) ?
     3412            dtvchan->GetSIStandard() :
     3413            dtvchan->GetSuggestedTuningMode(
     3414                kState_WatchingLiveTV == internalState);
     3415
     3416        dtvchan->SetTuningMode(tuningmode);
     3417
     3418        if (request.minorChan && (tuningmode == "atsc"))
     3419        {
     3420            channel->SetChannelByString(request.channel);
     3421
     3422            ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg);
     3423            if (atsc)
     3424                atsc->SetDesiredChannel(request.majorChan, request.minorChan);
     3425        }
     3426        else if (request.progNum >= 0)
     3427        {
     3428            channel->SetChannelByString(request.channel);
     3429
     3430            if (mpeg)
     3431                mpeg->SetDesiredProgram(request.progNum);
     3432        }
    34013433    }
    3402     else if (request.progNum >= 0)
    3403     {
    3404         MPEGStreamData *mpeg = GetDTVRecorder()->GetStreamData();
    3405         channel->SetChannelByString(request.channel);
    3406         mpeg->SetDesiredProgram(request.progNum);
    3407     }
     3434
    34083435    if (request.IsOnSameMultiplex())
    34093436    {
    34103437        QStringList slist;
  • libs/libmythtv/recordingprofile.cpp

     
    10371037                    this,        SLOT(FiltersChanged(const QString&)));
    10381038        }
    10391039    }
    1040     else if (type.upper() == "DVB")
     1040    else
    10411041    {
    10421042        addChild(new RecordingType(*this));
    10431043    }
  • libs/libmythtv/channel.cpp

     
    441441    if (!inputName.isEmpty())
    442442        return ChannelBase::SwitchToInput(inputName, channum);
    443443
    444     SetCachedATSCInfo("");
     444    ClearDTVInfo();
    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     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));
     519    SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);
    523520
    524521    // Set this as the future start channel for this source
    525     inputs[currentInputID]->startChanNum = curchannelname;
     522    inputs[currentInputID]->startChanNum = QDeepCopy<QString>(curchannelname);
    526523
    527524    return true;
    528525}
  • libs/libmythtv/hdhrchannel.h

     
    2929
    3030    bool Open(void);
    3131    void Close(void);
     32    bool EnterPowerSavingMode(void);
    3233
    3334    // Sets
    3435    bool SetChannelByString(const QString &chan);
     
    6263    bool DeviceSetTarget(unsigned short localPort);
    6364    bool DeviceClearTarget(void);
    6465
    65     QString DeviceGet(const QString &name);
    66     QString DeviceSet(const QString &name, const QString &value);
     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);
    6769
    68     QString TunerGet(const QString &name);
    69     QString TunerSet(const QString &name, const QString &value);
     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);
    7073
    7174  private:
    7275    hdhr_socket_t  *_control_socket;
    7376    uint            _device_id;
    7477    uint            _device_ip;
    7578    uint            _tuner;
     79    bool            _ignore_filters;
    7680    vector<uint>    _pids;
    7781    mutable QMutex  _lock;
    7882};
  • libs/libmythtv/dtvchannel.cpp

     
    88// MythTV headers
    99#include "mythcontext.h"
    1010#include "mythdbcon.h"
     11#include "cardutil.h"
    1112
    1213#define LOC QString("DTVChan(%1): ").arg(GetDevice())
    1314#define LOC_WARN QString("DTVChan(%1) Warning: ").arg(GetDevice())
     
    1516
    1617DTVChannel::DTVChannel(TVRec *parent)
    1718    : ChannelBase(parent),
    18       sistandard("mpeg"),         currentProgramNum(-1),
     19      sistandard("mpeg"),         tuningMode(QString::null),
     20      currentProgramNum(-1),
    1921      currentATSCMajorChannel(0), currentATSCMinorChannel(0),
    2022      currentTransportID(0),      currentOriginalNetworkID(0)
    2123{
     
    8789    }
    8890}
    8991
    90 void DTVChannel::SetCachedATSCInfo(const QString &chan)
     92void DTVChannel::SetDTVInfo(uint atsc_major, uint atsc_minor,
     93                            uint dvb_orig_netid,
     94                            uint mpeg_tsid, int mpeg_pnum)
    9195{
    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     }
     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;
    140102}
    141103
    142104QString DTVChannel::GetSIStandard(void) const
     
    148110void DTVChannel::SetSIStandard(const QString &si_std)
    149111{
    150112    QMutexLocker locker(&dtvinfo_lock);
    151     sistandard = QDeepCopy<QString>(si_std);
     113    sistandard = QDeepCopy<QString>(si_std.lower());
    152114}
     115
     116QString 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
     134QString DTVChannel::GetTuningMode(void) const
     135{
     136    QMutexLocker locker(&dtvinfo_lock);
     137    return QDeepCopy<QString>(tuningMode);
     138}
     139
     140void DTVChannel::SetTuningMode(const QString &tuning_mode)
     141{
     142    QMutexLocker locker(&dtvinfo_lock);
     143    tuningMode = QDeepCopy<QString>(tuning_mode.lower());
     144}