Ticket #802: dvbchannel.alt.8.patch

File dvbchannel.alt.8.patch, 5.3 KB (added by nooneimprt4nt@…, 18 years ago)

Alternate version

  • libs/libmythtv/dvbchannel.h

     
    9292    bool GetTransportOptions(int mplexid);
    9393    bool GetChannelOptions(const QString &channum);
    9494
     95    void InitializeInputs(void);
     96
    9597    void CheckOptions();
    9698    bool CheckModulation(fe_modulation_t modulation) const;
    9799    bool CheckCodeRate(fe_code_rate_t rate) const;
  • libs/libmythtv/dvbtypes.h

     
    423423        QString lnb_lof_hi,        QString lnb_lof_lo,     QString _sistandard,
    424424        QString hp_code_rate,      QString lp_code_rate,   QString constellation,
    425425        QString transmission_mode, QString guard_interval, QString hierarchy,
    426         QString modulation,        QString bandwidth);
     426        QString modulation,        QString bandwidth,      QString _input_id);
    427427
    428428    DVBTuning       tuning;
    429429
     
    436436    uint16_t        transportID;
    437437
    438438    QString         sistandard;
     439    int             input_id;
    439440    uint8_t         version;
    440441  private:
    441442    mutable QMutex  lock;
  • libs/libmythtv/dvbchannel.cpp

     
    125125    }
    126126}
    127127
     128/** \fn DVBChannel::InitializeInputs(void)
     129 *  This enumerates the inputs, from a DiSEqC switch if available
     130 */
     131void DVBChannel::InitializeInputs(void)
     132{
     133
     134    channelnames.clear();
     135    inputChannel.clear();
     136   
     137    MSqlQuery query(MSqlQuery::InitCon());
     138    query.prepare(
     139        "SELECT cardinputid, inputname, "
     140        "       if (startchan, startchan, '') "
     141        "FROM cardinput "
     142        "WHERE cardid = :CARDID");
     143    query.bindValue(":CARDID", GetCardID());
     144
     145    if (!query.exec() || !query.isActive())
     146    {
     147        MythContext::DBError("InitializeInputs", query);
     148        return;
     149    }
     150    else if (!query.size())
     151    {
     152        VERBOSE(VB_IMPORTANT, "dvbchannel.cpp::InitializeInputs"
     153                "\n\t\t\tCould not get inputs for the capturecard."
     154                "\n\t\t\tPerhaps you have forgotten to bind video"
     155                "\n\t\t\tsources to your card's inputs?");
     156        return;
     157    }
     158
     159    while (query.next())
     160    {
     161        int inputNum              = query.value(0).toInt();
     162        channelnames[inputNum]    = query.value(1).toString();
     163        inputChannel[inputNum]    = query.value(2).toString();
     164    }
     165
     166    // print em
     167    InputNames::const_iterator it;
     168    for (it = channelnames.begin(); it != channelnames.end(); ++it)
     169    {
     170        VERBOSE(VB_CHANNEL, QString("Input #%1: '%2' schan(%3)")
     171                .arg(it.key()).arg(*it)
     172                .arg(inputChannel[it.key()]));
     173    }
     174}
     175
    128176bool DVBChannel::Open()
    129177{
    130178    CHANNEL("Opening DVB channel");
     
    171219
    172220    first_tune = true;
    173221
     222    InitializeInputs();
     223
    174224    return (fd_frontend >= 0 );
    175225}
    176226
     
    234284
    235285    CHANNEL(QString("Tuned to frequency for channel %1.").arg(chan));
    236286
     287    currentcapchannel = chan_opts.input_id;
    237288    inputChannel[currentcapchannel] = curchannelname;
    238 
     289   
    239290    return true;
    240291}
    241292
     
    250301
    251302bool DVBChannel::SwitchToInput(const QString &input, const QString &chan)
    252303{
    253     currentcapchannel = 0;
    254     if (channelnames.empty())
    255        channelnames[currentcapchannel] = input;
    256 
     304    (void)input;
    257305    return SetChannelByString(chan);
    258306}
    259307
     
    338386        "       lnb_lof_hi,        lnb_lof_lo,     sistandard, "
    339387        "       hp_code_rate,      lp_code_rate,   constellation, "
    340388        "       transmission_mode, guard_interval, hierarchy, "
    341         "       modulation,        bandwidth "
     389        "       modulation,        bandwidth,      cardinputid "
    342390        "FROM dtv_multiplex, cardinput, capturecard "
    343391        "WHERE dtv_multiplex.sourceid = cardinput.sourceid AND ");
    344392
     
    370418        query.value(12).toString(), query.value(13).toString(),
    371419        query.value(14).toString(), query.value(15).toString(),
    372420        query.value(16).toString(), query.value(17).toString(),
    373         query.value(18).toString(), query.value(19).toString());
     421        query.value(18).toString(), query.value(19).toString(),
     422        query.value(20).toString());
    374423}
    375424
    376425/** \fn DVBChannel::CheckOptions()
  • libs/libmythtv/dvbtypes.cpp

     
    906906    QString lnb_lof_hi,        QString lnb_lof_lo,     QString _sistandard,
    907907    QString hp_code_rate,      QString lp_code_rate,   QString constellation,
    908908    QString trans_mode,        QString guard_interval, QString hierarchy,
    909     QString modulation,        QString bandwidth)
     909    QString modulation,        QString bandwidth,      QString _input_id)
    910910{
    911911    lock.lock();
    912912       
     
    928928        ok = tuning.parseATSC(frequency, modulation);
    929929       
    930930    sistandard = _sistandard;
    931        
     931    input_id   = _input_id.toInt();
     932
    932933    lock.unlock();
    933934    return ok;
    934935}