Ticket #13: tune2startchannel.1.patch

File tune2startchannel.1.patch, 7.4 KB (added by stuarta@…, 19 years ago)

Updated Patch. Works against svn rev#6987

  • libs/libmythtv/firewirechannel.cpp

     
    8989
    9090}
    9191   
    92 void FirewireChannel::SwitchToInput(const QString &input, const QString &chan)
     92bool FirewireChannel::SwitchToInput(const QString &input, const QString &chan)
    9393{
    9494    currentcapchannel = 0;
    9595    if (channelnames.empty())
    9696       channelnames[currentcapchannel] = input;
    9797
    98     SetChannelByString(chan);
     98    return SetChannelByString(chan);
    9999}
    100100
    101101void FirewireChannel::SetExternalChanger(void) {
  • libs/libmythtv/dvbchannel.h

     
    5858    bool        IsPMTSet()              const { return chan_opts.IsPMTSet(); }
    5959
    6060    // Commands
    61     void SwitchToInput(const QString &inputname, const QString &chan);
     61    bool SwitchToInput(const QString &inputname, const QString &chan);
    6262    void SwitchToInput(int newcapchannel, bool setstarting)
    6363        { (void)newcapchannel; (void)setstarting; }
    6464    bool Tune(const dvb_channel_t& channel, bool force_reset=false);
  • libs/libmythtv/dvbchannel.cpp

     
    246246    }
    247247    curchannelname = chan;
    248248
    249     GENERAL(QString("Successfully tuned to channel %1.").arg(chan));
    250 
    251249    if (!chan_opts.pmt.OnAir())
    252250    {
    253251        ERROR(QString("Channel #%1 is off air.").arg(chan));
    254252        return false;
    255253    }
    256254
     255    GENERAL(QString("Successfully tuned to channel %1.").arg(chan));
     256
    257257    inputChannel[currentcapchannel] = curchannelname;
    258258
    259259#if (DVB_API_VERSION_MINOR == 1)
     
    271271        emit ChannelChanged(chan_opts);
    272272}
    273273
    274 void DVBChannel::SwitchToInput(const QString &input, const QString &chan)
     274bool DVBChannel::SwitchToInput(const QString &input, const QString &chan)
    275275{
    276276    currentcapchannel = 0;
    277277    if (channelnames.empty())
    278278       channelnames[currentcapchannel] = input;
    279279
    280     SetChannelByString(chan);
     280    return SetChannelByString(chan);
    281281}
    282282
    283283/** \fn DVBChannel::GetChannelOptions(const QString&)
  • libs/libmythtv/firewirechannel.h

     
    4444        { return QString("%1:%2").arg(fw_opts.port).arg(fw_opts.node); }
    4545
    4646    // Commands
    47     void SwitchToInput(const QString &inputname, const QString &chan);
     47    bool SwitchToInput(const QString &inputname, const QString &chan);
    4848    void SwitchToInput(int newcapchannel, bool setstarting)
    4949        { (void)newcapchannel; (void)setstarting; }
    5050
  • libs/libmythtv/tv_rec.cpp

     
    960960    gContext->dispatch(me);
    961961}   
    962962
    963 void TVRec::InitChannel(const QString &inputname, const QString &startchannel)
     963void TVRec::InitChannel(const QString &inputname, QString &startchannel)
    964964{
     965    bool tuneSuccess;
    965966    if (!channel)
    966967        return;
    967968
     
    976977
    977978    QString chanorder = gContext->GetSetting("ChannelOrdering", "channum + 0");
    978979    if (inputname.isEmpty())
    979         channel->SetChannelByString(startchannel);
     980        tuneSuccess=channel->SetChannelByString(startchannel);
    980981    else
    981         channel->SwitchToInput(inputname, startchannel);
     982        tuneSuccess=channel->SwitchToInput(inputname, startchannel);
     983
     984    if (!tuneSuccess)
     985    {
     986        startchannel=gContext->GetSetting("DefaultTVChannel");
     987        if (inputname.isEmpty())
     988            tuneSuccess=channel->SetChannelByString(startchannel);
     989        else
     990            tuneSuccess=channel->SwitchToInput(inputname, startchannel);
     991    }
     992
     993    if (!tuneSuccess)
     994        VERBOSE(VB_IMPORTANT,"Utter failuer to tune to a channel");
     995
    982996    channel->SetChannelOrdering(chanorder);
    983997}
    984998
     
    31643178    }
    31653179
    31663180}
    3167 
  • libs/libmythtv/channelbase.h

     
    7878    // Input toggling convenience methods
    7979    virtual void ToggleInputs(void);
    8080    virtual void SwitchToInput(const QString &input);
    81     virtual void SwitchToInput(const QString &input, const QString &chan);
     81    virtual bool SwitchToInput(const QString &input, const QString &chan);
    8282
    8383    /// Saves current channel as the default channel for the current input.
    8484    virtual void StoreInputChannels(void);
  • libs/libmythtv/tv_rec.h

     
    193193    void SetupRecorder(class RecordingProfile& profile);
    194194    void TeardownRecorder(bool killFile = false);
    195195   
    196     void InitChannel(const QString &inputname, const QString &startchannel);
     196    void InitChannel(const QString &inputname, QString &startchannel);
    197197    void CloseChannel(void);
    198198
    199199    void SetupSignalMonitor(void);
  • libs/libmythtv/channelbase.cpp

     
    9090                                      "%1 on card\n").arg(inputname));
    9191}
    9292
    93 void ChannelBase::SwitchToInput(const QString &inputname, const QString &chan)
     93bool ChannelBase::SwitchToInput(const QString &inputname, const QString &chan)
    9494{
    9595    int input = GetInputByName(inputname);
    9696
    9797    if (input >= 0)
    9898    {
    9999        SwitchToInput(input, false);
    100         SetChannelByString(chan);
     100        return SetChannelByString(chan);
    101101    }
    102102    else
     103    {
    103104        VERBOSE(VB_IMPORTANT,
    104105                QString("ChannelBase: Could not find input: %1 on card when "
    105106                        "setting channel %2\n").arg(inputname).arg(chan));
     107        return false;
     108    }
    106109}
    107110
    108111bool ChannelBase::ChangeExternalChannel(const QString &channum)
  • libs/libmythtv/channel.cpp

     
    463463    // and return, since the act of changing inputs will change the channel as well.
    464464    if (!inputName.isEmpty())
    465465    {
    466         ChannelBase::SwitchToInput(inputName, chan);
    467         SetCachedATSCInfo(atsc_chan);
    468         return true;
     466        if(ChannelBase::SwitchToInput(inputName, chan))
     467        {
     468            SetCachedATSCInfo(atsc_chan);
     469            return true;
     470        }
     471        else return false;
    469472    }
    470473
    471474    QString modulation;
     
    794797        TuneTo(inputTuneTo[currentcapchannel], 0);
    795798
    796799    if (setstarting && !inputChannel[currentcapchannel].isEmpty())
    797         SetChannelByString(inputChannel[currentcapchannel]);
     800        if (!SetChannelByString(inputChannel[currentcapchannel]))
     801            VERBOSE(VB_IMPORTANT,"Channel::SwitchToInput() FAILED");
    798802}
    799803
    800804unsigned short *Channel::GetV4L1Field(int attrib, struct video_picture &vid_pic)
     
    10991103{
    11001104    return ChangeColourAttribute(V4L2_CID_HUE, "hue", up);
    11011105}
    1102