Ticket #1772: ajm_scheduler_v2.patch

File ajm_scheduler_v2.patch, 8.3 KB (added by Aaron McCarthy <mccarthy.aaron@…>, 18 years ago)

Scheduler updates - Version 2

  • programs/mythbackend/scheduler.cpp

    old new  
    417417         << p->chanstr.rightJustify(4, ' ') << " " << p->chanid
    418418         << p->recstartts.toString("  dd hh:mm-").local8Bit()
    419419         << p->recendts.toString("hh:mm  ").local8Bit()
    420          << p->cardid << " " << p->inputid << "  "
     420         << p->cardid << " " << p->inputid << " " << p->mplexid << "  "
    421421         << p->RecTypeChar() << " " << p->RecStatusChar() << " "
    422422         << (QString::number(p->recpriority) + "/" +
    423423             QString::number(p->recpriority2)).rightJustify(5, ' ')
     
    681681            continue;
    682682        if (p->recendts <= q->recstartts || p->recstartts >= q->recendts)
    683683            continue;
     684        if (p->inputid == q->inputid && p->mplexid == q->mplexid)   // if mplex ids are the same don't conflict
     685            continue;
    684686        if (p->inputid == q->inputid && p->shareable)
    685687            continue;
    686688
     
    13201322                continue;
    13211323            }
    13221324
     1325            // SPLIT need a EncoderLink::IsBusyRecordingDifferentMux()
     1326            //if (!nexttv->IsBusyRecording())
     1327            VERBOSE(VB_RECORD, LOC + "Before IsBusyRecordingAndNotShareable");
     1328            //if (!nexttv->IsBusyRecordingAndNotShareable(nextRecording))
    13231329            if (!nexttv->IsBusyRecording())
    13241330            {
    1325                 // Will use pre-roll settings only if no other
    1326                 // program is currently being recorded
     1331                VERBOSE(VB_RECORD, LOC + "During IsBusyRecordingAndNotShareable");
     1332                // Will use pre-roll settings only if the
     1333                // recorder is recording on the same mux
    13271334                secsleft -= prerollseconds;
    13281335            }
     1336            VERBOSE(VB_RECORD, LOC + "After IsBusyRecordingAndNotShareable");
    13291337
    13301338            //VERBOSE(VB_GENERAL, secsleft << " seconds until " << nextRecording->title);
    13311339
     
    20202028"program.airdate, program.stars, program.originalairdate, RECTABLE.inactive, "
    20212029"RECTABLE.parentid, ") + progfindid + ", RECTABLE.playgroup, "
    20222030"oldrecstatus.recstatus, oldrecstatus.reactivate, "
    2023 "channel.recpriority + cardinput.recpriority, program.hdtv "
     2031"channel.recpriority + cardinput.recpriority, program.hdtv, "
     2032"channel.mplexid "
    20242033+ QString(
    20252034"FROM recordmatch "
    20262035
     
    21582167        p->chancommfree = result.value(23).toInt();
    21592168        p->cardid = result.value(24).toInt();
    21602169        p->inputid = result.value(25).toInt();
     2170        p->mplexid = result.value(41).toInt();
    21612171        p->shareable = result.value(26).toInt();
    21622172        p->seriesid = result.value(27).toString();
    21632173        p->programid = result.value(28).toString();
     
    22772287"RECTABLE.starttime, RECTABLE.startdate, RECTABLE.endtime, RECTABLE.enddate, "
    22782288"RECTABLE.startoffset, RECTABLE.endoffset, "
    22792289"RECTABLE.title, RECTABLE.subtitle, RECTABLE.description, "
    2280 "channel.channum, channel.callsign, channel.name "
     2290"channel.channum, channel.callsign, channel.name, channel.mplexid "
    22812291"FROM RECTABLE "
    22822292" INNER JOIN channel ON (channel.chanid = RECTABLE.chanid) "
    22832293" LEFT JOIN recordmatch on RECTABLE.recordid = recordmatch.recordid "
     
    23482358        p->chanstr = result.value(12).toString();
    23492359        p->chansign = QString::fromUtf8(result.value(13).toString());
    23502360        p->channame = QString::fromUtf8(result.value(14).toString());
     2361        p->mplexid = result.value(15).toInt();
    23512362
    23522363        p->schedulerid = p->startts.toString() + "_" + p->chanid;
    23532364
     
    23712382"channel.name, RECTABLE.recordid, RECTABLE.recgroup, RECTABLE.dupin, "
    23722383"RECTABLE.dupmethod, channel.commfree, channel.channum, RECTABLE.station, "
    23732384"RECTABLE.seriesid, RECTABLE.programid, RECTABLE.category, RECTABLE.findid, "
    2374 "RECTABLE.playgroup "
     2385"RECTABLE.playgroup, channel.mplexid "
    23752386"FROM RECTABLE "
    23762387"LEFT JOIN channel ON channel.callsign = RECTABLE.station "
    23772388"GROUP BY recordid "
     
    24472458            proginfo->programid = result.value(19).toString();
    24482459            proginfo->category = result.value(20).toString();
    24492460            proginfo->findid = result.value(21).toInt();
     2461            proginfo->mplexid = result.value(23).toInt();
    24502462           
    24512463            proginfo->recstartts = proginfo->startts;
    24522464            proginfo->recendts = proginfo->endts;
  • libs/libmythtv/programinfo.cpp

    old new  
    104104    sourceid = 0;
    105105    inputid = 0;
    106106    cardid = 0;
     107    mplexid = 0;
    107108    shareable = false;
    108109    duplicate = false;
    109110    schedulerid = "";
     
    195196    sourceid = other.sourceid;
    196197    inputid = other.inputid;
    197198    cardid = other.cardid;
     199    mplexid = other.mplexid;
    198200    shareable = other.shareable;
    199201    duplicate = other.duplicate;
    200202    schedulerid = QDeepCopy<QString>(other.schedulerid);
     
    283285    STR_TO_LIST(hostname)
    284286    INT_TO_LIST(sourceid)
    285287    INT_TO_LIST(cardid)
     288    INT_TO_LIST(mplexid)
    286289    INT_TO_LIST(inputid)
    287290    INT_TO_LIST(recpriority)
    288291    INT_TO_LIST(recstatus)
     
    381384    STR_FROM_LIST(hostname)
    382385    INT_FROM_LIST(sourceid)
    383386    INT_FROM_LIST(cardid)
     387    INT_FROM_LIST(mplexid)
    384388    INT_FROM_LIST(inputid)
    385389    INT_FROM_LIST(recpriority)
    386390    ENUM_FROM_LIST(recstatus, RecStatusType)
     
    29842988        recstartts = found->recstartts;
    29852989        recendts = found->recendts;
    29862990        cardid = found->cardid;
     2991        mplexid = found->mplexid;
    29872992        inputid = found->inputid;
    29882993    }
    29892994    return found;
     
    40854090                p->recstartts = s->recstartts;
    40864091                p->recendts = s->recendts;
    40874092                p->cardid = s->cardid;
     4093                p->mplexid = s->mplexid;
    40884094                p->inputid = s->inputid;
    40894095                p->dupin = s->dupin;
    40904096                p->dupmethod = s->dupmethod;
  • libs/libmythtv/programinfo.h

    old new  
    300300    int sourceid;
    301301    int inputid;
    302302    int cardid;
     303    int mplexid;
    303304    bool shareable;
    304305    bool duplicate;
    305306
  • programs/mythbackend/encoderlink.cpp

    old new  
    122122    return retval;
    123123}
    124124
     125/** \fn EncoderLink::IsBusyRecordingAndNotShareable()
     126 *  \brief Returns true if the TVRec state is in a recording state and not shareable with rec
     127 *
     128 *   Contrast with IsBusyRecording() which returns true if it is recording.
     129 *
     130 *  \sa IsBusyRecording()
     131 */
     132bool EncoderLink::IsBusyRecordingAndNotShareable(const ProgramInfo *rec)
     133{
     134    bool retval = false;
     135    ProgramList tvrecList;
     136
     137    if (local)
     138    {
     139        while (kState_ChangingState == GetState())
     140            usleep(100);
     141
     142        if (IsBusyRecording())
     143            tvrecList = tv->GetRecordings();
     144
     145        if (!tvrecList.isEmpty())
     146        {
     147            ProgramInfo *tvrec = tvrecList.first();
     148            retval = (tvrec->mplexid != rec->mplexid);
     149
     150            tvrecList.setAutoDelete(true);
     151        }
     152    }
     153    else if (sock)
     154        retval = sock->EncoderIsRecording(m_capturecardnum, rec);
     155
     156    return retval;
     157}
     158
    125159/** \fn EncoderLink::GetState()
    126160 *  \brief Returns the TVState of the recorder.
    127161 *  \sa TVRec::GetState(), \ref recorder_subsystem
  • programs/mythbackend/encoderlink.h

    old new  
    5252
    5353    bool IsBusy(void);
    5454    bool IsBusyRecording(void);
     55    bool IsBusyRecordingAndNotShareable(const ProgramInfo *rec);
    5556
    5657    TVState GetState();
    5758    bool IsRecording(const ProgramInfo *rec); // scheduler call only.