diff --git a/mythtv/libs/libmythtv/eitscanner.cpp b/mythtv/libs/libmythtv/eitscanner.cpp
index 677feddab8..e707600365 100644
|
a
|
b
|
void EITScanner::StartActiveScan(TVRec *_rec, uint max_seconds_per_source)
|
| 283 | 283 | |
| 284 | 284 | void EITScanner::StopActiveScan(void) |
| 285 | 285 | { |
| | 286 | LOG(VB_EIT, LOG_INFO, |
| | 287 | LOC_ID + QString("##StopActiveScan() entering")); |
| 286 | 288 | QMutexLocker locker(&lock); |
| | 289 | LOG(VB_EIT, LOG_INFO, |
| | 290 | LOC_ID + QString("##StopActiveScan() locked")); |
| 287 | 291 | |
| 288 | 292 | activeScanStopped = false; |
| 289 | 293 | activeScan = false; |
| 290 | 294 | exitThreadCond.wakeAll(); |
| | 295 | LOG(VB_EIT, LOG_INFO, |
| | 296 | LOC_ID + QString("##StopActiveScan() woke all")); |
| 291 | 297 | |
| 292 | 298 | locker.unlock(); |
| | 299 | LOG(VB_EIT, LOG_INFO, |
| | 300 | LOC_ID + QString("##StopActiveScan() unlocked")); |
| 293 | 301 | StopPassiveScan(); |
| 294 | 302 | locker.relock(); |
| | 303 | LOG(VB_EIT, LOG_INFO, |
| | 304 | LOC_ID + QString("##StopActiveScan() relocked")); |
| 295 | 305 | |
| 296 | 306 | while (!activeScan && !activeScanStopped) |
| 297 | 307 | activeScanCond.wait(&lock, 100); |
| 298 | 308 | |
| | 309 | LOG(VB_EIT, LOG_INFO, |
| | 310 | LOC_ID + QString("##StopActiveScan() finished")); |
| 299 | 311 | rec = NULL; |
| 300 | 312 | } |
diff --git a/mythtv/libs/libmythtv/recorders/dvbchannel.cpp b/mythtv/libs/libmythtv/recorders/dvbchannel.cpp
index dbdf7adc11..2215c0ecff 100644
|
a
|
b
|
DVBChannel::~DVBChannel()
|
| 145 | 145 | |
| 146 | 146 | void DVBChannel::Close(DVBChannel *who) |
| 147 | 147 | { |
| 148 | | LOG(VB_CHANNEL, LOG_INFO, LOC + "Closing DVB channel"); |
| | 148 | LOG(VB_CHANNEL, LOG_INFO, LOC + "##Closing DVB channel"); |
| 149 | 149 | |
| 150 | 150 | IsOpenMap::iterator it = is_open.find(who); |
| 151 | 151 | if (it == is_open.end()) |
| | 152 | { |
| | 153 | LOG(VB_CHANNEL, LOG_INFO, LOC + " ##Not open"); |
| 152 | 154 | return; // this caller didn't have it open in the first place.. |
| | 155 | } |
| 153 | 156 | |
| 154 | 157 | is_open.erase(it); |
| 155 | 158 | |
| … |
… |
void DVBChannel::Close(DVBChannel *who)
|
| 163 | 166 | master->Close(this); |
| 164 | 167 | fd_frontend = -1; |
| 165 | 168 | ReturnMasterLock(master); |
| | 169 | LOG(VB_CHANNEL, LOG_INFO, LOC + " ##master->Close9) succeeded"); |
| 166 | 170 | return; |
| 167 | 171 | } |
| 168 | 172 | ReturnMasterLock(master); // if we're the master we don't need this lock.. |
| 169 | 173 | |
| 170 | 174 | if (!is_open.empty()) |
| | 175 | { |
| | 176 | LOG(VB_CHANNEL, LOG_INFO, LOC + " ##still has other callers"); |
| 171 | 177 | return; // not all callers have closed the DVB channel yet.. |
| | 178 | } |
| 172 | 179 | |
| 173 | 180 | if (diseqc_tree) |
| 174 | 181 | diseqc_tree->Close(); |
| … |
… |
void DVBChannel::Close(DVBChannel *who)
|
| 180 | 187 | |
| 181 | 188 | dvbcam->Stop(); |
| 182 | 189 | } |
| | 190 | LOG(VB_CHANNEL, LOG_INFO, LOC + "##Succeeded"); |
| 183 | 191 | } |
| 184 | 192 | |
| 185 | 193 | bool DVBChannel::Open(DVBChannel *who) |
| 186 | 194 | { |
| 187 | | LOG(VB_CHANNEL, LOG_INFO, LOC + "Opening DVB channel"); |
| | 195 | LOG(VB_CHANNEL, LOG_INFO, LOC + "##Opening DVB channel"); |
| 188 | 196 | |
| 189 | 197 | if (!m_inputid) |
| 190 | 198 | { |
| 191 | 199 | if (!InitializeInput()) |
| | 200 | { |
| | 201 | LOG(VB_CHANNEL, LOG_INFO, LOC + " ##InitializeInput() failed"); |
| 192 | 202 | return false; |
| | 203 | } |
| 193 | 204 | } |
| 194 | 205 | |
| 195 | 206 | QMutexLocker locker(&hw_lock); |
| 196 | 207 | |
| 197 | 208 | if (fd_frontend >= 0) |
| 198 | 209 | { |
| | 210 | LOG(VB_CHANNEL, LOG_INFO, LOC + " ##fd_frontend already set"); |
| 199 | 211 | is_open[who] = true; |
| 200 | 212 | return true; |
| 201 | 213 | } |
| … |
… |
bool DVBChannel::Open(DVBChannel *who)
|
| 205 | 217 | { |
| 206 | 218 | if (!master->Open(who)) |
| 207 | 219 | { |
| | 220 | LOG(VB_CHANNEL, LOG_INFO, LOC + " ##master->Open() failed"); |
| 208 | 221 | ReturnMasterLock(master); |
| 209 | 222 | return false; |
| 210 | 223 | } |
| … |
… |
bool DVBChannel::Open(DVBChannel *who)
|
| 223 | 236 | |
| 224 | 237 | if (!InitializeInput()) |
| 225 | 238 | { |
| | 239 | LOG(VB_CHANNEL, LOG_INFO, LOC + " ##InitializeInput2() failed"); |
| 226 | 240 | Close(); |
| 227 | 241 | ReturnMasterLock(master); |
| 228 | 242 | return false; |
| 229 | 243 | } |
| 230 | 244 | |
| | 245 | LOG(VB_CHANNEL, LOG_INFO, LOC + " ##InitializeInput2() succedded"); |
| 231 | 246 | ReturnMasterLock(master); |
| 232 | 247 | return true; |
| 233 | 248 | } |
| … |
… |
bool DVBChannel::Open(DVBChannel *who)
|
| 242 | 257 | if (fd_frontend >= 0) |
| 243 | 258 | break; |
| 244 | 259 | LOG(VB_GENERAL, LOG_WARNING, LOC + |
| 245 | | "Opening DVB frontend device failed." + ENO); |
| | 260 | " ##Opening DVB frontend device failed." + ENO); |
| 246 | 261 | if (tries >= 20 || (errno != EBUSY && errno != EAGAIN)) |
| 247 | 262 | { |
| 248 | 263 | LOG(VB_GENERAL, LOG_ERR, LOC + |
| 249 | | QString("Failed to open DVB frontend device due to " |
| | 264 | QString(" ##Failed to open DVB frontend device due to " |
| 250 | 265 | "fatal error or too many attempts.")); |
| 251 | 266 | return false; |
| 252 | 267 | } |
| … |
… |
bool DVBChannel::Open(DVBChannel *who)
|
| 258 | 273 | if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0) |
| 259 | 274 | { |
| 260 | 275 | LOG(VB_GENERAL, LOG_ERR, LOC + |
| 261 | | "Failed to get frontend information." + ENO); |
| | 276 | " ##Failed to get frontend information." + ENO); |
| 262 | 277 | |
| 263 | 278 | close(fd_frontend); |
| 264 | 279 | fd_frontend = -1; |
| … |
… |
bool DVBChannel::Open(DVBChannel *who)
|
| 312 | 327 | |
| 313 | 328 | if (!InitializeInput()) |
| 314 | 329 | { |
| | 330 | LOG(VB_CHANNEL, LOG_INFO, LOC + " ##InitializeInput3() failed"); |
| 315 | 331 | Close(); |
| 316 | 332 | return false; |
| 317 | 333 | } |
| … |
… |
bool DVBChannel::Open(DVBChannel *who)
|
| 319 | 335 | if (fd_frontend >= 0) |
| 320 | 336 | is_open[who] = true; |
| 321 | 337 | |
| | 338 | LOG(VB_CHANNEL, LOG_INFO, LOC + "##Succedded"); |
| 322 | 339 | return (fd_frontend >= 0); |
| 323 | 340 | } |
| 324 | 341 | |
diff --git a/mythtv/libs/libmythtv/tv_rec.cpp b/mythtv/libs/libmythtv/tv_rec.cpp
index ecb43af392..5681aa2ec5 100644
|
a
|
b
|
void TVRec::run(void)
|
| 1460 | 1460 | CardUtil::GetConflictingInputs(inputid); |
| 1461 | 1461 | InputInfo busy_input; |
| 1462 | 1462 | for (uint i = 0; i < inputids.size() && allow_eit; ++i) |
| 1463 | | allow_eit = !RemoteIsBusy(inputids[i], busy_input); |
| | 1463 | allow_eit = !RemoteIsBusy(inputids[i], busy_input, 630); |
| 1464 | 1464 | if (allow_eit) |
| 1465 | 1465 | { |
| 1466 | 1466 | scanner->StartActiveScan(this, eitTransportTimeout); |
| … |
… |
void TVRec::run(void)
|
| 1471 | 1471 | else |
| 1472 | 1472 | { |
| 1473 | 1473 | LOG(VB_CHANNEL, LOG_INFO, LOC + QString( |
| 1474 | | "Postponing EIT scan on input %1 " |
| | 1474 | "##Postponing EIT scan on input %1 " |
| 1475 | 1475 | "because input %2 is busy") |
| 1476 | 1476 | .arg(inputid).arg(busy_input.inputid)); |
| 1477 | 1477 | eitScanStartTime = eitScanStartTime.addSecs(300); |
| … |
… |
void TVRec::HandlePendingRecordings(void)
|
| 1570 | 1570 | if (pendingRecordings.empty()) |
| 1571 | 1571 | return; |
| 1572 | 1572 | |
| | 1573 | // Make sure EIT scan is stopped so it does't interfere |
| | 1574 | if (scanner && HasFlags(kFlagEITScannerRunning)) |
| | 1575 | { |
| | 1576 | LOG(VB_CHANNEL, LOG_INFO, LOC + "##Stopping active EIT scan for pending recording."); |
| | 1577 | |
| | 1578 | scanner->StopActiveScan(); |
| | 1579 | ClearFlags(kFlagEITScannerRunning, __FILE__, __LINE__); |
| | 1580 | LOG(VB_CHANNEL, LOG_INFO, LOC + "##Stopped active EIT scan for pending recording."); |
| | 1581 | |
| | 1582 | CloseChannel(); |
| | 1583 | |
| | 1584 | eitScanStartTime = MythDate::current(); |
| | 1585 | eitScanStartTime = eitScanStartTime.addSecs( |
| | 1586 | eitCrawlIdleStart + 30 + eit_start_rand(inputid, eitTransportTimeout)); |
| | 1587 | } |
| | 1588 | |
| 1573 | 1589 | // If we have a pending recording and AskAllowRecording |
| 1574 | 1590 | // or DoNotAskAllowRecording is set and the frontend is |
| 1575 | 1591 | // ready send an ASK_RECORDING query to frontend. |
diff --git a/mythtv/libs/libmythtv/tvremoteutil.cpp b/mythtv/libs/libmythtv/tvremoteutil.cpp
index 9796750512..780dff06e2 100644
|
a
|
b
|
RemoteEncoder *RemoteGetExistingRecorder(int recordernum)
|
| 356 | 356 | return new RemoteEncoder(recordernum, hostname, port); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | | bool RemoteIsBusy(uint inputid, InputInfo &busy_input) |
| | 359 | bool RemoteIsBusy(uint inputid, InputInfo &busy_input, int time_buffer) |
| 360 | 360 | { |
| 361 | 361 | #if 0 |
| 362 | 362 | LOG(VB_GENERAL, LOG_DEBUG, QString("RemoteIsBusy(%1) %2") |
| … |
… |
bool RemoteIsBusy(uint inputid, InputInfo &busy_input)
|
| 369 | 369 | { |
| 370 | 370 | const TVRec *rec = TVRec::GetTVRec(inputid); |
| 371 | 371 | if (rec) |
| 372 | | return rec->IsBusy(&busy_input); |
| | 372 | return rec->IsBusy(&busy_input, time_buffer); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | QStringList strlist(QString("QUERY_REMOTEENCODER %1").arg(inputid)); |
| 376 | 376 | strlist << "IS_BUSY"; |
| | 377 | strlist << QString::number(time_buffer); |
| 377 | 378 | if (!gCoreContext->SendReceiveStringList(strlist) || strlist.empty()) |
| 378 | 379 | return true; |
| 379 | 380 | |
diff --git a/mythtv/libs/libmythtv/tvremoteutil.h b/mythtv/libs/libmythtv/tvremoteutil.h
index 26086231fe..bb1a5d99b1 100644
|
a
|
b
|
MTV_PUBLIC vector<uint>
|
| 47 | 47 | RemoteRequestFreeRecorderList(uint excluded_input); |
| 48 | 48 | MTV_PUBLIC vector<uint> |
| 49 | 49 | RemoteRequestFreeInputList(uint excluded_input); |
| 50 | | MTV_PUBLIC bool RemoteIsBusy(uint inputid, InputInfo &busy_input); |
| | 50 | MTV_PUBLIC bool RemoteIsBusy(uint inputid, InputInfo &busy_input, |
| | 51 | int time_buffer = 5); |
| 51 | 52 | |
| 52 | 53 | MTV_PUBLIC bool RemoteGetRecordingStatus( |
| 53 | 54 | vector<TunerStatus> *tunerList = NULL, bool list_inactive = false); |