Ticket #4501: 4501-v1.patch

File 4501-v1.patch, 8.5 KB (added by danielk, 3 years ago)

Updated patch to trunk, not tested or reviewed

  • libs/libmythtv/tv_play.h

     
    250250                            bool isDVD, bool isDVDStillFrame); 
    251251 
    252252    void GetNextProgram(RemoteEncoder *enc, int direction, 
    253                         InfoMap &infoMap); 
     253                        InfoMap &infoMap) const; 
    254254 
    255255    // static functions 
    256256    static void InitKeys(void); 
     
    494494 
    495495    void ToggleRecord(PlayerContext*); 
    496496 
     497    uint    GetChanIDAnyTuner(const QString &chan) const; 
     498    QString GetChanNumAnyTuner(const uint &chanid) const; 
     499    void    GetNextProgramAnyTuner(int direction, InfoMap &infoMap, 
     500                                   ProgramInfo *prog) const; 
     501 
    497502    void DoTogglePictureAttribute(const PlayerContext*, 
    498503                                  PictureAdjustType type); 
    499504    void DoChangePictureAttribute( 
     
    682687    QString browsechannum; 
    683688    QString browsechanid; 
    684689    QString browsestarttime; 
     690    bool browsealltuners; 
     691    DBChanList allchannels;    
    685692 
    686693    // Program Info for currently playing video 
    687694    // (or next video if InChangeState() is true) 
  • libs/libmythtv/tv_play.cpp

     
    654654      // channel browsing state variables 
    655655      browsemode(false), persistentbrowsemode(false), 
    656656      browsechannum(""), browsechanid(""), browsestarttime(""), 
     657      browsealltuners(false), 
    657658      // Program Info for currently playing video 
    658659      lastProgram(NULL), 
    659660      inPlaylist(false), underNetworkControl(false), 
     
    759760        ff_rew_speeds.push_back( 
    760761            gContext->GetNumSetting(QString("FFRewSpeed%1").arg(i), def[i])); 
    761762 
     763    browsealltuners = gContext->GetNumSetting("BrowseAllTuners", 0); 
     764    if (browsealltuners) 
     765    { 
     766        QString channelOrdering = gContext->GetSetting( 
     767            "ChannelOrdering", "channum"); 
     768        allchannels = ChannelUtil::GetChannels(0, true, "channum, callsign"); 
     769        ChannelUtil::SortChannels(allchannels, channelOrdering, true); 
     770    } 
     771 
    762772    vbimode = VBIMode::Parse(gContext->GetSetting("VbiFormat")); 
    763773    QString feVBI = gContext->GetSetting("DecodeVBIFormat", ""); 
    764774    if (!feVBI.isEmpty()) 
     
    71357145 *  \param infoMap InfoMap to fill in with returned data 
    71367146 */ 
    71377147void TV::GetNextProgram(RemoteEncoder *enc, int direction, 
    7138                         InfoMap &infoMap) 
     7148                        InfoMap &infoMap) const 
    71397149{ 
    71407150    QString title, subtitle, desc, category, endtime, callsign, iconpath; 
    71417151    QDateTime begts, endts; 
     
    71467156    QString seriesid  = infoMap["seriesid"]; 
    71477157    QString programid = infoMap["programid"]; 
    71487158 
    7149     PlayerContext *actx = NULL; 
     7159    const PlayerContext *actx = NULL; 
    71507160    if (!enc) 
    71517161    { 
    71527162        actx = GetPlayerReadLock(-1, __FILE__, __LINE__); 
     
    73547364    embedCheckTimerId = 0; 
    73557365} 
    73567366 
     7367uint TV::GetChanIDAnyTuner(const QString &chan) const 
     7368{ 
     7369    for (uint i = 0; i < allchannels.size(); ++i) 
     7370    { 
     7371        if (allchannels[i].channum == chan) 
     7372            return allchannels[i].chanid; 
     7373    } 
     7374    return 0; 
     7375} 
     7376 
     7377QString TV::GetChanNumAnyTuner(const uint &chanid) const 
     7378{ 
     7379    for (uint i = 0; i < allchannels.size(); ++i) 
     7380    { 
     7381        if (allchannels[i].chanid == chanid) 
     7382            return allchannels[i].channum; 
     7383    } 
     7384    return ""; 
     7385} 
     7386 
     7387void TV::GetNextProgramAnyTuner(int direction, InfoMap &infoMap, 
     7388                                ProgramInfo *prog) const 
     7389{ 
     7390    uint chanid = infoMap["chanid"].toUInt(); 
     7391    if (!chanid) 
     7392        chanid = GetChanIDAnyTuner(infoMap["channum"]); 
     7393         
     7394    int chandir = -1; 
     7395    switch (direction) 
     7396    { 
     7397        case BROWSE_UP:       chandir = CHANNEL_DIRECTION_UP;       break; 
     7398        case BROWSE_DOWN:     chandir = CHANNEL_DIRECTION_DOWN;     break; 
     7399        case BROWSE_FAVORITE: chandir = CHANNEL_DIRECTION_FAVORITE; break; 
     7400    } 
     7401    if (direction != -1) 
     7402        chanid = ChannelUtil::GetNextChannel(allchannels, chanid, 0, chandir); 
     7403 
     7404    infoMap["chanid"] = QString("%1").arg(chanid); 
     7405    infoMap["channum"] = GetChanNumAnyTuner(chanid); 
     7406 
     7407    QDateTime nowtime = QDateTime::currentDateTime(); 
     7408    QDateTime latesttime = nowtime.addSecs(6*60*60); 
     7409    QDateTime browsetime = QDateTime::fromString( 
     7410        infoMap["dbstarttime"], Qt::ISODate); 
     7411 
     7412    MSqlBindings bindings; 
     7413    bindings[":CHANID"] = chanid; 
     7414    bindings[":NOWTS"] = nowtime.toString("yyyy-MM-ddThh:mm:ss"); 
     7415    bindings[":LATESTTS"] = latesttime.toString("yyyy-MM-ddThh:mm:ss"); 
     7416    bindings[":BROWSETS"] = browsetime.toString("yyyy-MM-ddThh:mm:ss"); 
     7417    bindings[":BROWSETS2"] = browsetime.toString("yyyy-MM-ddThh:mm:ss"); 
     7418 
     7419    QString querystr = " WHERE program.chanid = :CHANID "; 
     7420    switch (direction) 
     7421    { 
     7422        case BROWSE_LEFT: 
     7423            querystr += " AND program.endtime <= :BROWSETS " 
     7424                " AND program.endtime > :NOWTS "; 
     7425            break; 
     7426 
     7427        case BROWSE_RIGHT: 
     7428            querystr += " AND program.starttime > :BROWSETS " 
     7429                " AND program.starttime < :LATESTTS "; 
     7430            break; 
     7431             
     7432        default: 
     7433            querystr += " AND program.starttime <= :BROWSETS " 
     7434                " AND program.endtime > :BROWSETS2 "; 
     7435    }; 
     7436 
     7437    ProgramList progList; 
     7438    progList.FromProgram(querystr, bindings); 
     7439     
     7440    if (progList.isEmpty()) 
     7441    { 
     7442        infoMap["dbstarttime"] = ""; 
     7443        return; 
     7444    } 
     7445 
     7446    prog = (direction == BROWSE_LEFT) ? 
     7447        progList[progList.size() - 1] : progList[0]; 
     7448 
     7449    infoMap["dbstarttime"] = prog->startts.toString(Qt::ISODate); 
     7450} 
     7451 
    73577452void TV::DrawUnusedRects(bool sync, PlayerContext *ctx) 
    73587453{ 
    73597454    VERBOSE(VB_IMPORTANT, LOC + "DrawUnusedRects() -- begin"); 
     
    84118506    infoMap["channum"]     = browsechannum; 
    84128507    infoMap["chanid"]      = browsechanid; 
    84138508 
    8414     if (ctx->recorder) 
     8509    ProgramInfo *program_info = NULL; 
     8510    if (ctx->recorder && !browsealltuners) 
    84158511        GetNextProgram(ctx->recorder, direction, infoMap); 
     8512    else 
     8513        GetNextProgramAnyTuner(direction, infoMap, program_info); 
    84168514 
    84178515    browsechannum = infoMap["channum"]; 
    84188516    browsechanid  = infoMap["chanid"]; 
     
    84238521        browsestarttime = infoMap["dbstarttime"]; 
    84248522    } 
    84258523 
    8426     QDateTime startts = QDateTime::fromString(browsestarttime, Qt::ISODate); 
    8427     ProgramInfo *program_info = 
    8428         ProgramInfo::GetProgramAtDateTime(browsechanid, startts); 
     8524    if (!program_info) 
     8525    { 
     8526        QDateTime startts = QDateTime::fromString( 
     8527            browsestarttime, Qt::ISODate); 
     8528        program_info = 
     8529            ProgramInfo::GetProgramAtDateTime(browsechanid, startts); 
     8530    } 
    84298531 
    84308532    if (program_info) 
    84318533        program_info->ToMap(infoMap); 
    84328534 
     8535    if (browsealltuners && !IsTunable(ctx, browsechanid.toUInt())) 
     8536        infoMap["channum"] = "x" + infoMap["channum"]; 
     8537 
    84338538    osd->ClearAllText("browse_info"); 
    84348539    osd->SetText("browse_info", infoMap, -1); 
    84358540 
     
    85038608 
    85048609void TV::BrowseChannel(PlayerContext *ctx, const QString &chan) 
    85058610{ 
    8506     if (!ctx->recorder || !ctx->recorder->CheckChannel(chan)) 
     8611    if (browsealltuners && !GetChanIDAnyTuner(chan)) 
    85078612        return; 
     8613    else if (!ctx->recorder || !ctx->recorder->CheckChannel(chan)) 
     8614        return; 
    85088615 
    85098616    browsechannum = chan; 
    85108617    browsechanid = QString::null; 
  • programs/mythfrontend/globalsettings.cpp

     
    19821982    return gc; 
    19831983} 
    19841984 
     1985static HostCheckBox *BrowseAllTuners() 
     1986{ 
     1987    HostCheckBox *gc = new HostCheckBox("BrowseAllTuners"); 
     1988    gc->setLabel(QObject::tr("Browse channels from all tuners")); 
     1989    gc->setValue(true); 
     1990    gc->setHelpText(QObject::tr("By default, browse mode only shows channels " 
     1991                    "on the currently active tuner. If enabled, browse mode " 
     1992                    "will shows all channels, no matter what tuner they " 
     1993                    "exist on.")); 
     1994    return gc; 
     1995} 
     1996 
    19851997static HostCheckBox *AggressiveBuffer() 
    19861998{ 
    19871999    HostCheckBox *gc = new HostCheckBox("AggressiveSoundcardBuffer"); 
     
    48304842    osd->addChild(OSDThemeFontSizeType()); 
    48314843    osd->addChild(EnableMHEG()); 
    48324844    osd->addChild(PersistentBrowseMode()); 
     4845    osd->addChild(BrowseAllTuners()); 
    48334846    addChild(osd); 
    48344847 
    48354848    VerticalConfigurationGroup *udp = new VerticalConfigurationGroup(false);