diff --git a/mythtv/libs/libmythtv/recorders/dvbchannel.cpp b/mythtv/libs/libmythtv/recorders/dvbchannel.cpp
index dbdf7adc11..9327614bc3 100644
|
a
|
b
|
void DVBChannel::Close(DVBChannel *who)
|
| 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 | |