18#define LOC QString("FireSigMon[%1](%2): ") \
19 .arg(m_inputid).arg(m_channel->GetDevice())
51 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"ctor");
66 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"dtor");
75 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Stop() -- begin");
84 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Stop() -- end");
99 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"HandlePAT() ignoring PAT");
107 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Wait for valid PAT timed out");
116 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"HandlePMT()");
123 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"HandlePMT() ignoring PMT");
136 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- begin");
144 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- err");
146 std::this_thread::sleep_for(10ms);
148 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- err end");
158 std::this_thread::sleep_for(10ms);
160 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- shutdown ");
166 std::this_thread::sleep_for(10ms);
168 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"RunTableMonitor(): -- end");
219 bool retried =
false;
230 fwchan->SetPowerState(
true);
237 if (qfailed && !retried)
243 LOG(VB_RECORD, LOG_WARNING,
244 "Can't determine if STB is power on, assuming it is...");
288 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"UpdateValues() -- "
289 "Waiting for table monitor to start");
292 std::this_thread::sleep_for(5ms);
294 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"UpdateValues() -- "
295 "Table monitor started");
This class is intended to detect the presence of needed tables.
bool IsAllGood(void) const override
void HandlePMT(uint program_num, const ProgramMapTable *pmt) override
void HandlePAT(const ProgramAssociationTable *pat) override
void AddFlags(uint64_t _flags) override
MPEGStreamData * GetStreamData()
Returns the MPEG stream data if it exists.
FirewireChannel Copyright (c) 2005 by Jim Westfall and Dave Abrahams Distributed as part of MythTV un...
virtual FirewireDevice * GetFirewireDevice(void)
virtual FirewireDevice::PowerState GetPowerState(void) const
virtual void AddListener(TSDataListener *listener)
virtual void RemoveListener(TSDataListener *listener)
bool IsSTBBufferCleared(void) const
virtual bool OpenPort(void)=0
virtual bool ClosePort(void)=0
void Stop(void) override
Stop signal monitoring and table monitoring threads.
void AddData(const unsigned char *data, uint len) override
Callback function to add MPEG2 TS data.
volatile bool m_dtvMonitorRunning
void HandlePMT(uint pnum, const ProgramMapTable *pmt) override
void UpdateValues(void) override
Fills in frontend stats and emits status Qt signals.
FirewireTableMonitorThread * m_tableMonitorThread
static constexpr std::chrono::milliseconds kBufferTimeout
MythTimer m_stbWaitForPowerTimer
FirewireSignalMonitor(void)
bool m_stbNeedsToWaitForPat
~FirewireSignalMonitor() override
Stops signal monitoring and table monitoring threads.
bool m_stbNeedsToWaitForPower
void RunTableMonitor(void)
static QMutex s_patKeysLock
friend class FirewireTableMonitorThread
static constexpr std::chrono::milliseconds kPowerTimeout
MythTimer m_stbWaitForPatTimer
static QHash< void *, uint > s_patKeys
void HandlePAT(const ProgramAssociationTable *pat) override
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
FirewireSignalMonitor * m_parent
void SetVersionPMT(uint pnum, int version, uint last_section)
virtual int ProcessData(const unsigned char *buffer, int len)
void SetVersionPAT(uint tsid, int version, uint last_section)
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
std::chrono::milliseconds elapsed(void)
Returns milliseconds elapsed since last start() or restart()
void start(void)
starts measuring elapsed time.
The Program Association Table lists all the programs in a stream, and is always found on PID 0.
uint TransportStreamID(void) const
A PMT table maps a program described in the ProgramAssociationTable to various PID's which describe t...
void SetThreshold(int _threshold)
bool IsGood() const
Returns true if the value is equal to the threshold, or on the right side of the threshold (depends o...
void SetValue(int _value)
static const uint64_t kDTVSigMon_WaitForVCT
QRecursiveMutex m_statusLock
void SendMessageAllGood(void)
SignalMonitorValue m_signalLock
static const uint64_t kDTVSigMon_WaitForNIT
SignalMonitorValue m_scriptStatus
bool HasFlags(uint64_t _flags) const
static const uint64_t kDTVSigMon_WaitForSDT
virtual void Stop()
Stop signal monitoring thread.
static const uint64_t kDTVSigMon_WaitForPMT
virtual void EmitStatus(void)
static const uint64_t kSigMon_WaitForSig
static const uint64_t kDTVSigMon_WaitForPAT
static const uint64_t kDTVSigMon_PATMatch
We've seen a PAT matching our requirements.
static const uint64_t kDTVSigMon_WaitForMGT
virtual void UpdateValues(void)
This should be overridden to actually do signal monitoring.
static const uint64_t kFWSigMon_PowerSeen
We've seen the FireWire STB power state.
static const uint64_t kFWSigMon_PowerMatch
We've seen a FireWire STB power state matching our requirements.
static const uint64_t kFWSigMon_WaitForPower
SignalMonitorValue m_signalStrength
static const uint64_t kDTVSigMon_PMTSeen
We've seen a PMT, which maps program to audio, video and other stream PIDs.
bool HasAnyFlag(uint64_t _flags) const
static const uint64_t kDTVSigMon_PATSeen
We've seen a PAT, which maps MPEG program numbers to pids where we find PMTs.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)