Ticket #7123: 7123_FREE_RECORDER_igrp_checks.diff

File 7123_FREE_RECORDER_igrp_checks.diff, 4.4 KB (added by Shane Shrybman, 10 years ago)
  • mythtv/programs/mythbackend/mainserver.cpp

    void MainServer::HandleFreeTuner(int cardid, PlaybackSock *pbs) 
    30953095
    30963096    SendResponse(pbssock, strlist);
    30973097}
    3098 
     3098// Only used here? Need to do igrp checks here and return
     3099// an available tuner. (available == igrp checks have passed).
    30993100void MainServer::HandleGetFreeRecorder(PlaybackSock *pbs)
    31003101{
    31013102    MythSocket *pbssock = pbs->getSocket();
    31023103    QString pbshost = pbs->getHostname();
    31033104
     3105    vector<uint> excluded_cardids;
    31043106    QStringList strlist;
    31053107    int retval = -1;
    31063108
    void MainServer::HandleGetFreeRecorder(PlaybackSock *pbs) 
    31253127                enchost = elink->GetHostName();
    31263128
    31273129            if (enchost == pbshost && elink->IsConnected() &&
    3128                 !elink->IsBusy() && !elink->IsTunerLocked())
     3130                !elink->IsTunerLocked() &&
     3131                !elink->GetFreeInputs(excluded_cardids).empty())
    31293132            {
    31303133                encoder = elink;
    31313134                retval = iter.key();
    void MainServer::HandleGetFreeRecorder(PlaybackSock *pbs) 
    31363139        }
    31373140
    31383141        if ((retval == -1 || lastcard) && elink->IsConnected() &&
    3139             !elink->IsBusy() && !elink->IsTunerLocked())
     3142            !elink->IsTunerLocked() &&
     3143            !elink->GetFreeInputs(excluded_cardids).empty())
    31403144        {
    31413145            encoder = elink;
    31423146            retval = iter.key();
    void MainServer::HandleGetFreeRecorder(PlaybackSock *pbs) 
    31723176    SendResponse(pbssock, strlist);
    31733177}
    31743178
     3179// Used in tv_play. igrp checking must be done here.
     3180// TV::FillMenuPxP(), TV::StartTV.  Used to count available tuners.
    31753181void MainServer::HandleGetFreeRecorderCount(PlaybackSock *pbs)
    31763182{
    31773183    MythSocket *pbssock = pbs->getSocket();
    31783184
     3185    vector<uint> excluded_cardids;
    31793186    QStringList strlist;
    31803187    int count = 0;
    31813188
    void MainServer::HandleGetFreeRecorderCount(PlaybackSock *pbs) 
    31843191    {
    31853192        EncoderLink *elink = *iter;
    31863193
    3187         if ((elink->IsConnected()) &&
    3188             (!elink->IsBusy()) &&
    3189             (!elink->IsTunerLocked()))
     3194        if (elink->IsConnected() && !elink->IsTunerLocked() &&
     3195            !elink->GetFreeInputs(excluded_cardids).empty())
    31903196        {
    31913197            count++;
    31923198        }
    void MainServer::HandleGetFreeRecorderCount(PlaybackSock *pbs) 
    31973203    SendResponse(pbssock, strlist);
    31983204}
    31993205
     3206// Used in tv_play. igrp checking is done there.
     3207// return non-Busy list of tuners.
    32003208void MainServer::HandleGetFreeRecorderList(PlaybackSock *pbs)
    32013209{
    32023210    MythSocket *pbssock = pbs->getSocket();
    void MainServer::HandleGetFreeRecorderList(PlaybackSock *pbs) 
    32083216    {
    32093217        EncoderLink *elink = *iter;
    32103218
    3211         if ((elink->IsConnected()) &&
    3212             (!elink->IsBusy()) &&
    3213             (!elink->IsTunerLocked()))
     3219        if (elink->IsConnected() && !elink->IsTunerLocked() &&
     3220            !elink->IsBusy())
    32143221        {
    32153222            strlist << QString::number(iter.key());
    32163223        }
    void MainServer::HandleGetFreeRecorderList(PlaybackSock *pbs) 
    32223229    SendResponse(pbssock, strlist);
    32233230}
    32243231
     3232// Used in tv_play. igrp checks need to be done here.
     3233// If currrec < 0 uses HandleGetFreeRecorder() to return an available tuner.
    32253234void MainServer::HandleGetNextFreeRecorder(QStringList &slist,
    32263235                                           PlaybackSock *pbs)
    32273236{
    void MainServer::HandleGetNextFreeRecorder(QStringList &slist, 
    32433252
    32443253    if (currrec > 0 && curr != encoderList->end())
    32453254    {
     3255        vector<uint> excluded_cardids;
     3256        // If there is a current card it needs to be excluded so
     3257        // that Input Group availability can be determined.
     3258        excluded_cardids.push_back(currrec);
     3259
    32463260        // cycle through all recorders
    32473261        for (iter = curr;;)
    32483262        {
    void MainServer::HandleGetNextFreeRecorder(QStringList &slist, 
    32563270
    32573271            elink = *iter;
    32583272
    3259             if ((retval == -1) &&
    3260                 (elink->IsConnected()) &&
    3261                 (!elink->IsBusy()) &&
    3262                 (!elink->IsTunerLocked()))
     3273            if (retval == -1 && elink->IsConnected() &&
     3274                !elink->IsTunerLocked() &&
     3275                !elink->GetFreeInputs(excluded_cardids).empty())
    32633276            {
    32643277                encoder = elink;
    32653278                retval = iter.key();