diff --git a/mythtv/programs/mythbackend/httpstatus.cpp b/mythtv/programs/mythbackend/httpstatus.cpp
index ce10b085fb..110ef497c5 100644
a
|
b
|
void HttpStatus::FillStatusXML( QDomDocument *pDoc ) |
197 | 197 | |
198 | 198 | TVRec::s_inputsLock.lockForRead(); |
199 | 199 | |
200 | | foreach (auto elink, *m_pEncoders) |
| 200 | for (auto elink : qAsConst(*m_pEncoders)) |
201 | 201 | { |
202 | 202 | if (elink != nullptr) |
203 | 203 | { |
diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp
index ef16e5539c..af19beea53 100644
a
|
b
|
void MainServer::HandleAnnounce(QStringList &slist, QStringList commands, |
1863 | 1863 | |
1864 | 1864 | bool wasAsleep = true; |
1865 | 1865 | TVRec::s_inputsLock.lockForRead(); |
1866 | | foreach (auto elink, *m_encoderList) |
| 1866 | for (auto elink : qAsConst(*m_encoderList)) |
1867 | 1867 | { |
1868 | 1868 | if (elink->GetHostName() == commands[2]) |
1869 | 1869 | { |
… |
… |
void MainServer::DoHandleStopRecording( |
2930 | 2930 | if (m_sched) |
2931 | 2931 | m_sched->UpdateRecStatus(&recinfo); |
2932 | 2932 | } |
| 2933 | |
| 2934 | break; |
2933 | 2935 | } |
2934 | 2936 | } |
2935 | 2937 | TVRec::s_inputsLock.unlock(); |
… |
… |
void MainServer::HandleLockTuner(PlaybackSock *pbs, int cardid) |
4238 | 4240 | QString enchost; |
4239 | 4241 | |
4240 | 4242 | TVRec::s_inputsLock.lockForRead(); |
4241 | | foreach (auto elink, *m_encoderList) |
| 4243 | for (auto elink : qAsConst(*m_encoderList)) |
4242 | 4244 | { |
4243 | 4245 | // we're looking for a specific card but this isn't the one we want |
4244 | 4246 | if ((cardid != -1) && (cardid != elink->GetInputID())) |
… |
… |
void MainServer::HandleGetFreeInputInfo(PlaybackSock *pbs, |
4360 | 4362 | vector<InputInfo> freeinputs; |
4361 | 4363 | QMap<uint, QSet<uint> > groupids; |
4362 | 4364 | |
4363 | | // Lopp over each encoder and divide the inputs into busy and free |
4364 | | // lists. |
| 4365 | // Loop over each encoder and divide the inputs into busy and free lists. |
4365 | 4366 | TVRec::s_inputsLock.lockForRead(); |
4366 | | foreach (auto elink, *m_encoderList) |
| 4367 | for (auto elink : qAsConst(*m_encoderList)) |
4367 | 4368 | { |
4368 | 4369 | InputInfo info; |
4369 | 4370 | info.m_inputId = elink->GetInputID(); |
… |
… |
void MainServer::HandleSetChannelInfo(QStringList &slist, PlaybackSock *pbs) |
4895 | 4896 | } |
4896 | 4897 | |
4897 | 4898 | TVRec::s_inputsLock.lockForRead(); |
4898 | | foreach (auto & encoder, *m_encoderList) |
| 4899 | for (auto encoder : qAsConst(*m_encoderList)) |
4899 | 4900 | { |
4900 | 4901 | if (encoder) |
4901 | 4902 | { |
4902 | 4903 | ok &= encoder->SetChannelInfo(chanid, sourceid, oldcnum, |
4903 | | callsign, channum, channame, xmltv); |
| 4904 | callsign, channum, channame, xmltv); |
4904 | 4905 | } |
4905 | 4906 | } |
4906 | 4907 | TVRec::s_inputsLock.unlock(); |
… |
… |
size_t MainServer::GetCurrentMaxBitrate(void) |
5091 | 5092 | size_t totalKBperMin = 0; |
5092 | 5093 | |
5093 | 5094 | TVRec::s_inputsLock.lockForRead(); |
5094 | | foreach (auto enc, *m_encoderList) |
| 5095 | for (auto enc : qAsConst(*m_encoderList)) |
5095 | 5096 | { |
5096 | 5097 | if (!enc->IsConnected() || !enc->IsBusy()) |
5097 | 5098 | continue; |
… |
… |
void MainServer::HandleIsRecording(QStringList &slist, PlaybackSock *pbs) |
7328 | 7329 | QStringList retlist; |
7329 | 7330 | |
7330 | 7331 | TVRec::s_inputsLock.lockForRead(); |
7331 | | foreach (auto elink, *m_encoderList) |
| 7332 | for (auto elink : qAsConst(*m_encoderList)) |
7332 | 7333 | { |
7333 | 7334 | if (elink->IsBusyRecording()) { |
7334 | 7335 | RecordingsInProgress++; |
… |
… |
void MainServer::connectionClosed(MythSocket *socket) |
7793 | 7794 | |
7794 | 7795 | bool isFallingAsleep = true; |
7795 | 7796 | TVRec::s_inputsLock.lockForRead(); |
7796 | | foreach (auto elink, *m_encoderList) |
| 7797 | for (auto elink : qAsConst(*m_encoderList)) |
7797 | 7798 | { |
7798 | 7799 | if (elink->GetSocket() == pbs) |
7799 | 7800 | { |
… |
… |
void MainServer::connectionClosed(MythSocket *socket) |
7834 | 7835 | if (chain->HostSocketCount() == 0) |
7835 | 7836 | { |
7836 | 7837 | TVRec::s_inputsLock.lockForRead(); |
7837 | | foreach (auto enc, *m_encoderList) |
| 7838 | for (auto enc : qAsConst(*m_encoderList)) |
7838 | 7839 | { |
7839 | 7840 | if (enc->IsLocal()) |
7840 | 7841 | { |
… |
… |
void MainServer::reconnectTimeout(void) |
8181 | 8182 | QStringList strlist( str ); |
8182 | 8183 | |
8183 | 8184 | TVRec::s_inputsLock.lockForRead(); |
8184 | | foreach (auto elink, *m_encoderList) |
| 8185 | for (auto elink : qAsConst(*m_encoderList)) |
8185 | 8186 | { |
8186 | 8187 | elink->CancelNextRecording(true); |
8187 | 8188 | ProgramInfo *pinfo = elink->GetRecording(); |
… |
… |
void MainServer::UpdateSystemdStatus (void) |
8354 | 8355 | { |
8355 | 8356 | int active = 0; |
8356 | 8357 | TVRec::s_inputsLock.lockForRead(); |
8357 | | foreach (auto elink, *m_encoderList) |
| 8358 | for (auto elink : qAsConst(*m_encoderList)) |
8358 | 8359 | { |
8359 | 8360 | if (not elink->IsLocal()) |
8360 | 8361 | continue; |
diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp
index 2a1173df95..4a823f38df 100644
a
|
b
|
void Scheduler::HandleWakeSlave(RecordingInfo &ri, int prerollseconds) |
2524 | 2524 | QReadLocker tvlocker(&TVRec::s_inputsLock); |
2525 | 2525 | |
2526 | 2526 | QMap<int, EncoderLink*>::const_iterator tvit = m_tvList->constFind(ri.GetInputID()); |
2527 | | if (tvit == m_tvList->end()) |
| 2527 | if (tvit == m_tvList->constEnd()) |
2528 | 2528 | return; |
2529 | 2529 | |
2530 | 2530 | QString sysEventKey = ri.MakeUniqueKey(); |
… |
… |
void Scheduler::HandleWakeSlave(RecordingInfo &ri, int prerollseconds) |
2607 | 2607 | "to reschedule around its tuners.") |
2608 | 2608 | .arg(nexttv->GetHostName())); |
2609 | 2609 | |
2610 | | foreach (auto & enc, *m_tvList) |
| 2610 | for (auto enc : qAsConst(*m_tvList)) |
2611 | 2611 | { |
2612 | 2612 | if (enc->GetHostName() == nexttv->GetHostName()) |
2613 | 2613 | enc->SetSleepStatus(sStatus_Undefined); |
… |
… |
bool Scheduler::HandleRecording( |
2682 | 2682 | QReadLocker tvlocker(&TVRec::s_inputsLock); |
2683 | 2683 | |
2684 | 2684 | QMap<int, EncoderLink*>::const_iterator tvit = m_tvList->constFind(ri.GetInputID()); |
2685 | | if (tvit == m_tvList->end()) |
| 2685 | if (tvit == m_tvList->constEnd()) |
2686 | 2686 | { |
2687 | 2687 | QString msg = QString("Invalid cardid [%1] for %2") |
2688 | 2688 | .arg(ri.GetInputID()).arg(ri.GetTitle()); |
… |
… |
bool Scheduler::HandleRecording( |
2764 | 2764 | "to reschedule around its tuners.") |
2765 | 2765 | .arg(nexttv->GetHostName())); |
2766 | 2766 | |
2767 | | foreach (auto enc, *m_tvList) |
| 2767 | for (auto enc : qAsConst(*m_tvList)) |
2768 | 2768 | { |
2769 | 2769 | if (enc->GetHostName() == nexttv->GetHostName()) |
2770 | 2770 | enc->SetSleepStatus(sStatus_Undefined); |
… |
… |
void Scheduler::PutInactiveSlavesToSleep(void) |
3452 | 3452 | QReadLocker tvlocker(&TVRec::s_inputsLock); |
3453 | 3453 | |
3454 | 3454 | bool someSlavesCanSleep = false; |
3455 | | foreach (auto enc, *m_tvList) |
| 3455 | for (auto enc : qAsConst(*m_tvList)) |
3456 | 3456 | { |
3457 | 3457 | if (enc->CanSleep()) |
3458 | 3458 | someSlavesCanSleep = true; |
… |
… |
void Scheduler::PutInactiveSlavesToSleep(void) |
3533 | 3533 | LOG(VB_SCHEDULE, LOG_DEBUG, QString(" Shutting down slaves which will " |
3534 | 3534 | "be inactive for the next %1 minutes and can be put to sleep.") |
3535 | 3535 | .arg(sleepThreshold / 60)); |
3536 | | |
3537 | | foreach (auto enc, *m_tvList) |
| 3536 | for (auto enc : qAsConst(*m_tvList)) |
3538 | 3537 | { |
3539 | 3538 | if ((!enc->IsLocal()) && |
3540 | 3539 | (enc->IsAwake()) && |
… |
… |
void Scheduler::PutInactiveSlavesToSleep(void) |
3558 | 3557 | |
3559 | 3558 | if (enc->GoToSleep()) |
3560 | 3559 | { |
3561 | | foreach (auto slv, *m_tvList) |
| 3560 | for (auto slv : qAsConst(*m_tvList)) |
3562 | 3561 | { |
3563 | 3562 | if (slv->GetHostName() == thisHost) |
3564 | 3563 | { |
… |
… |
void Scheduler::PutInactiveSlavesToSleep(void) |
3576 | 3575 | LOG(VB_GENERAL, LOG_ERR, LOC + |
3577 | 3576 | QString("Unable to shutdown %1 slave backend, setting " |
3578 | 3577 | "sleep status to undefined.").arg(thisHost)); |
3579 | | foreach (auto slv, *m_tvList) |
| 3578 | for (auto slv : qAsConst(*m_tvList)) |
3580 | 3579 | { |
3581 | 3580 | if (slv->GetHostName() == thisHost) |
3582 | 3581 | slv->SetSleepStatus(sStatus_Undefined); |
… |
… |
bool Scheduler::WakeUpSlave(const QString& slaveHostname, bool setWakingStatus) |
3605 | 3604 | LOG(VB_GENERAL, LOG_NOTICE, |
3606 | 3605 | QString("Trying to Wake Up %1, but this slave " |
3607 | 3606 | "does not have a WakeUpCommand set.").arg(slaveHostname)); |
3608 | | |
3609 | | foreach (auto enc, *m_tvList) |
| 3607 | for (auto enc : qAsConst(*m_tvList)) |
3610 | 3608 | { |
3611 | 3609 | if (enc->GetHostName() == slaveHostname) |
3612 | 3610 | enc->SetSleepStatus(sStatus_Undefined); |
… |
… |
bool Scheduler::WakeUpSlave(const QString& slaveHostname, bool setWakingStatus) |
3616 | 3614 | } |
3617 | 3615 | |
3618 | 3616 | QDateTime curtime = MythDate::current(); |
3619 | | foreach (auto enc, *m_tvList) |
| 3617 | for (auto enc : qAsConst(*m_tvList)) |
3620 | 3618 | { |
3621 | 3619 | if (setWakingStatus && (enc->GetHostName() == slaveHostname)) |
3622 | 3620 | enc->SetSleepStatus(sStatus_Waking); |
… |
… |
void Scheduler::WakeUpSlaves(void) |
3640 | 3638 | |
3641 | 3639 | QStringList SlavesThatCanWake; |
3642 | 3640 | QString thisSlave; |
3643 | | foreach (auto enc, *m_tvList) |
| 3641 | for (auto enc : qAsConst(*m_tvList)) |
3644 | 3642 | { |
3645 | 3643 | if (enc->IsLocal()) |
3646 | 3644 | continue; |
… |
… |
void Scheduler::AddNewRecords(void) |
4314 | 4312 | RecList tmpList; |
4315 | 4313 | |
4316 | 4314 | QMap<int, bool> cardMap; |
4317 | | foreach (auto enc, *m_tvList) |
| 4315 | for (auto enc : qAsConst(*m_tvList)) |
4318 | 4316 | { |
4319 | 4317 | if (enc->IsConnected() || enc->IsAsleep()) |
4320 | 4318 | cardMap[enc->GetInputID()] = true; |
… |
… |
int Scheduler::FillRecordingDir( |
5447 | 5445 | QString backuppath = expire->GetPathname(); |
5448 | 5446 | ProgramInfo *programinfo = expire; |
5449 | 5447 | bool foundSlave = false; |
5450 | | |
5451 | | foreach (auto & enc, *m_tvList) |
| 5448 | for (auto enc : qAsConst(*m_tvList)) |
5452 | 5449 | { |
5453 | 5450 | if (enc->GetHostName() == |
5454 | 5451 | programinfo->GetHostname()) |
… |
… |
void Scheduler::SchedLiveTV(void) |
5606 | 5603 | return; |
5607 | 5604 | |
5608 | 5605 | // Build a list of active livetv programs |
5609 | | foreach (auto enc, *m_tvList) |
| 5606 | for (auto enc : qAsConst(*m_tvList)) |
5610 | 5607 | { |
5611 | 5608 | if (kState_WatchingLiveTV != enc->GetState()) |
5612 | 5609 | continue; |
diff --git a/mythtv/programs/mythbackend/services/dvr.cpp b/mythtv/programs/mythbackend/services/dvr.cpp
index 91f47b7c19..dd90d8bd62 100644
a
|
b
|
DTC::EncoderList* Dvr::GetEncoderList() |
680 | 680 | |
681 | 681 | QReadLocker tvlocker(&TVRec::s_inputsLock); |
682 | 682 | QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo(); |
683 | | foreach (auto elink, tvList) |
| 683 | for (auto elink : qAsConst(tvList)) |
684 | 684 | { |
685 | 685 | if (elink != nullptr) |
686 | 686 | { |