Ticket #6719: channel-thread-0.23-fixes-25369.patch
| File channel-thread-0.23-fixes-25369.patch, 48.7 KB (added by , 16 years ago) |
|---|
-
libs/libmythtv/analogsignalmonitor.cpp
old new void AnalogSignalMonitor::UpdateValues(v 32 32 if (videofd < 0) 33 33 return; 34 34 35 if (!IsChannelTuned()) 36 return; 37 35 38 bool isLocked = false; 36 39 if (usingv4l2) 37 40 { -
libs/libmythtv/channelbase.cpp
old new using namespace std; 35 35 #define LOC_WARN QString("ChannelBase(%1) Warning: ").arg(GetCardID()) 36 36 #define LOC_ERR QString("ChannelBase(%1) Error: ").arg(GetCardID()) 37 37 38 /* 39 * Run the channel change thread, and report the status when done 40 */ 41 void ChannelThread::run(void) 42 { 43 VERBOSE(VB_CHANNEL, "ChannelThread::run"); 44 bool result = tuner->SetChannelByString(channel); 45 tuner->setStatus(result ? 46 ChannelBase::changeSuccess : ChannelBase::changeFailed); 47 } 48 38 49 ChannelBase::ChannelBase(TVRec *parent) 39 50 : 40 51 pParent(parent), curchannelname(""), 41 currentInputID(-1), commfree(false), cardid(0) 52 currentInputID(-1), commfree(false), cardid(0), 53 abort_change(false) 42 54 { 55 tuneStatus = changeUnknown; 56 tuneThread.tuner = this; 43 57 } 44 58 45 59 ChannelBase::~ChannelBase(void) 46 60 { 47 61 ClearInputMap(); 62 TeardownAll(); 63 } 64 65 void ChannelBase::TeardownAll(void) 66 { 67 if (tuneThread.isRunning()) 68 { 69 thread_lock.lock(); 70 abort_change = true; 71 tuneCond.wakeAll(); 72 thread_lock.unlock(); 73 tuneThread.wait(); 74 } 75 } 76 77 void ChannelBase::SelectChannel(const QString & chan) 78 { 79 VERBOSE(VB_CHANNEL, LOC + "SelectChannel " + chan); 80 TeardownAll(); 81 82 thread_lock.lock(); 83 abort_change = false; 84 tuneStatus = changePending; 85 thread_lock.unlock(); 86 87 curchannelname = tuneThread.channel = chan; 88 tuneThread.start(); 89 } 90 91 /* 92 * Returns true of the channel change thread should abort 93 */ 94 bool ChannelBase::Aborted(void) 95 { 96 bool result; 97 98 thread_lock.lock(); 99 result = abort_change; 100 thread_lock.unlock(); 101 102 return result; 103 } 104 105 ChannelBase::Status ChannelBase::GetStatus(void) 106 { 107 Status status; 108 109 thread_lock.lock(); 110 status = tuneStatus; 111 thread_lock.unlock(); 112 113 return status; 114 } 115 116 ChannelBase::Status ChannelBase::Wait(void) 117 { 118 tuneThread.wait(); 119 return tuneStatus; 120 } 121 122 void ChannelBase::setStatus(ChannelBase::Status status) 123 { 124 thread_lock.lock(); 125 tuneStatus = status; 126 thread_lock.unlock(); 48 127 } 49 128 50 129 bool ChannelBase::Init(QString &inputname, QString &startchannel, bool setchan) 51 130 { 52 131 bool ok; 53 132 133 VERBOSE(VB_CHANNEL, LOC + QString("Init(%1, %2, %3)") 134 .arg(inputname).arg(startchannel).arg(setchan)); 135 54 136 if (!setchan) 55 137 ok = inputname.isEmpty() ? false : IsTunable(inputname, startchannel); 56 138 else if (inputname.isEmpty()) 57 ok = SetChannelByString(startchannel); 139 { 140 SelectChannel(startchannel); 141 ok = Wait(); 142 } 58 143 else 59 ok = S witchToInput(inputname, startchannel);144 ok = SelectInput(inputname, startchannel, false); 60 145 61 146 if (ok) 62 147 return true; … … bool ChannelBase::Init(QString &inputnam 125 210 if (chanid && cit != channels.end()) 126 211 { 127 212 if (!setchan) 128 {129 213 ok = IsTunable(*it, (mplexid_restriction) ? 130 214 (*cit).channum : startchannel); 131 }132 215 else 133 ok = S witchToInput(*it, (*cit).channum);216 ok = SelectInput(*it, (*cit).channum, false); 134 217 135 218 if (ok) 136 219 { … … int ChannelBase::GetInputByName(const QS 330 413 return -1; 331 414 } 332 415 416 #if 0 // Not used? 333 417 bool ChannelBase::SwitchToInput(const QString &inputname) 334 418 { 335 419 int input = GetInputByName(inputname); … … bool ChannelBase::SwitchToInput(const QS 341 425 "%1 on card\n").arg(inputname)); 342 426 return false; 343 427 } 428 #endif 344 429 345 bool ChannelBase::SwitchToInput(const QString &inputname, const QString &chan) 430 bool ChannelBase::SelectInput(const QString &inputname, const QString &chan, 431 bool use_sm) 346 432 { 347 433 int input = GetInputByName(inputname); 348 434 349 bool ok = false; 435 VERBOSE(VB_CHANNEL, LOC + QString("SelectInput(%1, %2) %3") 436 .arg(inputname).arg(chan).arg(input)); 437 350 438 if (input >= 0) 351 439 { 352 ok = SwitchToInput(input, false); 353 if (ok) 354 ok = SetChannelByString(chan); 440 if (!SwitchToInput(input, false)) 441 return false; 442 if (use_sm) 443 SelectChannel(chan); 444 else 445 return SetChannelByString(chan); 355 446 } 356 447 else 357 448 { 358 449 VERBOSE(VB_IMPORTANT, 359 450 QString("ChannelBase: Could not find input: %1 on card when " 360 451 "setting channel %2\n").arg(inputname).arg(chan)); 452 return false; 361 453 } 362 return ok;454 return true; 363 455 } 364 456 365 457 bool ChannelBase::SwitchToInput(int newInputNum, bool setstarting) 366 458 { 459 VERBOSE(VB_CHANNEL, LOC + QString("SwitchToInput(%1, %2)") 460 .arg(newInputNum).arg(setstarting)); 461 367 462 InputMap::const_iterator it = inputs.find(newInputNum); 368 463 if (it == inputs.end() || (*it)->startChanNum.isEmpty()) 369 464 return false; … … bool ChannelBase::SwitchToInput(int newI 375 470 // input switching code would go here 376 471 377 472 if (setstarting) 378 return SetChannelByString((*it)->startChanNum);473 SelectChannel((*it)->startChanNum); 379 474 380 475 return true; 381 476 } … … static bool is_input_busy( 486 581 return is_busy; 487 582 } 488 583 489 bool ChannelBase::IsInputAvailable( 490 int inputid, uint &mplexid_restriction) const 584 bool ChannelBase::IsInputAvailable(int inputid, uint &mplexid_restriction) const 491 585 { 492 586 if (inputid < 0) 493 587 return false; … … bool ChannelBase::ChangeExternalChannel( 652 746 } 653 747 else 654 748 { // child contains the pid of the new process 655 int status = 0, pid = 0; 749 QMutex lock; 750 int status = 0, pid = 0; 751 656 752 VERBOSE(VB_CHANNEL, "Waiting for External Tuning program to exit"); 657 753 658 754 bool timed_out = false; 659 755 uint timeout = 30; // how long to wait in seconds 660 756 time_t start_time = time(0); 661 while (-1 != pid && !timed_out )757 while (-1 != pid && !timed_out && !Aborted()) 662 758 { 663 sleep(1); 759 lock.lock(); 760 tuneCond.wait(&lock, 500); // sleep up to 0.5 seconds 664 761 pid = waitpid(child, &status, WUNTRACED|WNOHANG); 665 762 VERBOSE(VB_IMPORTANT, QString("ret_pid(%1) child(%2) status(0x%3)") 666 763 .arg(pid).arg(child).arg(status,0,16)); 667 764 if (pid==child) 765 { 766 lock.unlock(); 668 767 break; 768 } 669 769 else if (time(0) > (time_t)(start_time + timeout)) 670 770 timed_out = true; 771 lock.unlock(); 671 772 } 672 if (timed_out) 773 774 if (timed_out || Aborted()) 673 775 { 674 VERBOSE(VB_IMPORTANT, "External Tuning program timed out, killing"); 776 if (Aborted()) 777 VERBOSE(VB_IMPORTANT, "Aborting External Tuning program"); 778 else 779 VERBOSE(VB_IMPORTANT, "External Tuning program timed out, " 780 "killing"); 675 781 kill(child, SIGTERM); 676 782 usleep(500); 677 783 kill(child, SIGKILL); … … int ChannelBase::GetChanID() const 753 859 return -1; 754 860 755 861 query.next(); 862 863 VERBOSE(VB_CHANNEL, LOC + QString(" ChannelBase::GetChanID %1") 864 .arg(query.value(0).toInt()));; 865 756 866 return query.value(0).toInt(); 757 867 } 758 868 -
libs/libmythtv/channelbase.h
old new 5 5 6 6 // Qt headers 7 7 #include <QStringList> 8 #include <qwaitcondition.h> 9 #include <qmutex.h> 10 #include <qthread.h> 8 11 9 12 // MythTV headers 10 13 #include "channelutil.h" … … 12 15 #include "tv.h" 13 16 14 17 class TVRec; 18 class ChannelBase; 19 20 /* 21 * Thread to run tunning process in 22 */ 23 class ChannelThread : public QThread 24 { 25 public: 26 virtual void run(void); 27 28 QString channel; 29 ChannelBase *tuner; 30 }; 15 31 16 32 /** \class ChannelBase 17 33 * \brief Abstract class providing a generic interface to tuning hardware. … … class TVRec; 23 39 24 40 class ChannelBase 25 41 { 26 public: 42 friend class ChannelThread; 43 44 public: 45 enum Status { changeUnknown = 'U', changePending = 'P', 46 changeFailed = 'F', changeSuccess = 'S' }; 47 27 48 ChannelBase(TVRec *parent); 28 virtual ~ChannelBase( );49 virtual ~ChannelBase(void); 29 50 30 51 virtual bool Init(QString &inputname, QString &startchannel, bool setchan); 31 52 virtual bool IsTunable(const QString &input, const QString &channum) const; 32 53 54 virtual void SelectChannel(const QString & chan); 55 56 Status GetStatus(void); 57 Status Wait(void); 58 33 59 // Methods that must be implemented. 34 60 /// \brief Opens the channel changing hardware for use. 35 61 virtual bool Open(void) = 0; 36 62 /// \brief Closes the channel changing hardware to use. 37 63 virtual void Close(void) = 0; 38 virtual bool SetChannelByString(const QString &chan) = 0;39 64 /// \brief Reports whether channel is already open 40 65 virtual bool IsOpen(void) const = 0; 41 66 … … class ChannelBase 82 107 const QString &newChanNum); 83 108 84 109 // Input toggling convenience methods 85 virtual bool SwitchToInput(const QString &input); 86 virtual bool SwitchToInput(const QString &input, const QString &chan); 110 // virtual bool SwitchToInput(const QString &input); // not used? 111 virtual bool SelectInput(const QString &input, const QString &chan, 112 bool use_sm); 87 113 88 114 virtual bool InitializeInputs(void); 89 115 … … class ChannelBase 108 134 109 135 virtual int GetCardID(void) const; 110 136 protected: 137 virtual bool SetChannelByString(const QString &chan) = 0; 138 111 139 /// \brief Switches to another input on hardware, 112 140 /// and sets the channel is setstarting is true. 113 141 virtual bool SwitchToInput(int inputNum, bool setstarting); … … class ChannelBase 119 147 static void StoreDefaultInput(uint cardid, const QString &input); 120 148 void ClearInputMap(void); 121 149 150 bool Aborted(); 151 void setStatus(Status status); 152 void TeardownAll(void); 153 122 154 TVRec *pParent; 123 155 QString curchannelname; 124 156 int currentInputID; … … class ChannelBase 126 158 uint cardid; 127 159 InputMap inputs; 128 160 DBChanList allchannels; ///< channels across all inputs 161 162 QWaitCondition tuneCond; 163 164 private: 165 mutable ChannelThread tuneThread; 166 Status tuneStatus; 167 QMutex thread_lock; 168 bool abort_change; 129 169 }; 130 170 131 171 #endif -
new file libs/libmythtv/channelchangemonitor.cpp
- + 1 // -*- Mode: c++ -*- 2 3 #include <cerrno> 4 #include <unistd.h> 5 #include <sys/ioctl.h> 6 7 #include "videodev_myth.h" 8 #include "mythcontext.h" 9 #include "channelchangemonitor.h" 10 #include "v4lchannel.h" 11 12 #define LOC QString("ChannelChangeM: ").arg(channel->GetDevice()) 13 #define LOC_ERR QString("ChannelChangeM, Error: ").arg(channel->GetDevice()) 14 15 ChannelChangeMonitor::ChannelChangeMonitor( 16 int db_cardnum, V4LChannel *_channel, uint64_t _flags) : 17 SignalMonitor(db_cardnum, _channel, _flags) 18 { 19 } 20 21 void ChannelChangeMonitor::UpdateValues(void) 22 { 23 if (!running || exit) 24 return; 25 26 if (!IsChannelTuned()) 27 return; 28 29 { 30 QMutexLocker locker(&statusLock); 31 signalLock.SetValue(true); 32 signalStrength.SetValue(100); 33 } 34 35 EmitStatus(); 36 SendMessageAllGood(); 37 } 38 -
new file libs/libmythtv/channelchangemonitor.h
- + 1 // -*- Mode: c++ -*- 2 // Copyright (c) 2005, Daniel Thor Kristjansson 3 4 #ifndef _CHANNEL_CHANGE_MONITOR_H_ 5 #define _CHANNEL_CHANGE_MONITOR_H_ 6 7 // MythTV headers 8 #include "signalmonitor.h" 9 10 class V4LChannel; 11 12 class ChannelChangeMonitor : public SignalMonitor 13 { 14 public: 15 ChannelChangeMonitor( 16 int db_cardnum, V4LChannel *_channel, 17 uint64_t _flags = kSigMon_WaitForSig); 18 19 virtual void UpdateValues(void); 20 }; 21 22 #endif // _CHANNEL_CHANGE_MONITOR_H_ -
libs/libmythtv/channelscan/channelscan_sm.cpp
old new void ChannelScanSM::ScanTransport(const 1626 1626 } 1627 1627 1628 1628 // Start signal monitor for this channel 1629 signalMonitor->Start( );1629 signalMonitor->Start(false); 1630 1630 1631 1631 timer.start(); 1632 1632 waitingForTables = (item.tuning.sistandard != "analog"); -
libs/libmythtv/channelscan/channelscan_sm.h
old new class AnalogSignalHandler : public Signa 73 73 public slots: 74 74 virtual inline void AllGood(void); 75 75 virtual void StatusSignalLock(const SignalMonitorValue&) { } 76 virtual void StatusChannelTuned(const SignalMonitorValue&) { } 76 77 virtual void StatusSignalStrength(const SignalMonitorValue&) { } 77 78 78 79 private: -
libs/libmythtv/channelscan/scanmonitor.cpp
old new QEvent::Type ScannerEvent::SetStatusSign 55 55 (QEvent::Type) QEvent::registerEventType(); 56 56 QEvent::Type ScannerEvent::SetStatusSignalLock = 57 57 (QEvent::Type) QEvent::registerEventType(); 58 QEvent::Type ScannerEvent::SetStatusChannelTuned = 59 (QEvent::Type) QEvent::registerEventType(); 58 60 59 61 /// Percentage to set to after the transports have been scanned 60 62 #define TRANSPORT_PCT 6 … … void ScanMonitor::StatusSignalLock(const 133 135 post_event(this, ScannerEvent::SetStatusSignalLock, val.GetValue()); 134 136 } 135 137 138 void ScanMonitor::StatusChannelTuned(const SignalMonitorValue &val) 139 { 140 post_event(this, ScannerEvent::SetStatusChannelTuned, val.GetValue()); 141 } 142 136 143 void ScanMonitor::StatusSignalToNoise(const SignalMonitorValue &val) 137 144 { 138 145 post_event(this, ScannerEvent::SetStatusSignalToNoise, -
libs/libmythtv/channelscan/scanmonitor.h
old new class ScanMonitor : 65 65 // SignalMonitorListener 66 66 virtual void AllGood(void) { } 67 67 virtual void StatusSignalLock(const SignalMonitorValue&); 68 virtual void StatusChannelTuned(const SignalMonitorValue&); 68 69 virtual void StatusSignalStrength(const SignalMonitorValue&); 69 70 70 71 // DVBSignalMonitorListener … … class ScannerEvent : public QEvent 110 111 static Type SetStatusSignalToNoise; 111 112 static Type SetStatusSignalStrength; 112 113 static Type SetStatusSignalLock; 114 static Type SetStatusChannelTuned; 113 115 114 116 private: 115 117 ~ScannerEvent() { } -
libs/libmythtv/dtvsignalmonitor.cpp
old new DTVSignalMonitor::DTVSignalMonitor(int d 25 25 uint64_t wait_for_mask) 26 26 : SignalMonitor(db_cardnum, _channel, wait_for_mask), 27 27 stream_data(NULL), 28 channelTuned(QObject::tr("Channel Tuned"), "tuned", 3, true, 0, 3, 0), 28 29 seenPAT(QObject::tr("Seen")+" PAT", "seen_pat", 1, true, 0, 1, 0), 29 30 seenPMT(QObject::tr("Seen")+" PMT", "seen_pmt", 1, true, 0, 1, 0), 30 31 seenMGT(QObject::tr("Seen")+" MGT", "seen_mgt", 1, true, 0, 1, 0), … … QStringList DTVSignalMonitor::GetStatusL 63 64 { 64 65 QStringList list = SignalMonitor::GetStatusList(kick); 65 66 QMutexLocker locker(&statusLock); 67 68 // tuned? 69 if (flags & kSigMon_Tuned) 70 { 71 list<<channelTuned.GetName()<<channelTuned.GetStatus(); 72 } 73 66 74 // mpeg tables 67 75 if (flags & kDTVSigMon_WaitForPAT) 68 76 { … … void DTVSignalMonitor::RemoveFlags(uint6 138 146 void DTVSignalMonitor::UpdateMonitorValues(void) 139 147 { 140 148 QMutexLocker locker(&statusLock); 149 channelTuned.SetValue((flags & kSigMon_Tuned) ? 3 : 1); 141 150 seenPAT.SetValue( (flags & kDTVSigMon_PATSeen) ? 1 : 0); 142 151 seenPMT.SetValue( (flags & kDTVSigMon_PMTSeen) ? 1 : 0); 143 152 seenMGT.SetValue( (flags & kDTVSigMon_MGTSeen) ? 1 : 0); -
libs/libmythtv/dtvsignalmonitor.h
old new class DTVSignalMonitor : public SignalMo 111 111 protected: 112 112 MPEGStreamData *stream_data; 113 113 vector<uint> eit_pids; 114 SignalMonitorValue channelTuned; 114 115 SignalMonitorValue seenPAT; 115 116 SignalMonitorValue seenPMT; 116 117 SignalMonitorValue seenMGT; -
libs/libmythtv/dvbsignalmonitor.cpp
old new void DVBSignalMonitor::UpdateValues(void 230 230 return; 231 231 } 232 232 233 if (!IsChannelTuned()) 234 return; 235 233 236 AddFlags(kSigMon_WaitForSig); 234 237 235 238 DVBChannel *dvbchannel = GetDVBChannel(); -
libs/libmythtv/firewiresignalmonitor.cpp
old new void FirewireSignalMonitor::UpdateValues 190 190 if (!running || exit) 191 191 return; 192 192 193 if (!IsChannelTuned()) 194 return; 195 193 196 if (dtvMonitorRunning) 194 197 { 195 198 EmitStatus(); -
libs/libmythtv/hdhrchannel.cpp
old new bool HDHRChannel::SetChannelByString(con 131 131 // change inputs and return, since the act of changing 132 132 // inputs will change the channel as well. 133 133 if (!inputName.isEmpty()) 134 return S witchToInput(inputName, channum);134 return SelectInput(inputName, channum, false); 135 135 136 136 ClearDTVInfo(); 137 137 … … bool HDHRChannel::SetChannelByString(con 143 143 if (!IsInputAvailable(currentInputID, mplexid_restriction)) 144 144 return false; 145 145 146 if (Aborted()) 147 return false; 148 146 149 // Fetch tuning data from the database. 147 150 QString tvformat, modulation, freqtable, freqid, si_std; 148 151 int finetune; -
libs/libmythtv/hdhrsignalmonitor.cpp
old new void HDHRSignalMonitor::UpdateValues(voi 105 105 return; 106 106 } 107 107 108 if (!IsChannelTuned()) 109 return; 110 108 111 struct hdhomerun_tuner_status_t status; 109 112 streamHandler->GetTunerStatus(&status); 110 113 -
libs/libmythtv/iptvsignalmonitor.cpp
old new void IPTVSignalMonitor::UpdateValues(voi 119 119 if (!running || exit) 120 120 return; 121 121 122 if (!IsChannelTuned()) 123 return; 124 122 125 if (dtvMonitorRunning) 123 126 { 124 127 EmitStatus(); -
libs/libmythtv/libmythtv.pro
old new using_backend { 445 445 LIBS += $$OSS_LIBS 446 446 } 447 447 448 HEADERS += channelchangemonitor.h 449 SOURCES += channelchangemonitor.cpp 450 448 451 # Support for Video4Linux devices 449 452 using_v4l { 450 453 HEADERS += v4lchannel.h analogsignalmonitor.h -
libs/libmythtv/signalmonitor.cpp
old new 8 8 9 9 // MythTV headers 10 10 #include "mythcontext.h" 11 #include "tv_rec.h" 11 12 #include "signalmonitor.h" 12 13 #include "compat.h" 13 14 #include "mythverbose.h" … … extern "C" { 42 43 # include "firewirechannel.h" 43 44 #endif 44 45 46 #include "channelchangemonitor.h" 47 45 48 #undef DBG_SM 46 49 #define DBG_SM(FUNC, MSG) VERBOSE(VB_CHANNEL, \ 47 50 "SM("<<channel->GetDevice()<<")::"<<FUNC<<": "<<MSG); … … SignalMonitor *SignalMonitor::Init(QStri 93 96 #endif 94 97 95 98 #ifdef USING_V4L 99 #if 0 // Just use ChannelChangeMonitor for these types 96 100 if ((cardtype.toUpper() == "V4L") || 97 (cardtype.toUpper() == "MPEG") || 98 (cardtype.toUpper() == "HDPVR")) 101 (cardtype.toUpper() == "MPEG")) 99 102 { 100 103 V4LChannel *chan = dynamic_cast<V4LChannel*>(channel); 101 104 if (chan) 102 105 signalMonitor = new AnalogSignalMonitor(db_cardnum, chan); 103 106 } 104 107 #endif 108 #endif 105 109 106 110 #ifdef USING_HDHOMERUN 107 111 if (cardtype.toUpper() == "HDHOMERUN") … … SignalMonitor *SignalMonitor::Init(QStri 132 136 133 137 if (!signalMonitor) 134 138 { 139 V4LChannel *chan = dynamic_cast<V4LChannel*>(channel); 140 if (chan) 141 signalMonitor = new ChannelChangeMonitor(db_cardnum, chan); 142 } 143 144 if (!signalMonitor) 145 { 135 146 VERBOSE(VB_IMPORTANT, 136 147 QString("Failed to create signal monitor in Init(%1, %2, 0x%3)") 137 148 .arg(cardtype).arg(db_cardnum).arg((long)channel,0,16)); … … SignalMonitor::SignalMonitor(int _captur 160 171 update_rate(25), minimum_update_rate(5), 161 172 running(false), exit(false), 162 173 update_done(false), notify_frontend(true), 163 error(""), 174 is_tuned(false), tablemon(false), 175 eit_scan(false), error(""), 164 176 signalLock (QObject::tr("Signal Lock"), "slock", 165 177 1, true, 0, 1, 0), 166 178 signalStrength(QObject::tr("Signal Power"), "signal", 167 179 0, true, 0, 100, 0), 180 channelTuned("Channel Tuned", "tuned", 3, true, 0, 3, 0), 168 181 statusLock(QMutex::Recursive) 169 182 { 170 183 } … … bool SignalMonitor::HasAnyFlag(uint64_t 202 215 /** \fn SignalMonitor::Start() 203 216 * \brief Start signal monitoring thread. 204 217 */ 205 void SignalMonitor::Start( )218 void SignalMonitor::Start(bool waitfor_tune) 206 219 { 207 220 DBG_SM("Start", "begin"); 208 221 { 209 222 QMutexLocker locker(&startStopLock); 223 224 // When used for scanning, don't wait for the tuning thread 225 is_tuned = !waitfor_tune; 226 210 227 if (!running) 211 228 { 212 229 int rval = pthread_create( … … QStringList SignalMonitor::GetStatusList 279 296 280 297 QStringList list; 281 298 statusLock.lock(); 299 list<<channelTuned.GetName()<<channelTuned.GetStatus(); 282 300 list<<signalLock.GetName()<<signalLock.GetStatus(); 283 301 if (HasFlags(kSigMon_WaitForSig)) 284 302 list<<signalStrength.GetName()<<signalStrength.GetStatus(); … … void SignalMonitor::MonitorLoop() 306 324 QStringList slist = GetStatusList(false); 307 325 MythEvent me(QString("SIGNAL %1").arg(capturecardnum), slist); 308 326 gContext->dispatch(me); 309 //cerr<<"sent SIGNAL"<<endl;310 327 } 311 328 312 329 usleep(update_rate * 1000); … … void SignalMonitor::SendMessage( 441 458 case kStatusSignalStrength: 442 459 listener->StatusSignalStrength(val); 443 460 break; 461 case kStatusChannelTuned: 462 listener->StatusChannelTuned(val); 463 break; 444 464 case kStatusSignalToNoise: 445 465 if (dvblistener) 446 466 dvblistener->StatusSignalToNoise(val); … … void SignalMonitor::SendMessage( 461 481 } 462 482 } 463 483 484 bool SignalMonitor::IsChannelTuned(void) 485 { 486 if (is_tuned) 487 return true; 488 489 ChannelBase::Status status = channel->GetStatus(); 490 QMutexLocker locker(&statusLock); 491 492 switch (status) { 493 case ChannelBase::changePending: 494 channelTuned.SetValue(1); 495 break; 496 case ChannelBase::changeFailed: 497 channelTuned.SetValue(2); 498 break; 499 case ChannelBase::changeSuccess: 500 channelTuned.SetValue(3); 501 break; 502 } 503 504 EmitStatus(); 505 506 if (status == ChannelBase::changeSuccess) 507 { 508 if (tablemon) 509 pParent->SetupDTVSignalMonitor(eit_scan); 510 511 is_tuned = true; 512 return true; 513 } 514 515 return false; 516 } 517 464 518 void SignalMonitor::SendMessageAllGood(void) 465 519 { 466 520 QMutexLocker locker(&listenerLock); … … void SignalMonitor::SendMessageAllGood(v 470 524 471 525 void SignalMonitor::EmitStatus(void) 472 526 { 527 SendMessage(kStatusChannelTuned, channelTuned); 473 528 SendMessage(kStatusSignalLock, signalLock); 474 529 if (HasFlags(kSigMon_WaitForSig)) 475 530 SendMessage(kStatusSignalStrength, signalStrength); -
libs/libmythtv/signalmonitor.h
old new using namespace std; 26 26 27 27 inline QString sm_flags_to_string(uint64_t); 28 28 29 class TVRec; 30 29 31 class SignalMonitor 30 32 { 31 33 public: … … class SignalMonitor 39 41 // // // // // // // // // // // // // // // // // // // // // // // // 40 42 // Control // // // // // // // // // // // // // // // // // // // // 41 43 42 virtual void Start( );44 virtual void Start(bool waitfor_tune); 43 45 virtual void Stop(); 44 46 virtual void Kick(); 45 47 virtual bool WaitForLock(int timeout = -1); … … class SignalMonitor 83 85 */ 84 86 void SetNotifyFrontend(bool notify) { notify_frontend = notify; } 85 87 88 /** \brief Indicate if table monitoring is needed 89 * \param monitor if true parent->SetupDTVSignalMonitor is called 90 * after the channel is tuned. 91 */ 92 void SetMonitoring(TVRec * parent, bool EITscan, bool monitor) 93 { pParent = parent; eit_scan = EITscan, tablemon = monitor; } 94 86 95 /** \brief Sets the number of milliseconds between signal monitoring 87 96 * attempts in the signal monitoring thread. 88 97 * … … class SignalMonitor 108 117 static void* SpawnMonitorLoop(void*); 109 118 virtual void MonitorLoop(); 110 119 120 bool IsChannelTuned(void); 121 111 122 /// \brief This should be overridden to actually do signal monitoring. 112 123 virtual void UpdateValues() { ; } 113 124 … … class SignalMonitor 139 150 /// We've seen something indicating whether the data stream is encrypted 140 151 static const uint64_t kDTVSigMon_CryptSeen = 0x0000000200ULL; 141 152 153 static const uint64_t kSigMon_Tuned = 0x0000000400ULL; 154 142 155 /// We've seen a PAT matching our requirements 143 156 static const uint64_t kDTVSigMon_PATMatch = 0x0000001000ULL; 144 157 /// We've seen a PMT matching our requirements … … class SignalMonitor 184 197 protected: 185 198 pthread_t monitor_thread; 186 199 ChannelBase *channel; 200 TVRec *pParent; 187 201 int capturecardnum; 188 202 uint64_t flags; 189 203 int update_rate; … … class SignalMonitor 192 206 bool exit; 193 207 bool update_done; 194 208 bool notify_frontend; 209 bool is_tuned; 210 bool tablemon; 211 bool eit_scan; 195 212 QString error; 196 213 197 214 SignalMonitorValue signalLock; 198 215 SignalMonitorValue signalStrength; 216 SignalMonitorValue channelTuned; 199 217 200 218 vector<SignalMonitorListener*> listeners; 201 219 -
libs/libmythtv/signalmonitorlistener.h
old new 9 9 10 10 typedef enum { 11 11 kAllGood, 12 kStatusChannelTuned, 12 13 kStatusSignalLock, 13 14 kStatusSignalStrength, 14 15 kStatusSignalToNoise, … … class MPUBLIC SignalMonitorListener 30 31 */ 31 32 virtual void AllGood(void) = 0; 32 33 34 /** \brief Signal to be sent with change change status. 35 * 36 * Note: Signals are only sent once the monitoring thread 37 * has been started. 38 */ 39 virtual void StatusChannelTuned(const SignalMonitorValue&) = 0; 40 33 41 /** \brief Signal to be sent as true when it is safe to begin 34 42 * or continue recording, and false if it may not be safe. 35 43 * -
libs/libmythtv/tv_play.cpp
old new void TV::UpdateOSDSignal(const PlayerCon 7445 7445 float snr = 0.0f; 7446 7446 uint ber = 0xffffffff; 7447 7447 int pos = -1; 7448 int tuned = -1; 7448 7449 QString pat(""), pmt(""), mgt(""), vct(""), nit(""), sdt(""), crypt(""); 7449 7450 QString err = QString::null, msg = QString::null; 7450 7451 for (it = slist.begin(); it != slist.end(); ++it) … … void TV::UpdateOSDSignal(const PlayerCon 7471 7472 ber = it->GetValue(); 7472 7473 else if ("pos" == it->GetShortName()) 7473 7474 pos = it->GetValue(); 7475 else if ("tuned" == it->GetShortName()) 7476 tuned = it->GetValue(); 7474 7477 else if ("seen_pat" == it->GetShortName()) 7475 7478 pat = it->IsGood() ? "a" : "_"; 7476 7479 else if ("matching_pat" == it->GetShortName()) … … void TV::UpdateOSDSignal(const PlayerCon 7504 7507 infoMap["signal"] = QString::number(sig); // use normalized value 7505 7508 7506 7509 bool allGood = SignalMonitorValue::AllGood(slist); 7510 char tuneCode; 7507 7511 QString slock = ("1" == infoMap["slock"]) ? "L" : "l"; 7508 7512 QString lockMsg = (slock=="L") ? tr("Partial Lock") : tr("No Lock"); 7509 7513 QString sigMsg = allGood ? tr("Lock") : lockMsg; … … void TV::UpdateOSDSignal(const PlayerCon 7516 7520 if ((pos >= 0) && (pos < 100)) 7517 7521 sigDesc += " | " + tr("Rotor %1\%").arg(pos,2); 7518 7522 7519 sigDesc = sigDesc + QString(" | (%1%2%3%4%5%6%7%8) %9") 7520 .arg(slock).arg(pat).arg(pmt).arg(mgt).arg(vct) 7521 .arg(nit).arg(sdt).arg(crypt).arg(sigMsg); 7523 if (tuned == 1) 7524 tuneCode = 't'; 7525 else if (tuned == 2) 7526 tuneCode = 'F'; 7527 else if (tuned == 3) 7528 tuneCode = 'T'; 7529 else 7530 tuneCode = '_'; 7531 7532 sigDesc = sigDesc + QString(" | (%1%2%3%4%5%6%7%8%9) %10") 7533 .arg(tuneCode).arg(slock).arg(pat).arg(pmt).arg(mgt).arg(vct) 7534 .arg(nit).arg(sdt).arg(crypt).arg(sigMsg); 7522 7535 7523 7536 if (!err.isEmpty()) 7524 7537 sigDesc = err; -
libs/libmythtv/tv_rec.cpp
old new ProgramInfo *TVRec::GetRecording(void) 367 367 void TVRec::RecordPending(const ProgramInfo *rcinfo, int secsleft, 368 368 bool hasLater) 369 369 { 370 QMutexLocker lock(&stateChangeLock); 370 QMutexLocker statelock(&stateChangeLock); 371 QMutexLocker pendlock(&pendingRecLock); 371 372 372 373 if (secsleft < 0) 373 374 { … … void TVRec::RecordPending(const ProgramI 405 406 406 407 pendingRecordings[rcinfo->cardid].possibleConflicts = cardids; 407 408 408 stateChangeLock.unlock(); 409 pendlock.unlock(); 410 statelock.unlock(); 409 411 for (uint i = 0; i < cardids.size(); i++) 410 412 RemoteRecordPending(cardids[i], rcinfo, secsleft, hasLater); 411 stateChangeLock.lock(); 413 statelock.relock(); 414 pendlock.relock(); 412 415 } 413 416 414 417 /** \fn TVRec::SetPseudoLiveTVRecording(ProgramInfo*) … … QDateTime TVRec::GetRecordEndTime(const 440 443 */ 441 444 void TVRec::CancelNextRecording(bool cancel) 442 445 { 446 QMutexLocker pendlock(&pendingRecLock); 443 447 VERBOSE(VB_RECORD, LOC + "CancelNextRecording("<<cancel<<") -- begin"); 444 448 445 449 PendingMap::iterator it = pendingRecordings.find(cardid); … … RecStatusType TVRec::StartRecording(cons 522 526 return retval; 523 527 } 524 528 525 PendingMap::iterator it = pendingRecordings.find(cardid);526 529 bool cancelNext = false; 527 if (it != pendingRecordings.end()) 530 PendingInfo pendinfo; 531 PendingMap::iterator it; 532 bool has_pending; 533 534 pendingRecLock.lock(); 535 if ((it = pendingRecordings.find(cardid)) != pendingRecordings.end()) 528 536 { 529 537 (*it).ask = (*it).doNotAsk = false; 530 538 cancelNext = (*it).canceled; 531 539 } 540 pendingRecLock.unlock(); 532 541 533 542 // Flush out events... 534 543 WaitForEventThreadSleep(); … … RecStatusType TVRec::StartRecording(cons 536 545 // Rescan pending recordings since the event loop may have deleted 537 546 // a stale entry. If this happens the info pointer will not be valid 538 547 // since the HandlePendingRecordings loop will have deleted it. 548 pendingRecLock.lock(); 539 549 it = pendingRecordings.find(cardid); 550 has_pending = (it != pendingRecordings.end()); 551 if (has_pending) 552 pendinfo = *it; 553 pendingRecLock.unlock(); 540 554 541 555 // If the needed input is in a shared input group, and we are 542 556 // not canceling the recording anyway, check other recorders 543 if (!cancelNext && 544 (it != pendingRecordings.end()) && (*it).possibleConflicts.size()) 557 if (!cancelNext && has_pending && pendinfo.possibleConflicts.size()) 545 558 { 546 559 VERBOSE(VB_RECORD, LOC + "Checking input group recorders - begin"); 547 vector<uint> &cardids = (*it).possibleConflicts;560 vector<uint> &cardids = pendinfo.possibleConflicts; 548 561 549 562 uint mplexid = 0, sourceid = 0; 550 563 vector<uint> cardids2; … … RecStatusType TVRec::StartRecording(cons 567 580 568 581 if (is_busy && !sourceid) 569 582 { 570 mplexid = (*it).info->GetMplexID();571 sourceid = (*it).info->sourceid;583 mplexid = pendinfo.info->GetMplexID(); 584 sourceid = pendinfo.info->sourceid; 572 585 } 573 586 574 587 if (is_busy && … … void TVRec::HandleStateChange(void) 955 968 void TVRec::ChangeState(TVState nextState) 956 969 { 957 970 QMutexLocker lock(&stateChangeLock); 958 959 971 desiredNextState = nextState; 960 972 changeState = true; 961 973 WakeEventLoop(); … … void TVRec::RunTV(void) 1428 1440 QDateTime now = QDateTime::currentDateTime(); 1429 1441 bool has_finish = HasFlags(kFlagFinishRecording); 1430 1442 bool has_rec = pseudoLiveTVRecording; 1443 bool enable_ui = true; 1444 1445 pendingRecLock.lock(); 1431 1446 bool rec_soon = 1432 1447 pendingRecordings.find(cardid) != pendingRecordings.end(); 1433 bool enable_ui = true;1448 pendingRecLock.unlock(); 1434 1449 1435 1450 if (has_rec && (has_finish || (now > recordEndTime))) 1436 1451 { … … bool TVRec::WaitForEventThreadSleep(bool 1601 1616 1602 1617 void TVRec::HandlePendingRecordings(void) 1603 1618 { 1619 QMutexLocker pendlock(&pendingRecLock); 1620 1604 1621 if (pendingRecordings.empty()) 1605 1622 return; 1606 1623 … … bool ApplyCachedPids(DTVSignalMonitor *d 1889 1906 * This method also grabs the ATSCStreamData() from the recorder 1890 1907 * if possible, or creates one if needed. 1891 1908 */ 1892 bool TVRec::SetupDTVSignalMonitor( void)1909 bool TVRec::SetupDTVSignalMonitor(bool EITscan) 1893 1910 { 1894 1911 VERBOSE(VB_RECORD, LOC + "Setting up table monitoring."); 1895 1912 … … bool TVRec::SetupDTVSignalMonitor(void) 2023 2040 SignalMonitor::kDVBSigMon_WaitForPos); 2024 2041 sm->SetRotorTarget(1.0f); 2025 2042 2043 if (EITscan) 2044 { 2045 sm->GetStreamData()->SetVideoStreamsRequired(0); 2046 sm->IgnoreEncrypted(true); 2047 } 2048 2026 2049 VERBOSE(VB_RECORD, LOC + "Successfully set up MPEG table monitoring."); 2027 2050 return true; 2028 2051 } … … bool TVRec::SetupDTVSignalMonitor(void) 2044 2067 * \param notify If set we notify the frontend of the signal values 2045 2068 * \return true on success, false on failure 2046 2069 */ 2047 bool TVRec::SetupSignalMonitor(bool tablemon, bool notify)2070 bool TVRec::SetupSignalMonitor(bool tablemon, bool EITscan, bool notify) 2048 2071 { 2049 2072 VERBOSE(VB_RECORD, LOC + "SetupSignalMonitor(" 2050 2073 <<tablemon<<", "<<notify<<")"); … … bool TVRec::SetupSignalMonitor(bool tabl 2060 2083 // make sure statics are initialized 2061 2084 SignalMonitorValue::Init(); 2062 2085 2063 if (SignalMonitor::IsSupported(genOpt.cardtype) && channel->Open()) 2064 signalMonitor = SignalMonitor::Init(genOpt.cardtype, cardid, channel); 2086 if (channel->Open()) 2087 signalMonitor = SignalMonitor::Init(genOpt.cardtype, cardid, 2088 channel); 2065 2089 2066 2090 if (signalMonitor) 2067 2091 { 2068 2092 VERBOSE(VB_RECORD, LOC + "Signal monitor successfully created"); 2069 // If this is a monitor for Digital TV, initialize table monitors2070 if (GetDTVSignalMonitor() && tablemon && !SetupDTVSignalMonitor())2071 {2072 VERBOSE(VB_IMPORTANT, LOC_ERR +2073 "Failed to setup digital signal monitoring");2074 2075 return false;2076 }2077 2093 2094 signalMonitor->SetMonitoring(this, EITscan, 2095 GetDTVSignalMonitor() && tablemon); 2078 2096 signalMonitor->AddListener(this); 2079 2097 signalMonitor->SetUpdateRate(kSignalMonitoringRate); 2080 2098 signalMonitor->SetNotifyFrontend(notify); 2081 2099 2082 2100 // Start the monitoring thread 2083 signalMonitor->Start( );2101 signalMonitor->Start(true); 2084 2102 } 2085 2103 2086 2104 return true; … … bool TVRec::IsReallyRecording(void) 2485 2503 */ 2486 2504 bool TVRec::IsBusy(TunedInputInfo *busy_input, int time_buffer) const 2487 2505 { 2488 QMutexLocker lock(&stateChangeLock);2489 2490 2506 TunedInputInfo dummy; 2491 2507 if (!busy_input) 2492 2508 busy_input = &dummy; … … bool TVRec::IsBusy(TunedInputInfo *busy_ 2508 2524 chanid = channel->GetChanID(); 2509 2525 } 2510 2526 2511 PendingMap::const_iterator it = pendingRecordings.find(cardid); 2512 if (!busy_input->inputid && (it != pendingRecordings.end())) 2527 PendingInfo pendinfo; 2528 bool has_pending; 2529 { 2530 pendingRecLock.lock(); 2531 PendingMap::const_iterator it = pendingRecordings.find(cardid); 2532 has_pending = (it != pendingRecordings.end()); 2533 if (has_pending) 2534 pendinfo = *it; 2535 pendingRecLock.unlock(); 2536 } 2537 2538 if (!busy_input->inputid && has_pending) 2513 2539 { 2514 2540 int timeLeft = QDateTime::currentDateTime() 2515 .secsTo( (*it).recordingStart);2541 .secsTo(pendinfo.recordingStart); 2516 2542 2517 2543 if (timeLeft <= time_buffer) 2518 2544 { 2519 2545 QString channum = QString::null, input = QString::null; 2520 if ( (*it).info->GetChannel(channum, input))2546 if (pendinfo.info->GetChannel(channum, input)) 2521 2547 { 2522 2548 busy_input->inputid = channel->GetInputByName(input); 2523 chanid = (*it).info->chanid.toUInt();2549 chanid = pendinfo.info->chanid.toUInt(); 2524 2550 } 2525 2551 } 2526 2552 } … … void TVRec::TuningShutdowns(const Tuning 3678 3704 void TVRec::TuningFrequency(const TuningRequest &request) 3679 3705 { 3680 3706 DTVChannel *dtvchan = GetDTVChannel(); 3707 3708 bool livetv = request.flags & kFlagLiveTV; 3709 bool antadj = request.flags & kFlagAntennaAdjust; 3710 bool has_dummy = false; 3711 3681 3712 if (dtvchan) 3682 3713 { 3683 3714 MPEGStreamData *mpeg = NULL; … … void TVRec::TuningFrequency(const Tuning 3694 3725 3695 3726 if (request.minorChan && (tuningmode == "atsc")) 3696 3727 { 3697 channel->SetChannelByString(request.channel); 3698 3728 channel->SelectChannel(request.channel); 3699 3729 ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg); 3700 3730 if (atsc) 3701 3731 atsc->SetDesiredChannel(request.majorChan, request.minorChan); 3702 3732 } 3703 3733 else if (request.progNum >= 0) 3704 3734 { 3705 channel->SetChannelByString(request.channel); 3706 3735 channel->SelectChannel(request.channel); 3707 3736 if (mpeg) 3708 3737 mpeg->SetDesiredProgram(request.progNum); 3709 3738 } … … void TVRec::TuningFrequency(const Tuning 3732 3761 if (channel && !channum.isEmpty()) 3733 3762 { 3734 3763 if (!input.isEmpty()) 3735 ok = channel->S witchToInput(input, channum);3764 ok = channel->SelectInput(input, channum, true); 3736 3765 else 3737 ok = channel->SetChannelByString(channum); 3766 { 3767 channel->SelectChannel(channum); 3768 ok = true; 3769 } 3738 3770 } 3739 3771 3740 3772 if (!ok) … … void TVRec::TuningFrequency(const Tuning 3761 3793 } 3762 3794 } 3763 3795 3764 bool livetv = request.flags & kFlagLiveTV; 3765 bool antadj = request.flags & kFlagAntennaAdjust; 3766 bool use_sm = SignalMonitor::IsRequired(genOpt.cardtype); 3767 bool use_dr = use_sm && (livetv || antadj); 3768 bool has_dummy = false; 3769 3770 if (use_dr) 3796 if (livetv || antadj) 3771 3797 { 3772 3798 // We need there to be a ringbuffer for these modes 3773 3799 bool ok; … … void TVRec::TuningFrequency(const Tuning 3793 3819 has_dummy = true; 3794 3820 } 3795 3821 3796 // Start signal monitoring for devices capable of monitoring 3797 if (use_sm) 3822 // Start signal (or channel change) monitoring 3823 VERBOSE(VB_RECORD, LOC + "Starting Signal Monitor"); 3824 bool error = false; 3825 if (!SetupSignalMonitor(!antadj, request.flags & kFlagEITScan, 3826 livetv | antadj)) 3798 3827 { 3799 VERBOSE(VB_RECORD, LOC + "Starting Signal Monitor"); 3800 bool error = false; 3801 if (!SetupSignalMonitor(!antadj, livetv | antadj)) 3802 { 3803 VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to setup signal monitor"); 3804 if (signalMonitor) 3805 { 3806 delete signalMonitor; 3807 signalMonitor = NULL; 3808 } 3809 3810 // pretend the signal monitor is running to prevent segfault 3811 SetFlags(kFlagSignalMonitorRunning); 3812 ClearFlags(kFlagWaitingForSignal); 3813 error = true; 3814 } 3815 3828 VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to setup signal monitor"); 3816 3829 if (signalMonitor) 3817 3830 { 3818 if (request.flags & kFlagEITScan) 3819 { 3820 GetDTVSignalMonitor()->GetStreamData()-> 3821 SetVideoStreamsRequired(0); 3822 GetDTVSignalMonitor()->IgnoreEncrypted(true); 3823 } 3824 3825 SetFlags(kFlagSignalMonitorRunning); 3826 ClearFlags(kFlagWaitingForSignal); 3827 if (!antadj) 3828 SetFlags(kFlagWaitingForSignal); 3831 delete signalMonitor; 3832 signalMonitor = NULL; 3829 3833 } 3830 3834 3831 if (has_dummy && ringBuffer) 3832 { 3833 // Make sure recorder doesn't point to bogus ringbuffer before 3834 // it is potentially restarted without a new ringbuffer, if 3835 // the next channel won't tune and the user exits LiveTV. 3836 if (recorder) 3837 recorder->SetRingBuffer(NULL); 3835 // pretend the signal monitor is running to prevent segfault 3836 SetFlags(kFlagSignalMonitorRunning); 3837 ClearFlags(kFlagWaitingForSignal); 3838 error = true; 3839 } 3838 3840 3839 SetFlags(kFlagDummyRecorderRunning); 3840 VERBOSE(VB_RECORD, "DummyDTVRecorder -- started"); 3841 SetFlags(kFlagRingBufferReady); 3842 } 3841 if (signalMonitor) 3842 { 3843 SetFlags(kFlagSignalMonitorRunning); 3844 ClearFlags(kFlagWaitingForSignal); 3845 if (!antadj) 3846 SetFlags(kFlagWaitingForSignal); 3847 } 3843 3848 3844 // if we had problems starting the signal monitor, 3845 // we don't want to start the recorder... 3846 if (error) 3847 return; 3849 if (has_dummy && ringBuffer) 3850 { 3851 // Make sure recorder doesn't point to bogus ringbuffer before 3852 // it is potentially restarted without a new ringbuffer, if 3853 // the next channel won't tune and the user exits LiveTV. 3854 if (recorder) 3855 recorder->SetRingBuffer(NULL); 3856 3857 SetFlags(kFlagDummyRecorderRunning); 3858 VERBOSE(VB_RECORD, "DummyDTVRecorder -- started"); 3859 SetFlags(kFlagRingBufferReady); 3848 3860 } 3849 3861 3862 // if we had problems starting the signal monitor, 3863 // we don't want to start the recorder... 3864 if (error) 3865 return; 3866 3850 3867 // Request a recorder, if the command is a recording command 3851 3868 ClearFlags(kFlagNeedToStartRecorder); 3852 3869 if (request.flags & kFlagRec && !antadj) -
libs/libmythtv/tv_rec.h
old new typedef QMap<uint,PendingInfo> PendingMa 150 150 class MPUBLIC TVRec : public SignalMonitorListener 151 151 { 152 152 friend class TuningRequest; 153 friend class SignalMonitor; 153 154 154 155 public: 155 156 TVRec(int capturecardnum); … … class MPUBLIC TVRec : public SignalMonit 244 245 static TVRec *GetTVRec(uint cardid); 245 246 246 247 virtual void AllGood(void) { WakeEventLoop(); } 248 virtual void StatusChannelTuned(const SignalMonitorValue&) { } 247 249 virtual void StatusSignalLock(const SignalMonitorValue&) { } 248 250 virtual void StatusSignalStrength(const SignalMonitorValue&) { } 249 251 … … class MPUBLIC TVRec : public SignalMonit 252 254 bool WaitForEventThreadSleep(bool wake = true, ulong time = ULONG_MAX); 253 255 static void *EventThread(void *param); 254 256 static void *RecorderThread(void *param); 257 bool SetupDTVSignalMonitor(bool EITscan); 255 258 256 259 private: 257 260 void SetRingBuffer(RingBuffer *); … … class MPUBLIC TVRec : public SignalMonit 281 284 FirewireChannel *GetFirewireChannel(void); 282 285 V4LChannel *GetV4LChannel(void); 283 286 284 bool SetupSignalMonitor(bool enable_table_monitoring, bool notify);285 bool SetupDTVSignalMonitor(void);287 bool SetupSignalMonitor(bool enable_table_monitoring, 288 bool EITscan, bool notify); 286 289 void TeardownSignalMonitor(void); 287 290 DTVSignalMonitor *GetDTVSignalMonitor(void); 288 291 … … class MPUBLIC TVRec : public SignalMonit 360 363 361 364 // State variables 362 365 mutable QMutex stateChangeLock; 366 mutable QMutex pendingRecLock; 363 367 TVState internalState; 364 368 TVState desiredNextState; 365 369 bool changeState; -
libs/libmythtv/v4lchannel.h
old new class V4LChannel : public DTVChannel 49 49 QString GetSIStandard(void) const { return "atsc"; } 50 50 51 51 // Commands 52 bool SwitchToInput(int newcapchannel, bool setstarting);53 52 bool Retune(void); 54 53 55 54 // Picture attributes. … … class V4LChannel : public DTVChannel 69 68 bool Tune(uint frequency, QString inputname, 70 69 QString modulation, QString si_std); 71 70 71 protected: 72 bool SwitchToInput(int newcapchannel, bool setstarting); 73 72 74 private: 73 75 // Helper Sets 74 76 void SetFreqTable(const int index); -
libs/libmythtv/dvbchannel.cpp
old new bool DVBChannel::SetChannelByString(cons 394 394 return true; 395 395 } 396 396 397 bool DVBChannel::SwitchToInput(const QString &inputname, const QString &chan) 397 bool DVBChannel::SelectInput(const QString &inputname, const QString &chan, 398 bool use_sm) 398 399 { 399 400 int input = GetInputByName(inputname); 400 401 401 bool ok = false;402 402 if (input >= 0) 403 403 { 404 404 nextInputID = input; 405 ok = SetChannelByString(chan); 405 if (use_sm) 406 SelectChannel(chan); 407 else 408 return SetChannelByString(chan); 406 409 } 407 410 else 408 411 { 409 412 VERBOSE(VB_IMPORTANT, 410 413 QString("DVBChannel: Could not find input: %1 on card when " 411 414 "setting channel %2\n").arg(inputname).arg(chan)); 415 return false; 412 416 } 413 return ok;417 return true; 414 418 } 415 419 416 420 bool DVBChannel::SwitchToInput(int newInputNum, bool setstarting) -
libs/libmythtv/dvbchannel.h
old new class DVBChannel : public DTVChannel 78 78 double GetUncorrectedBlockCount(bool *ok = NULL) const; 79 79 80 80 // Commands 81 #if 0 81 82 bool SwitchToInput(const QString &inputname, const QString &chan); 83 #else 84 bool SelectInput(const QString &inputname, const QString &chan, 85 bool use_sm); 86 #endif 82 87 bool SwitchToInput(int newcapchannel, bool setstarting); 83 88 bool SetChannelByString(const QString &chan); 84 89 bool Tune(const DTVMultiplex &tuning, QString inputname); -
libs/libmythtv/v4lchannel.cpp
old new bool V4LChannel::SetChannelByString(cons 441 441 // change inputs and return, since the act of changing 442 442 // inputs will change the channel as well. 443 443 if (!inputName.isEmpty()) 444 return ChannelBase::S witchToInput(inputName, channum);444 return ChannelBase::SelectInput(inputName, channum, false); 445 445 446 446 ClearDTVInfo(); 447 447
